mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 15:12:01 +00:00
Add simple any_of/all_of implementation for C++17
This commit is contained in:
parent
fa5d05e15d
commit
6ae68fe301
@ -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>,
|
||||||
|
Loading…
Reference in New Issue
Block a user