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
5#ifndef BOOST_HASH_IS_RANGE_HPP_INCLUDED
6#define BOOST_HASH_IS_RANGE_HPP_INCLUDED
7
8#include <iterator>
9#include <type_traits>
10
11namespace boost
12{
13
14namespace hash_detail
15{
16
17template<class T> struct iterator_traits: std::iterator_traits<T> {};
18template<> struct iterator_traits< void* > {};
19template<> struct iterator_traits< void const* > {};
20
21template<class T, class It>
22 std::integral_constant< bool, !std::is_same<typename std::remove_cv<T>::type, typename iterator_traits<It>::value_type>::value >
23 is_range_check( It first, It last );
24
25template<class T> decltype( is_range_check<T>( std::declval<T const&>().begin(), std::declval<T const&>().end() ) ) is_range_( int );
26template<class T> std::false_type is_range_( ... );
27
28} // namespace hash_detail
29
30namespace container_hash
31{
32
33template<class T> struct is_range: decltype( hash_detail::is_range_<T>( 0 ) )
34{
35};
36
37} // namespace container_hash
38
39} // namespace boost
40
41#endif // #ifndef BOOST_HASH_IS_RANGE_HPP_INCLUDED
42

source code of boost/libs/container_hash/include/boost/container_hash/is_range.hpp