mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 07:02:11 +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;
|
template<size_t N> using make_index_sequence = typename make_index_sequence_impl<N>::type;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PYBIND11_CPP17) || defined(_MSC_VER)
|
/// Backports of std::bool_constant and std::negation to accomodate older compilers
|
||||||
using std::bool_constant;
|
|
||||||
using std::negation;
|
|
||||||
#else
|
|
||||||
template <bool B> using bool_constant = std::integral_constant<bool, B>;
|
template <bool B> using bool_constant = std::integral_constant<bool, B>;
|
||||||
template <class T> using negation = bool_constant<!T::value>;
|
template <typename T> struct negation : bool_constant<!T::value> { };
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Compile-time all/any/none of that check the boolean value of all template types
|
/// Compile-time all/any/none of that check the boolean value of all template types
|
||||||
#ifdef PYBIND11_CPP17
|
#ifdef PYBIND11_CPP17
|
||||||
|
Loading…
Reference in New Issue
Block a user