Add simple any_of/all_of implementation for C++17

This commit is contained in:
Jason Rhinelander 2016-12-13 12:23:12 -05:00 committed by Wenzel Jakob
parent fa5d05e15d
commit 6ae68fe301

View File

@ -385,7 +385,10 @@ template <class T> using negation = bool_constant<!T::value>;
#endif #endif
/// Compile-time all/any/none of that check the ::value of all template types /// Compile-time all/any/none of that check the ::value of all template types
#if !defined(_MSC_VER) #ifdef PYBIND11_CPP17
template <class... Ts> using all_of = bool_constant<(Ts::value && ...)>;
template <class... Ts> using any_of = bool_constant<(Ts::value || ...)>;
#elif !defined(_MSC_VER)
template <bool...> struct bools {}; template <bool...> struct bools {};
template <class... Ts> using all_of = std::is_same< template <class... Ts> using all_of = std::is_same<
bools<Ts::value..., true>, bools<Ts::value..., true>,