is_trivially_copyable.hpp 918 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef BOOST_ENDIAN_DETAIL_IS_TRIVIALLY_COPYABLE_HPP_INCLUDED
  2. #define BOOST_ENDIAN_DETAIL_IS_TRIVIALLY_COPYABLE_HPP_INCLUDED
  3. // Copyright 2019 Peter Dimov
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. #include <boost/config.hpp>
  8. #include <boost/type_traits/has_trivial_copy.hpp>
  9. #include <boost/type_traits/has_trivial_assign.hpp>
  10. #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
  11. # include <type_traits>
  12. #endif
  13. namespace boost
  14. {
  15. namespace endian
  16. {
  17. namespace detail
  18. {
  19. #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
  20. using std::is_trivially_copyable;
  21. #else
  22. template<class T> struct is_trivially_copyable: boost::integral_constant<bool,
  23. boost::has_trivial_copy<T>::value && boost::has_trivial_assign<T>::value> {};
  24. #endif
  25. } // namespace detail
  26. } // namespace endian
  27. } // namespace boost
  28. #endif // BOOST_ENDIAN_DETAIL_IS_TRIVIALLY_COPYABLE_HPP_INCLUDED