forked from boostorg/container_hash
Reject ranges that have themselves as their value_type (e.g. filesystem::path)
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/declval.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/enable_if.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <iterator>
|
||||
@@ -20,9 +22,11 @@ namespace hash_detail
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC, < 40700)
|
||||
|
||||
template<class It> true_type is_range_check( It first, It last, typename std::iterator_traits<It>::difference_type* = 0 );
|
||||
template<class T, class It> true_type is_range_check( It first, It last,
|
||||
typename std::iterator_traits<It>::difference_type* = 0,
|
||||
typename enable_if_< !is_same<typename remove_cv<T>::type, typename std::iterator_traits<It>::value_type>::value >::type* = 0 );
|
||||
|
||||
template<class T> decltype( is_range_check( declval<T const&>().begin(), declval<T const&>().end() ) ) is_range_( int );
|
||||
template<class T> decltype( is_range_check<T>( declval<T const&>().begin(), declval<T const&>().end() ) ) is_range_( int );
|
||||
template<class T> false_type is_range_( ... );
|
||||
|
||||
template<class T> struct is_range: decltype( is_range_<T>( 0 ) )
|
||||
|
||||
Reference in New Issue
Block a user