diff options
Diffstat (limited to 'boost/type_traits/has_trivial_move_constructor.hpp')
-rw-r--r-- | boost/type_traits/has_trivial_move_constructor.hpp | 70 |
1 files changed, 45 insertions, 25 deletions
diff --git a/boost/type_traits/has_trivial_move_constructor.hpp b/boost/type_traits/has_trivial_move_constructor.hpp index a3418340b4..9e601f38ae 100644 --- a/boost/type_traits/has_trivial_move_constructor.hpp +++ b/boost/type_traits/has_trivial_move_constructor.hpp @@ -11,47 +11,67 @@ #ifndef BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED -#include <boost/type_traits/config.hpp> #include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/integral_constant.hpp> + +#ifdef BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR + +#if defined(BOOST_MSVC) || defined(BOOST_INTEL) #include <boost/type_traits/is_pod.hpp> #include <boost/type_traits/is_volatile.hpp> -#include <boost/type_traits/detail/ice_and.hpp> -#include <boost/type_traits/detail/ice_not.hpp> +#endif + +#if defined(__GNUC__) || defined(__clang) +#include <boost/type_traits/is_constructible.hpp> +#include <boost/type_traits/is_volatile.hpp> +#endif -// should be the last #include -#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -namespace detail { +template <typename T> struct has_trivial_move_constructor : public integral_constant<bool, BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T)>{}; -template <typename T> -struct has_trivial_move_ctor_impl -{ -#ifdef BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR - BOOST_STATIC_CONSTANT(bool, value = (BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T))); #else - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::is_pod<T>::value, - ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value - >::value)); + +#ifdef __SUNPRO_CC +#include <boost/type_traits/is_constructible.hpp> +#include <boost/type_traits/remove_const.hpp> +#if __cplusplus >= 201103 +#define SOLARIS_EXTRA_CHECK && is_constructible<typename remove_const<T>::type, typename remove_const<T>::type&&>::value +#endif #endif -}; -} // namespace detail +#ifndef SOLARIS_EXTRA_CHECK +#define SOLARIS_EXTRA_CHECK +#endif -BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_move_constructor,T,::boost::detail::has_trivial_move_ctor_impl<T>::value) +#include <boost/type_traits/is_pod.hpp> +#include <boost/type_traits/is_volatile.hpp> + +namespace boost { + +template <typename T> struct has_trivial_move_constructor + : public integral_constant<bool, ::boost::is_pod<T>::value && !::boost::is_volatile<T>::value SOLARIS_EXTRA_CHECK>{}; -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void,false) +#undef SOLARIS_EXTRA_CHECK + +#endif + +template <> struct has_trivial_move_constructor<void> : public false_type{}; #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void const volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_move_constructor,void volatile,false) +template <> struct has_trivial_move_constructor<void const> : public false_type{}; +template <> struct has_trivial_move_constructor<void volatile> : public false_type{}; +template <> struct has_trivial_move_constructor<void const volatile> : public false_type{}; #endif +// What should we do with reference types??? The standard seems to suggest these are trivial, even if the thing they reference is not: +template <class T> struct has_trivial_move_constructor<T&> : public true_type{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template <class T> struct has_trivial_move_constructor<T&&> : public true_type{}; +#endif +// Arrays can not be explicitly copied: +template <class T, std::size_t N> struct has_trivial_move_constructor<T[N]> : public false_type{}; +template <class T> struct has_trivial_move_constructor<T[]> : public false_type{}; } // namespace boost -#include <boost/type_traits/detail/bool_trait_undef.hpp> - #endif // BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED |