diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/conditional/if.h | 8 | ||||
-rw-r--r-- | src/list/list.h | 10 | ||||
-rw-r--r-- | src/type.h | 3 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/conditional/if.h b/src/conditional/if.h index 29aa6f0..b9568f6 100644 --- a/src/conditional/if.h +++ b/src/conditional/if.h @@ -7,13 +7,13 @@ namespace tav { template < bool Condition, - typename IfBranch, - typename ElseBranch + typename TrueBranch, + typename FalseBranch > using If = typename std::conditional< Condition, - IfBranch, - ElseBranch + TrueBranch, + FalseBranch >::type; } diff --git a/src/list/list.h b/src/list/list.h index edd46e8..f21d0fc 100644 --- a/src/list/list.h +++ b/src/list/list.h @@ -27,6 +27,16 @@ using Head = Car<Cons>; template <typename Cons> using Tail = Cdr<Cons>; +template <typename Cons> +struct Length { + typedef Add<Size<1>, typename Length<Cdr<Cons>>::type> type; +}; + +template <> +struct Length<void> { + typedef Size<0> type; +}; + template < typename Primary, typename Secondary @@ -8,6 +8,9 @@ namespace tav { template <int Value> using Int = typename std::integral_constant<int, Value>::type; +template <std::size_t Value> +using Size = typename std::integral_constant<std::size_t, Value>::type; + template <bool Value> using Boolean = typename std::integral_constant<bool, Value>::type; |