diff options
Diffstat (limited to 'src/list/generator')
-rw-r--r-- | src/list/generator/iota.h | 17 | ||||
-rw-r--r-- | src/list/generator/make_list.h | 16 |
2 files changed, 27 insertions, 6 deletions
diff --git a/src/list/generator/iota.h b/src/list/generator/iota.h index 56ebeca..73b7cc8 100644 --- a/src/list/generator/iota.h +++ b/src/list/generator/iota.h @@ -5,20 +5,22 @@ namespace tav { +namespace detail { + template < typename Count, typename Initial, typename Step > struct Iota { - typedef Eval<Cons< + typedef Cons< Initial, Eval<Iota< Substract<Count, Size<1>>, Add<Initial, Step>, Step >> - >> type; + > type; }; template < @@ -26,9 +28,18 @@ template < typename Step > struct Iota<Size<1>, Initial, Step> { - typedef Eval<Cons<Initial, void>> type; + typedef Cons<Initial, void> type; }; } +template < + typename Count, + typename Initial, + typename Step +> +using Iota = Eval<detail::Iota<Count, Initial, Step>>; + +} + #endif // TYPEASVALUE_SRC_LIST_GENERATOR_IOTA_H_ diff --git a/src/list/generator/make_list.h b/src/list/generator/make_list.h index d927905..863dce2 100644 --- a/src/list/generator/make_list.h +++ b/src/list/generator/make_list.h @@ -6,25 +6,35 @@ namespace tav { +namespace detail { + template < typename Count, typename Element > struct MakeList { - typedef Eval<Cons< + typedef Cons< Element, Eval<MakeList< Substract<Count, Size<1>>, Element >> - >> type; + > type; }; template <typename Element> struct MakeList<Size<1>, Element> { - typedef Eval<Cons<Element, void>> type; + typedef Cons<Element, void> type; }; } +template < + typename Count, + typename Element +> +using MakeList = Eval<detail::MakeList<Count, Element>>; + +} + #endif // TYPEASVALUE_SRC_LIST_GENERATOR_MAKE_LIST_H_ |