diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/list/generator/higher/list_tabulate.h | 20 | ||||
-rw-r--r-- | src/list/generator/iota.h (renamed from src/list/iota.h) | 6 | ||||
-rw-r--r-- | src/operation/math.h | 3 |
3 files changed, 26 insertions, 3 deletions
diff --git a/src/list/generator/higher/list_tabulate.h b/src/list/generator/higher/list_tabulate.h new file mode 100644 index 0000000..9eee599 --- /dev/null +++ b/src/list/generator/higher/list_tabulate.h @@ -0,0 +1,20 @@ +#ifndef TYPEASVALUE_SRC_LIST_GENERATOR_HIGHER_LIST_TABULATE_H_ +#define TYPEASVALUE_SRC_LIST_GENERATOR_HIGHER_LIST_TABULATE_H_ + +#include "list/generator/iota.h" +#include "list/operation/higher/misc.h" + +namespace tav { + +template < + typename Count, + template<typename> class Initializer +> +using ListTabulate = Map< + Initializer, + typename Iota<Count, Size<0>, Size<1>>::type +>; + +} + +#endif // TYPEASVALUE_SRC_LIST_GENERATOR_HIGHER_LIST_TABULATE_H_ diff --git a/src/list/iota.h b/src/list/generator/iota.h index 9a8d22d..54f0f40 100644 --- a/src/list/iota.h +++ b/src/list/generator/iota.h @@ -1,5 +1,5 @@ -#ifndef TYPEASVALUE_SRC_LIST_IOTA_H_ -#define TYPEASVALUE_SRC_LIST_IOTA_H_ +#ifndef TYPEASVALUE_SRC_LIST_GENERATOR_IOTA_H_ +#define TYPEASVALUE_SRC_LIST_GENERATOR_IOTA_H_ #include "operation/math.h" @@ -31,4 +31,4 @@ struct Iota<Size<1>, Initial, Step> { } -#endif // TYPEASVALUE_SRC_LIST_IOTA_H_ +#endif // TYPEASVALUE_SRC_LIST_GENERATOR_IOTA_H_ diff --git a/src/operation/math.h b/src/operation/math.h index b06eb35..0ede3f5 100644 --- a/src/operation/math.h +++ b/src/operation/math.h @@ -41,6 +41,9 @@ using Divide = typename std::integral_constant< X::value / Y::value >::type; +template <typename Base> +using Square = Multiply<Base, Base>; + template <typename X> using Even = Boolean<(X::value % 2 == 0)>; |