is_trivially_copyable.hpp 789 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef BHO_ENDIAN_DETAIL_IS_TRIVIALLY_COPYABLE_HPP_INCLUDED
  2. #define BHO_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 <asio2/bho/config.hpp>
  7. #include <type_traits>
  8. namespace bho
  9. {
  10. namespace endian
  11. {
  12. namespace detail
  13. {
  14. #if defined( BHO_LIBSTDCXX_VERSION ) && BHO_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 bho
  23. #endif // BHO_ENDIAN_DETAIL_IS_TRIVIALLY_COPYABLE_HPP_INCLUDED