diff --git a/ostd/array.hh b/ostd/array.hh index fb2d1ae..e861b1e 100644 --- a/ostd/array.hh +++ b/ostd/array.hh @@ -77,7 +77,7 @@ struct Array { }; template -struct TupleSize>: IntegralConstant {}; +struct TupleSize>: Constant {}; template struct TupleElementBase> { diff --git a/ostd/internal/tuple.hh b/ostd/internal/tuple.hh index 47196e3..89de645 100644 --- a/ostd/internal/tuple.hh +++ b/ostd/internal/tuple.hh @@ -143,7 +143,7 @@ public: }; template struct TupleSize>: - IntegralConstant {}; + Constant {}; template struct IsTupleLike>: True {}; @@ -185,7 +185,7 @@ namespace detail { template struct TupleConvertibleBase, TupleTypes>: - IntegralConstant && + Constant && TupleConvertibleBase, TupleTypes>::value> {}; @@ -218,7 +218,7 @@ namespace detail { template struct TupleConstructibleBase, TupleTypes>: - IntegralConstant && + Constant && TupleConstructibleBase, TupleTypes>::value> {}; @@ -251,7 +251,7 @@ namespace detail { template struct TupleAssignableBase, TupleTypes>: - IntegralConstant && + Constant && TupleAssignableBase, TupleTypes>::value> {}; diff --git a/ostd/memory.hh b/ostd/memory.hh index be1d52d..5ae0a36 100644 --- a/ostd/memory.hh +++ b/ostd/memory.hh @@ -208,7 +208,7 @@ namespace detail { template static char ptr_test(typename T::Pointer * = 0); - template struct HasPtr: IntegralConstant struct HasPtr: Constant(0)) == 1) > {}; @@ -327,7 +327,7 @@ namespace detail { RemoveCv>, RemoveCv> >> struct SameOrLessCvQualifiedBase: - IntegralConstant> {}; + Constant> {}; template struct SameOrLessCvQualifiedBase: False {}; @@ -850,7 +850,7 @@ namespace detail { template::value> struct IsAlwaysEqualBase { - using Type = IntegralConstant>; + using Type = Constant>; }; template @@ -880,7 +880,7 @@ namespace detail { -> False; template - struct AllocateHintTest: IntegralConstant(), declval(), declval())), True @@ -933,7 +933,7 @@ namespace detail { -> False; template - struct ConstructTest: IntegralConstant(), declval(), declval()...)), True @@ -967,7 +967,7 @@ namespace detail { auto destroy_test(const A &, P &&) -> False; template - struct DestroyTest: IntegralConstant(), declval

())), True> > {}; @@ -997,7 +997,7 @@ namespace detail { auto alloc_max_size_test(const A &) -> False; template - struct AllocMaxSizeTest: IntegralConstant())), True> > {}; @@ -1027,7 +1027,7 @@ namespace detail { auto alloc_copy_test(const A &) -> False; template - struct AllocCopyTest: IntegralConstant())), True> > {}; @@ -1065,7 +1065,7 @@ namespace detail { }; template::value> - struct UsesAllocatorBase: IntegralConstant > {}; @@ -1090,7 +1090,7 @@ namespace detail { } template -struct UsesAllocatorConstructor: IntegralConstant::value > {}; diff --git a/ostd/string.hh b/ostd/string.hh index b1f5fd5..d92b29c 100644 --- a/ostd/string.hh +++ b/ostd/string.hh @@ -658,7 +658,7 @@ namespace detail { template auto test_stringify(int) -> - IntegralConstant().stringify()), String>>; + Constant().stringify()), String>>; template static True test_stringify(decltype(declval().to_string diff --git a/ostd/tuple.hh b/ostd/tuple.hh index cea2d5c..ea466fc 100644 --- a/ostd/tuple.hh +++ b/ostd/tuple.hh @@ -18,7 +18,7 @@ namespace ostd { /* tuple size */ template struct TupleSize>: - IntegralConstant {}; + Constant {}; /* tuple element */ @@ -38,17 +38,17 @@ namespace detail { } template - TupleLeaf(IntegralConstant, const A &): p_value() { + TupleLeaf(Constant, const A &): p_value() { static_assert(!IsReference, "attempt to default construct a reference element in a tuple"); } template - TupleLeaf(IntegralConstant, const A &a): p_value(allocator_arg, a) { + TupleLeaf(Constant, const A &a): p_value(allocator_arg, a) { static_assert(!IsReference, "attempt to default construct a reference element in a tuple"); } template - TupleLeaf(IntegralConstant, const A &a): p_value(a) { + TupleLeaf(Constant, const A &a): p_value(a) { static_assert(!IsReference, "attempt to default construct a reference element in a tuple"); } @@ -68,7 +68,7 @@ namespace detail { } template - explicit TupleLeaf(IntegralConstant, const A &, T &&t): + explicit TupleLeaf(Constant, const A &, T &&t): p_value(forward(t)) { static_assert(!IsLvalueReference || (IsLvalueReference && @@ -79,7 +79,7 @@ namespace detail { } template - explicit TupleLeaf(IntegralConstant, const A &a, T &&t): + explicit TupleLeaf(Constant, const A &a, T &&t): p_value(allocator_arg, a, forward(t)) { static_assert(!IsLvalueReference || (IsLvalueReference && @@ -90,7 +90,7 @@ namespace detail { } template - explicit TupleLeaf(IntegralConstant, const A &a, T &&t): + explicit TupleLeaf(Constant, const A &a, T &&t): p_value(forward(t), a) { static_assert(!IsLvalueReference || (IsLvalueReference && @@ -126,29 +126,29 @@ namespace detail { constexpr TupleLeaf() {} template - TupleLeaf(IntegralConstant, const A &) {} + TupleLeaf(Constant, const A &) {} template - TupleLeaf(IntegralConstant, const A &a): + TupleLeaf(Constant, const A &a): H(allocator_arg, a) {} template - TupleLeaf(IntegralConstant, const A &a): H(a) {} + TupleLeaf(Constant, const A &a): H(a) {} template, TupleLeaf> && IsConstructible >> explicit TupleLeaf(T &&t): H(forward(t)) {} template - explicit TupleLeaf(IntegralConstant, const A &, T &&t): + explicit TupleLeaf(Constant, const A &, T &&t): H(forward(t)) {} template - explicit TupleLeaf(IntegralConstant, const A &a, T &&t): + explicit TupleLeaf(Constant, const A &a, T &&t): H(allocator_arg, a, forward(t)) {} template - explicit TupleLeaf(IntegralConstant, const A &a, T &&t): + explicit TupleLeaf(Constant, const A &a, T &&t): H(forward(t), a) {} TupleLeaf(const TupleLeaf &) = default; @@ -179,7 +179,7 @@ namespace detail { inline void tuple_swallow(A &&...) {} template struct TupleAll: - IntegralConstant, TupleAll<(A, true)...>>> {}; + Constant, TupleAll<(A, true)...>>> {}; template struct TupleAllDefaultConstructible; diff --git a/ostd/type_traits.hh b/ostd/type_traits.hh index e3eb8f2..a0073ce 100644 --- a/ostd/type_traits.hh +++ b/ostd/type_traits.hh @@ -49,20 +49,20 @@ namespace detail { /* integral constant */ template -struct IntegralConstant { +struct Constant { static constexpr T value = val; using Value = T; - using Type = IntegralConstant; + using Type = Constant; constexpr operator Value() const { return value; } constexpr Value operator()() const { return value; } }; -using True = IntegralConstant; -using False = IntegralConstant; +using True = Constant; +using False = Constant; -template constexpr T IntegralConstant::value; +template constexpr T Constant::value; /* type equality */ @@ -609,7 +609,7 @@ namespace detail { template || IsFunction || IsArray > struct IsConvertibleBase { - using Type = IntegralConstant>; + using Type = Constant>; }; template diff --git a/ostd/utility.hh b/ostd/utility.hh index dec9fd1..3de716c 100644 --- a/ostd/utility.hh +++ b/ostd/utility.hh @@ -50,7 +50,7 @@ template AddRvalueReference declval(); namespace detail { template auto test_swap(int) -> - IntegralConstant().swap(declval()))>>; + Constant().swap(declval()))>>; template False test_swap(...); @@ -209,7 +209,7 @@ inline constexpr bool operator>=(const Pair &x, const Pair &y) { } template -struct TupleSize>: IntegralConstant {}; +struct TupleSize>: Constant {}; template struct TupleElementBase<0, Pair> {