traits: Fix Any and add Enable-/DisableIfAny
This commit is contained in:
parent
a772cdf30b
commit
5eec3c3c9b
|
@ -21,6 +21,9 @@ using Not = Bool<!T::value>;
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
struct Any : Bool<false> {};
|
struct Any : Bool<false> {};
|
||||||
|
|
||||||
|
template <typename Head, typename... Tail>
|
||||||
|
struct Any<Head, Tail...> : Conditional<Head, Bool<true>, Any<Tail...> > {};
|
||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
struct All : Bool<true> {};
|
struct All : Bool<true> {};
|
||||||
|
|
||||||
|
@ -33,6 +36,12 @@ using EnableIf = typename std::enable_if<All<Condition...>::value, Detail::Enabl
|
||||||
template <typename... Condition>
|
template <typename... Condition>
|
||||||
using DisableIf = typename std::enable_if<!All<Condition...>::value, Detail::Enabler>::type;
|
using DisableIf = typename std::enable_if<!All<Condition...>::value, Detail::Enabler>::type;
|
||||||
|
|
||||||
|
template <typename... Condition>
|
||||||
|
using EnableIfAny = typename std::enable_if<Any<Condition...>::value, Detail::Enabler>::type;
|
||||||
|
|
||||||
|
template <typename... Condition>
|
||||||
|
using DisableIfAny = typename std::enable_if<!Any<Condition...>::value, Detail::Enabler>::type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CPP_UTILITIES_TRAITS_H
|
#endif // CPP_UTILITIES_TRAITS_H
|
||||||
|
|
Loading…
Reference in New Issue