mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 22:52:01 +00:00
Use custom definitions for negation and bool_constant (#737)
Instead of relying on sometimes missing C++17 definitions
This commit is contained in:
parent
cabbf610a7
commit
68e089a8bf
@ -396,13 +396,9 @@ template<size_t ...S> struct make_index_sequence_impl <0, S...> { typedef index_
|
||||
template<size_t N> using make_index_sequence = typename make_index_sequence_impl<N>::type;
|
||||
#endif
|
||||
|
||||
#if defined(PYBIND11_CPP17) || defined(_MSC_VER)
|
||||
using std::bool_constant;
|
||||
using std::negation;
|
||||
#else
|
||||
/// Backports of std::bool_constant and std::negation to accomodate older compilers
|
||||
template <bool B> using bool_constant = std::integral_constant<bool, B>;
|
||||
template <class T> using negation = bool_constant<!T::value>;
|
||||
#endif
|
||||
template <typename T> struct negation : bool_constant<!T::value> { };
|
||||
|
||||
/// Compile-time all/any/none of that check the boolean value of all template types
|
||||
#ifdef PYBIND11_CPP17
|
||||
|
Loading…
Reference in New Issue
Block a user