is_contiguously_hashable.hpp 928 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef BOOST_HASH2_IS_CONTIGUOUSLY_HASHABLE_HPP_INCLUDED
  2. #define BOOST_HASH2_IS_CONTIGUOUSLY_HASHABLE_HPP_INCLUDED
  3. // Copyright 2017, 2023, 2024 Peter Dimov.
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // https://www.boost.org/LICENSE_1_0.txt
  6. #include <boost/hash2/is_trivially_equality_comparable.hpp>
  7. #include <boost/hash2/is_endian_independent.hpp>
  8. #include <boost/hash2/endian.hpp>
  9. #include <type_traits>
  10. #include <cstddef>
  11. namespace boost
  12. {
  13. namespace hash2
  14. {
  15. template<class T, endian E> struct is_contiguously_hashable:
  16. std::integral_constant<bool, is_trivially_equality_comparable<T>::value && (E == endian::native || is_endian_independent<T>::value)>
  17. {
  18. };
  19. template<class T, std::size_t N, endian E> struct is_contiguously_hashable<T[N], E>:
  20. is_contiguously_hashable<T, E>
  21. {
  22. };
  23. } // namespace hash2
  24. } // namespace boost
  25. #endif // #ifndef BOOST_HASH2_IS_CONTIGUOUSLY_HASHABLE_HPP_INCLUDED