From f81cd736e00c28cf24412a4099bae08ff2e6c493 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 16 Feb 2015 17:35:38 +0100 Subject: Unified `Iota` and `MakeList` using nested structure generator * `detail::generate_nested_structure` offers a higher order nested structure constructor for procedural list generation * renamed `Fold` implementation details --- src/list/generator/iota.h | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'src/list/generator/iota.h') diff --git a/src/list/generator/iota.h b/src/list/generator/iota.h index 73b7cc8..1def67e 100644 --- a/src/list/generator/iota.h +++ b/src/list/generator/iota.h @@ -1,44 +1,24 @@ #ifndef TYPEASVALUE_SRC_LIST_GENERATOR_IOTA_H_ #define TYPEASVALUE_SRC_LIST_GENERATOR_IOTA_H_ +#include "pair.h" #include "operation/math.h" +#include "function/apply.h" +#include "detail/generate_nested_structure.h" namespace tav { -namespace detail { - -template < - typename Count, - typename Initial, - typename Step -> -struct Iota { - typedef Cons< - Initial, - Eval>, - Add, - Step - >> - > type; -}; - -template < - typename Initial, - typename Step -> -struct Iota, Initial, Step> { - typedef Cons type; -}; - -} - template < typename Count, typename Initial, typename Step > -using Iota = Eval>; +using Iota = Eval::template function, + Initial, + Count +>>; } -- cgit v1.2.3