is_trivially_copyable.hpp 799 B

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