traits: Fix Any and add Enable-/DisableIfAny

This commit is contained in:
Martchus 2017-01-27 18:49:53 +01:00
parent a772cdf30b
commit 5eec3c3c9b
1 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,9 @@ using Not = Bool<!T::value>;
template <typename... T>
struct Any : Bool<false> {};
template <typename Head, typename... Tail>
struct Any<Head, Tail...> : Conditional<Head, Bool<true>, Any<Tail...> > {};
template <typename... T>
struct All : Bool<true> {};
@ -33,6 +36,12 @@ using EnableIf = typename std::enable_if<All<Condition...>::value, Detail::Enabl
template <typename... Condition>
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