diff --git a/include/boost/fusion/support/config.hpp b/include/boost/fusion/support/config.hpp index d27266ed..8fe8a40d 100644 --- a/include/boost/fusion/support/config.hpp +++ b/include/boost/fusion/support/config.hpp @@ -116,4 +116,11 @@ namespace std # define BOOST_FUSION_NOEXCEPT_ON_DEFAULTED BOOST_NOEXCEPT #endif + +#ifdef __has_extension +# define BOOST_FUSION_HAS_EXTENSION __has_extension +#else +# define BOOST_FUSION_HAS_EXTENSION(_) 0 +#endif + #endif diff --git a/include/boost/fusion/support/detail/is_trivially_copyable.hpp b/include/boost/fusion/support/detail/is_trivially_copyable.hpp index 5628cc45..51863e93 100644 --- a/include/boost/fusion/support/detail/is_trivially_copyable.hpp +++ b/include/boost/fusion/support/detail/is_trivially_copyable.hpp @@ -17,7 +17,16 @@ # define BOOST_FUSION_DETAIL_VOLATILE_SCALAR_IS_NON_TRIVIALLY_COPYABLE #endif -#ifndef BOOST_NO_CXX11_HDR_TYPE_TRAITS +#if BOOST_FUSION_HAS_EXTENSION(is_trivially_copyable) || \ + (50000 <= BOOST_GCC) || (1700 <= BOOST_MSVC) +# define BOOST_FUSION_IS_TRIVIALLY_COPYABLE __is_trivially_copyable +#endif + +#if defined(BOOST_FUSION_IS_TRIVIALLY_COPYABLE) +# define BOOST_FUSION_DETAIL_IS_TRIVIALLY_COPYABLE_CONFORMING 2 +# include +#elif !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) +# define BOOST_FUSION_DETAIL_IS_TRIVIALLY_COPYABLE_CONFORMING 2 # include #else # include @@ -43,20 +52,18 @@ #endif #endif // -#ifndef BOOST_NO_CXX11_HDR_TYPE_TRAITS -# define BOOST_FUSION_DETAIL_IS_TRIVIALLY_COPYABLE_CONFORMING 2 -#elif defined(BOOST_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) && \ - defined(BOOST_IS_UNION) && defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION) && \ - defined(BOOST_HAS_TRIVIAL_ASSIGN) && defined(BOOST_HAS_TRIVIAL_COPY) && \ - defined(BOOST_HAS_TRIVIAL_MOVE_ASSIGN) && defined(BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR) && \ - defined(BOOST_HAS_TRIVIAL_DESTRUCTOR) && defined(BOOST_TT_IS_CONSTRUCTIBLE_CONFORMING) -# define BOOST_FUSION_DETAIL_IS_TRIVIALLY_COPYABLE_CONFORMING 1 -#endif - namespace boost { namespace fusion { namespace detail { -#ifdef BOOST_NO_CXX11_HDR_TYPE_TRAITS +#ifndef BOOST_FUSION_DETAIL_IS_TRIVIALLY_COPYABLE_CONFORMING +#if defined(BOOST_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) && \ + defined(BOOST_IS_UNION) && defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION) && \ + defined(BOOST_HAS_TRIVIAL_ASSIGN) && defined(BOOST_HAS_TRIVIAL_COPY) && \ + defined(BOOST_HAS_TRIVIAL_MOVE_ASSIGN) && defined(BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR) && \ + defined(BOOST_HAS_TRIVIAL_DESTRUCTOR) && defined(BOOST_TT_IS_CONSTRUCTIBLE_CONFORMING) +# define BOOST_FUSION_DETAIL_IS_TRIVIALLY_COPYABLE_CONFORMING 1 +#endif + template struct is_trivially_copyable_class : mpl::bool_< @@ -86,7 +93,9 @@ struct is_trivially_copyable_impl template struct is_trivially_copyable -#ifndef BOOST_NO_CXX11_HDR_TYPE_TRAITS +#if defined(BOOST_FUSION_IS_TRIVIALLY_COPYABLE) + : mpl::bool_ +#elif !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) : std::is_trivially_copyable #else : is_trivially_copyable_impl::type>