has_trivial_move_assign.hpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
  2. // (C) Copyright Eric Friedman 2002-2003.
  3. // (C) Copyright Antony Polukhin 2013.
  4. // Use, modification and distribution are subject to the Boost Software License,
  5. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt).
  7. //
  8. // See http://www.boost.org/libs/type_traits for most recent version including documentation.
  9. #ifndef BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED
  10. #define BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED
  11. #include <cstddef> // size_t
  12. #include <boost/type_traits/intrinsics.hpp>
  13. #include <boost/type_traits/integral_constant.hpp>
  14. #if !defined(BOOST_HAS_TRIVIAL_MOVE_ASSIGN) || defined(BOOST_MSVC) || defined(BOOST_INTEL)
  15. #include <boost/type_traits/is_pod.hpp>
  16. #include <boost/type_traits/is_const.hpp>
  17. #include <boost/type_traits/is_volatile.hpp>
  18. #ifdef BOOST_MSVC
  19. #include <boost/type_traits/is_reference.hpp>
  20. #endif
  21. #endif
  22. #if defined(__GNUC__) || defined(__clang__)
  23. #include <boost/type_traits/is_assignable.hpp>
  24. #include <boost/type_traits/is_volatile.hpp>
  25. #endif
  26. #ifdef __SUNPRO_CC
  27. #include <boost/type_traits/is_assignable.hpp>
  28. #include <boost/type_traits/remove_const.hpp>
  29. #if __cplusplus >= 201103
  30. #define SOLARIS_EXTRA_CHECK && is_assignable<typename remove_const<T>::type&, typename remove_const<T>::type&&>::value
  31. #endif
  32. #endif
  33. #ifndef SOLARIS_EXTRA_CHECK
  34. #define SOLARIS_EXTRA_CHECK
  35. #endif
  36. namespace boost{
  37. template <typename T>
  38. struct has_trivial_move_assign : public integral_constant<bool,
  39. #ifdef BOOST_HAS_TRIVIAL_MOVE_ASSIGN
  40. BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T)
  41. #else
  42. ::boost::is_pod<T>::value && !::boost::is_const<T>::value && !::boost::is_volatile<T>::value SOLARIS_EXTRA_CHECK
  43. #endif
  44. > {};
  45. template <> struct has_trivial_move_assign<void> : public false_type{};
  46. #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
  47. template <> struct has_trivial_move_assign<void const> : public false_type{};
  48. template <> struct has_trivial_move_assign<void const volatile> : public false_type{};
  49. template <> struct has_trivial_move_assign<void volatile> : public false_type{};
  50. #endif
  51. template <class T> struct has_trivial_move_assign<T&> : public false_type{};
  52. #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
  53. template <class T> struct has_trivial_move_assign<T&&> : public false_type{};
  54. #endif
  55. // Array types are not assignable:
  56. template <class T, std::size_t N> struct has_trivial_move_assign<T[N]> : public false_type{};
  57. template <class T> struct has_trivial_move_assign<T[]> : public false_type{};
  58. } // namespace boost
  59. #undef SOLARIS_EXTRA_CHECK
  60. #endif // BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED