Skip to content

Commit 7e0d3eb

Browse files
committed
Add simple any_of/all_of implementation for C++17
1 parent dc26209 commit 7e0d3eb

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
@@ -374,7 +374,10 @@ template <class T> using negation = bool_constant<!T::value>;
374374
#endif
375375

376376
/// Compile-time all/any/none of that check the ::value of all template types
377-
#if !defined(_MSC_VER)
377+
#ifdef PYBIND11_CPP17
378+
template <class... Ts> using all_of = bool_constant<(Ts::value && ...)>;
379+
template <class... Ts> using any_of = bool_constant<(Ts::value || ...)>;
380+
#elif !defined(_MSC_VER)
378381
template <bool...> struct bools {};
379382
template <class... Ts> using all_of = std::is_same<
380383
bools<Ts::value..., true>,

0 commit comments

Comments
 (0)