convert IsSame to template variable
parent
7edf3e1d4a
commit
9b11c1d319
|
@ -619,7 +619,7 @@ namespace detail {
|
|||
template<typename R, typename P> using FilterPred
|
||||
= EnableIf<IsSame<
|
||||
decltype(declval<P>()(declval<RangeReference<R>>())), bool
|
||||
>::value, P>;
|
||||
>, P>;
|
||||
}
|
||||
|
||||
template<typename R, typename P>
|
||||
|
|
|
@ -288,7 +288,7 @@ template <typename T> inline T kill_dependency(T v) {
|
|||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename T, bool = IsIntegral<T> && !IsSame<T, bool>::value>
|
||||
template<typename T, bool = IsIntegral<T> && !IsSame<T, bool>>
|
||||
struct Atomic {
|
||||
mutable AtomicBase<T> p_a;
|
||||
|
||||
|
@ -656,13 +656,13 @@ inline bool atomic_compare_exchange_strong_explicit(Atomic<T> *a, T *e,
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_add(volatile Atomic<T> *a, T op) {
|
||||
return a->fetch_add(op);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_add(Atomic<T> *a, T op) {
|
||||
return a->fetch_add(op);
|
||||
}
|
||||
|
@ -678,14 +678,14 @@ inline T *atomic_fetch_add(Atomic<T *> *a, Ptrdiff op) {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_add_explicit(volatile Atomic<T> *a, T op,
|
||||
MemoryOrder ord) {
|
||||
return a->fetch_add(op, ord);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_add_explicit(Atomic<T> *a, T op, MemoryOrder ord) {
|
||||
return a->fetch_add(op, ord);
|
||||
}
|
||||
|
@ -703,13 +703,13 @@ inline T *atomic_fetch_add_explicit(Atomic<T *> *a, Ptrdiff op,
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_sub(volatile Atomic<T> *a, T op) {
|
||||
return a->fetch_sub(op);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_sub(Atomic<T> *a, T op) {
|
||||
return a->fetch_sub(op);
|
||||
}
|
||||
|
@ -725,14 +725,14 @@ inline T *atomic_fetch_sub(Atomic<T *> *a, Ptrdiff op) {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_sub_explicit(volatile Atomic<T> *a, T op,
|
||||
MemoryOrder ord) {
|
||||
return a->fetch_sub(op, ord);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_sub_explicit(Atomic<T> *a, T op, MemoryOrder ord) {
|
||||
return a->fetch_sub(op, ord);
|
||||
}
|
||||
|
@ -750,76 +750,76 @@ inline T *atomic_fetch_sub_explicit(Atomic<T *> *a, Ptrdiff op,
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_and(volatile Atomic<T> *a, T op) {
|
||||
return a->fetch_and(op);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_and(Atomic<T> *a, T op) {
|
||||
return a->fetch_and(op);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_and_explicit(volatile Atomic<T> *a, T op,
|
||||
MemoryOrder ord) {
|
||||
return a->fetch_and(op, ord);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_and_explicit(Atomic<T> *a, T op, MemoryOrder ord) {
|
||||
return a->fetch_and(op, ord);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_or(volatile Atomic<T> *a, T op) {
|
||||
return a->fetch_or(op);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_or(Atomic<T> *a, T op) {
|
||||
return a->fetch_or(op);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_or_explicit(volatile Atomic<T> *a, T op,
|
||||
MemoryOrder ord) {
|
||||
return a->fetch_or(op, ord);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_or_explicit(Atomic<T> *a, T op, MemoryOrder ord) {
|
||||
return a->fetch_or(op, ord);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_xor(volatile Atomic<T> *a, T op) {
|
||||
return a->fetch_xor(op);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_xor(Atomic<T> *a, T op) {
|
||||
return a->fetch_xor(op);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_xor_explicit(volatile Atomic<T> *a, T op,
|
||||
MemoryOrder ord) {
|
||||
return a->fetch_xor(op, ord);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>::value, T>
|
||||
inline EnableIf<IsIntegral<T> && !IsSame<T, bool>, T>
|
||||
atomic_fetch_xor_explicit(Atomic<T> *a, T op, MemoryOrder ord) {
|
||||
return a->fetch_xor(op, ord);
|
||||
}
|
||||
|
|
|
@ -401,7 +401,7 @@ protected:
|
|||
template<typename T, typename R, typename = EnableIf<
|
||||
IsSame<decltype(declval<const T &>()
|
||||
.to_format(declval<R &>(), declval<const FormatSpec &>())), bool
|
||||
>::value
|
||||
>
|
||||
>> inline bool to_format(const T &v, R &writer, const FormatSpec &fs) {
|
||||
return v.to_format(writer, fs);
|
||||
}
|
||||
|
@ -692,11 +692,9 @@ namespace detail {
|
|||
return detail::write_u(writer, this, false, val);
|
||||
}
|
||||
|
||||
template<typename R, typename T,
|
||||
bool Long = IsSame<T, ldouble>::value
|
||||
> Ptrdiff write(R &writer, bool, T val, EnableIf<
|
||||
IsFloatingPoint<T>, bool
|
||||
> = true) {
|
||||
template<typename R, typename T, bool Long = IsSame<T, ldouble>>
|
||||
Ptrdiff write(R &writer, bool, T val, EnableIf<IsFloatingPoint<T>, bool>
|
||||
= true) {
|
||||
char buf[16], rbuf[128];
|
||||
char fmtspec[Long + 1];
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ OSTD_DEFINE_BINARY_OP(BitXor, ^, T)
|
|||
#undef OSTD_DEFINE_BINARY_OP
|
||||
|
||||
namespace detail {
|
||||
template<typename T, bool = IsSame<RemoveConst<T>, char>::value>
|
||||
template<typename T, bool = IsSame<RemoveConst<T>, char>>
|
||||
struct CharEqual {
|
||||
using FirstArgument = T *;
|
||||
using SecondArgument = T *;
|
||||
|
@ -372,7 +372,7 @@ template<> struct ToHash<ldouble>: detail::ScalarHash<ldouble> {
|
|||
};
|
||||
|
||||
namespace detail {
|
||||
template<typename T, bool = IsSame<RemoveConst<T>, char>::value>
|
||||
template<typename T, bool = IsSame<RemoveConst<T>, char>>
|
||||
struct ToHashPtr {
|
||||
using Argument = T *;
|
||||
using Result = Size;
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
template<typename U>
|
||||
HashRange(const HashRange<U> &v, EnableIf<
|
||||
IsSame<RemoveCv<T>, RemoveCv<U>>::value &&
|
||||
IsSame<RemoveCv<T>, RemoveCv<U>> &&
|
||||
IsConvertible<U *, T *>::value, bool
|
||||
> = true): p_node((Chain *)v.p_node) {}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
|
||||
template<typename U>
|
||||
BucketRange(const BucketRange<U> &v, EnableIf<
|
||||
IsSame<RemoveCv<T>, RemoveCv<U>>::value &&
|
||||
IsSame<RemoveCv<T>, RemoveCv<U>> &&
|
||||
IsConvertible<U *, T *>::value, bool
|
||||
> = true): p_node((Chain *)v.p_node), p_end((Chain *)v.p_end) {}
|
||||
|
||||
|
|
|
@ -95,9 +95,9 @@ public:
|
|||
|
||||
static_assert(!IsReference<T>,
|
||||
"Initialization of Maybe with a reference type is not allowed.");
|
||||
static_assert(!IsSame<RemoveCv<T>, InPlace>::value,
|
||||
static_assert(!IsSame<RemoveCv<T>, InPlace>,
|
||||
"Initialization of Maybe with InPlace is not allowed.");
|
||||
static_assert(!IsSame<RemoveCv<T>, Nothing>::value,
|
||||
static_assert(!IsSame<RemoveCv<T>, Nothing>,
|
||||
"Initialization of Maybe with Nothing is not allowed.");
|
||||
static_assert(IsObject<T>,
|
||||
"Initialization of Maybe with non-object type is not allowed.");
|
||||
|
@ -159,7 +159,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename U, typename = EnableIf<
|
||||
IsSame<RemoveReference<U>, Value>::value &&
|
||||
IsSame<RemoveReference<U>, Value> &&
|
||||
IsConstructible<Value, U> && IsAssignable<Value &, U>
|
||||
>>
|
||||
Maybe &operator=(U &&v) {
|
||||
|
|
|
@ -264,7 +264,7 @@ public:
|
|||
Box(Box<TT, DD> &&u, EnableIf<!IsArray<TT>
|
||||
&& IsConvertible<typename Box<TT, DD>::Pointer, Pointer>::value
|
||||
&& IsConvertible<DD, D>::value
|
||||
&& (!IsReference<D> || IsSame<D, DD>::value)
|
||||
&& (!IsReference<D> || IsSame<D, DD>)
|
||||
> = Nat()): p_stor(u.release(), forward<DD>(u.get_deleter())) {}
|
||||
|
||||
Box &operator=(Box &&u) {
|
||||
|
@ -327,13 +327,13 @@ namespace detail {
|
|||
template<typename T, typename U, bool = IsSame<
|
||||
RemoveCv<PointerElement<T>>,
|
||||
RemoveCv<PointerElement<U>>
|
||||
>::value> struct SameOrLessCvQualifiedBase: IsConvertible<T, U> {};
|
||||
>> struct SameOrLessCvQualifiedBase: IsConvertible<T, U> {};
|
||||
|
||||
template<typename T, typename U>
|
||||
struct SameOrLessCvQualifiedBase<T, U, false>: False {};
|
||||
|
||||
template<typename T, typename U, bool = IsPointer<T>
|
||||
|| IsSame<T, U>::value || detail::HasElement<T>::value
|
||||
|| IsSame<T, U> || detail::HasElement<T>::value
|
||||
> struct SameOrLessCvQualified: SameOrLessCvQualifiedBase<T, U> {};
|
||||
|
||||
template<typename T, typename U>
|
||||
|
@ -393,7 +393,7 @@ public:
|
|||
&& detail::SameOrLessCvQualified<typename Box<TT, DD>::Pointer,
|
||||
Pointer>::value
|
||||
&& IsConvertible<DD, D>::value
|
||||
&& (!IsReference<D> || IsSame<D, DD>::value)> = Nat()
|
||||
&& (!IsReference<D> || IsSame<D, DD>)> = Nat()
|
||||
): p_stor(u.release(), forward<DD>(u.get_deleter())) {}
|
||||
|
||||
Box &operator=(Box &&u) {
|
||||
|
@ -885,7 +885,7 @@ namespace detail {
|
|||
IsSame<decltype(allocate_hint_test(declval<A>(),
|
||||
declval<S>(),
|
||||
declval<CVP>())), True
|
||||
>::value
|
||||
>
|
||||
> {};
|
||||
|
||||
template<typename A>
|
||||
|
@ -938,7 +938,7 @@ namespace detail {
|
|||
IsSame< decltype(construct_test(declval<A>(),
|
||||
declval<T>(),
|
||||
declval<Args>()...)), True
|
||||
>::value
|
||||
>
|
||||
> {};
|
||||
|
||||
template<typename A, typename T, typename ...Args>
|
||||
|
@ -969,8 +969,7 @@ namespace detail {
|
|||
|
||||
template<typename A, typename P>
|
||||
struct DestroyTest: IntegralConstant<bool,
|
||||
IsSame<decltype(destroy_test(declval<A>(), declval<P>())), True
|
||||
>::value
|
||||
IsSame<decltype(destroy_test(declval<A>(), declval<P>())), True>
|
||||
> {};
|
||||
|
||||
template<typename A, typename T>
|
||||
|
@ -1000,8 +999,7 @@ namespace detail {
|
|||
|
||||
template<typename A>
|
||||
struct AllocMaxSizeTest: IntegralConstant<bool,
|
||||
IsSame<decltype(alloc_max_size_test(declval<A &>())), True
|
||||
>::value
|
||||
IsSame<decltype(alloc_max_size_test(declval<A &>())), True>
|
||||
> {};
|
||||
|
||||
template<typename A>
|
||||
|
@ -1031,8 +1029,7 @@ namespace detail {
|
|||
|
||||
template<typename A>
|
||||
struct AllocCopyTest: IntegralConstant<bool,
|
||||
IsSame<decltype(alloc_copy_test(declval<A &>())), True
|
||||
>::value
|
||||
IsSame<decltype(alloc_copy_test(declval<A &>())), True>
|
||||
> {};
|
||||
|
||||
template<typename A>
|
||||
|
|
|
@ -210,7 +210,7 @@ class StringBase {
|
|||
template<typename R>
|
||||
void ctor_from_range(R &range, EnableIf<
|
||||
IsFiniteRandomAccessRange<R>::value &&
|
||||
IsSame<T, RemoveCv<RangeValue<R>>>::value, bool
|
||||
IsSame<T, RemoveCv<RangeValue<R>>>, bool
|
||||
> = true) {
|
||||
if (range.empty()) return;
|
||||
RangeSize<R> l = range.size();
|
||||
|
@ -223,7 +223,7 @@ class StringBase {
|
|||
template<typename R>
|
||||
void ctor_from_range(R &range, EnableIf<
|
||||
!IsFiniteRandomAccessRange<R>::value ||
|
||||
!IsSame<T, RemoveCv<RangeValue<R>>>::value, bool
|
||||
!IsSame<T, RemoveCv<RangeValue<R>>>, bool
|
||||
> = true) {
|
||||
if (range.empty()) return;
|
||||
Size i = 0;
|
||||
|
@ -669,7 +669,7 @@ namespace detail {
|
|||
|
||||
template<typename T, typename R>
|
||||
auto test_stringify(int) ->
|
||||
decltype(IsSame<decltype(declval<T>().stringify()), String>());
|
||||
IntegralConstant<bool, IsSame<decltype(declval<T>().stringify()), String>>;
|
||||
|
||||
template<typename T, typename R>
|
||||
static True test_stringify(decltype(declval<const T &>().to_string
|
||||
|
|
|
@ -53,18 +53,16 @@ namespace detail {
|
|||
"attempt to default construct a reference element in a tuple");
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
typename = EnableIf<And<Not<IsSame<Decay<T>, TupleLeaf>>,
|
||||
IntegralConstant<bool,
|
||||
IsConstructible<H, T>
|
||||
>>::value>>
|
||||
template<typename T, typename = EnableIf<And<
|
||||
Not<IntegralConstant<bool, IsSame<Decay<T>, TupleLeaf>>>,
|
||||
IntegralConstant<bool, IsConstructible<H, T>>
|
||||
>::value>>
|
||||
explicit TupleLeaf(T &&t): p_value(forward<T>(t)) {
|
||||
static_assert(!IsReference<H> ||
|
||||
(IsLvalueReference<H> &&
|
||||
(IsLvalueReference<T> ||
|
||||
IsSame<RemoveReference<T>,
|
||||
ReferenceWrapper<RemoveReference<H>>
|
||||
>::value)) ||
|
||||
ReferenceWrapper<RemoveReference<H>>>)) ||
|
||||
(IsRvalueReference<H> &&
|
||||
!IsLvalueReference<T>),
|
||||
"attempt to construct a reference element in a tuple with an rvalue");
|
||||
|
@ -77,8 +75,7 @@ namespace detail {
|
|||
(IsLvalueReference<H> &&
|
||||
(IsLvalueReference<T> ||
|
||||
IsSame<RemoveReference<T>,
|
||||
ReferenceWrapper<RemoveReference<H>>
|
||||
>::value)),
|
||||
ReferenceWrapper<RemoveReference<H>>>)),
|
||||
"attempt to construct a reference element in a tuple with an rvalue");
|
||||
}
|
||||
|
||||
|
@ -89,8 +86,7 @@ namespace detail {
|
|||
(IsLvalueReference<H> &&
|
||||
(IsLvalueReference<T> ||
|
||||
IsSame<RemoveReference<T>,
|
||||
ReferenceWrapper<RemoveReference<H>>
|
||||
>::value)),
|
||||
ReferenceWrapper<RemoveReference<H>>>)),
|
||||
"attempt to construct a reference element in a tuple with an rvalue");
|
||||
}
|
||||
|
||||
|
@ -101,8 +97,7 @@ namespace detail {
|
|||
(IsLvalueReference<H> &&
|
||||
(IsLvalueReference<T> ||
|
||||
IsSame<RemoveReference<T>,
|
||||
ReferenceWrapper<RemoveReference<H>>
|
||||
>::value)),
|
||||
ReferenceWrapper<RemoveReference<H>>>)),
|
||||
"attempt to construct a reference element in a tuple with an rvalue");
|
||||
}
|
||||
|
||||
|
@ -143,7 +138,7 @@ namespace detail {
|
|||
|
||||
template<typename T,
|
||||
typename = EnableIf<And<
|
||||
Not<IsSame<Decay<T>, TupleLeaf>>,
|
||||
Not<IntegralConstant<bool, IsSame<Decay<T>, TupleLeaf>>>,
|
||||
IntegralConstant<bool, IsConstructible<H, T>>
|
||||
>::value>
|
||||
> explicit TupleLeaf(T &&t): H(forward<T>(t)) {}
|
||||
|
@ -187,8 +182,8 @@ namespace detail {
|
|||
template<typename ...A>
|
||||
inline void tuple_swallow(A &&...) {}
|
||||
|
||||
template<bool ...A>
|
||||
struct TupleAll: IsSame<TupleAll<A...>, TupleAll<(A, true)...>> {};
|
||||
template<bool ...A> struct TupleAll:
|
||||
IntegralConstant<bool, IsSame<TupleAll<A...>, TupleAll<(A, true)...>>> {};
|
||||
|
||||
template<typename T>
|
||||
struct TupleAllDefaultConstructible;
|
||||
|
|
|
@ -110,18 +110,23 @@ struct Not: IntegralConstant<bool, !T::Type::value> {};
|
|||
|
||||
/* type equality */
|
||||
|
||||
template<typename, typename> struct IsSame : False {};
|
||||
template<typename T > struct IsSame<T, T>: True {};
|
||||
namespace detail {
|
||||
template<typename, typename> struct IsSameBase : False {};
|
||||
template<typename T > struct IsSameBase<T, T>: True {};
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
static constexpr bool IsSame = detail::IsSameBase<T, U>::value;
|
||||
|
||||
/* is void */
|
||||
|
||||
template<typename T>
|
||||
static constexpr bool IsVoid = IsSame<RemoveCv<T>, void>::value;
|
||||
static constexpr bool IsVoid = IsSame<RemoveCv<T>, void>;
|
||||
|
||||
/* is null pointer */
|
||||
|
||||
template<typename T>
|
||||
static constexpr bool IsNullPointer = IsSame<RemoveCv<T>, Nullptr>::value;
|
||||
static constexpr bool IsNullPointer = IsSame<RemoveCv<T>, Nullptr>;
|
||||
|
||||
/* is integer */
|
||||
|
||||
|
@ -326,12 +331,12 @@ template<typename T> static constexpr bool IsAbstract = __is_abstract(T);
|
|||
/* is const */
|
||||
|
||||
template<typename T>
|
||||
static constexpr bool IsConst = IsSame<T, const T>::value;
|
||||
static constexpr bool IsConst = IsSame<T, const T>;
|
||||
|
||||
/* is volatile */
|
||||
|
||||
template<typename T>
|
||||
static constexpr bool IsVolatile = IsSame<T, volatile T>::value;
|
||||
static constexpr bool IsVolatile = IsSame<T, volatile T>;
|
||||
|
||||
/* is empty */
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ TupleElement<I, Pair<T, U>> &&get(Pair<T, U> &&p) {
|
|||
|
||||
namespace detail {
|
||||
template<typename T, typename U,
|
||||
bool = IsSame<RemoveCv<T>, RemoveCv<U>>::value,
|
||||
bool = IsSame<RemoveCv<T>, RemoveCv<U>>,
|
||||
bool = IsEmpty<T>, bool = IsEmpty<U>
|
||||
> struct CompressedPairSwitch;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class Vector {
|
|||
template<typename R>
|
||||
void ctor_from_range(R &range, EnableIf<
|
||||
IsFiniteRandomAccessRange<R>::value && IsPod<T> &&
|
||||
IsSame<T, RemoveCv<RangeValue<R>>>::value, bool
|
||||
IsSame<T, RemoveCv<RangeValue<R>>>, bool
|
||||
> = true) {
|
||||
RangeSize<R> l = range.size();
|
||||
reserve(l);
|
||||
|
@ -47,7 +47,7 @@ class Vector {
|
|||
template<typename R>
|
||||
void ctor_from_range(R &range, EnableIf<
|
||||
!IsFiniteRandomAccessRange<R>::value || !IsPod<T> ||
|
||||
!IsSame<T, RemoveCv<RangeValue<R>>>::value, bool
|
||||
!IsSame<T, RemoveCv<RangeValue<R>>>, bool
|
||||
> = true) {
|
||||
Size i = 0;
|
||||
for (; !range.empty(); range.pop_front()) {
|
||||
|
|
|
@ -77,8 +77,8 @@ int main() {
|
|||
|
||||
auto x = make_pair(5, 3.14f);
|
||||
|
||||
assert((IsSame<decltype(x.first), int>::value));
|
||||
assert((IsSame<decltype(x.second), float>::value));
|
||||
assert((IsSame<decltype(x.first), int>));
|
||||
assert((IsSame<decltype(x.second), float>));
|
||||
|
||||
assert(x.first == 5);
|
||||
assert(x.second == 3.14f);
|
||||
|
|
Loading…
Reference in New Issue