forked from boostorg/type_traits
Fix use of is_constructible - to limits to cases where it's really needed.
And to not use it when the compiler would choke.
This commit is contained in:
@ -24,17 +24,34 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG)
|
||||
#include <boost/type_traits/is_default_constructible.hpp>
|
||||
#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_default_constructible<T>::value
|
||||
#else
|
||||
//
|
||||
// Mot all compilers, particularly older GCC versions can handle the fix above.
|
||||
#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <typename T> struct has_trivial_constructor
|
||||
#ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR
|
||||
: public integral_constant <bool, ((::boost::is_pod<T>::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)) && is_default_constructible<T>::value)>{};
|
||||
: public integral_constant <bool, ((::boost::is_pod<T>::value || BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)) BOOST_TT_TRIVIAL_CONSTRUCT_FIX)>{};
|
||||
#else
|
||||
: public integral_constant <bool, ::boost::is_pod<T>::value>{};
|
||||
#endif
|
||||
|
||||
template <> struct has_trivial_constructor<void> : public boost::false_type{};
|
||||
template <> struct has_trivial_constructor<void const> : public boost::false_type{};
|
||||
template <> struct has_trivial_constructor<void const volatile> : public boost::false_type{};
|
||||
template <> struct has_trivial_constructor<void volatile> : public boost::false_type{};
|
||||
|
||||
template <class T> struct has_trivial_default_constructor : public has_trivial_constructor<T> {};
|
||||
|
||||
#undef BOOST_TT_TRIVIAL_CONSTRUCT_FIX
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED
|
||||
|
Reference in New Issue
Block a user