Use custom definitions for negation and bool_constant (#737)

Instead of relying on sometimes missing C++17 definitions
This commit is contained in:
Jean-Michaël Celerier 2017-03-17 14:51:41 +01:00 committed by Dean Moldovan
parent cabbf610a7
commit 68e089a8bf

View File

@ -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