Browse Source

traits: Fix Any and add Enable-/DisableIfAny

feature/exec_app
Martchus 5 years ago
parent
commit
5eec3c3c9b
  1. 9
      misc/traits.h

9
misc/traits.h

@ -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

Loading…
Cancel
Save