Skip to content

Commit 6ae68fe

Browse files
jagermanwjakob
authored andcommitted
Add simple any_of/all_of implementation for C++17
1 parent fa5d05e commit 6ae68fe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/pybind11/common.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,10 @@ template <class T> using negation = bool_constant<!T::value>;
385385
#endif
386386

387387
/// Compile-time all/any/none of that check the ::value of all template types
388-
#if !defined(_MSC_VER)
388+
#ifdef PYBIND11_CPP17
389+
template <class... Ts> using all_of = bool_constant<(Ts::value && ...)>;
390+
template <class... Ts> using any_of = bool_constant<(Ts::value || ...)>;
391+
#elif !defined(_MSC_VER)
389392
template <bool...> struct bools {};
390393
template <class... Ts> using all_of = std::is_same<
391394
bools<Ts::value..., true>,

0 commit comments

Comments
 (0)