is_range.hpp 986 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2017 Peter Dimov.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // https://www.boost.org/LICENSE_1_0.txt
  4. #ifndef BOOST_HASH_IS_RANGE_HPP_INCLUDED
  5. #define BOOST_HASH_IS_RANGE_HPP_INCLUDED
  6. #include <iterator>
  7. #include <type_traits>
  8. namespace boost
  9. {
  10. namespace hash_detail
  11. {
  12. template<class T, class It>
  13. std::integral_constant< bool, !std::is_same<typename std::remove_cv<T>::type, typename std::iterator_traits<It>::value_type>::value >
  14. is_range_check( It first, It last );
  15. template<class T> decltype( is_range_check<T>( std::declval<T const&>().begin(), std::declval<T const&>().end() ) ) is_range_( int );
  16. template<class T> std::false_type is_range_( ... );
  17. } // namespace hash_detail
  18. namespace container_hash
  19. {
  20. template<class T> struct is_range: decltype( hash_detail::is_range_<T>( 0 ) )
  21. {
  22. };
  23. } // namespace container_hash
  24. } // namespace boost
  25. #endif // #ifndef BOOST_HASH_IS_RANGE_HPP_INCLUDED