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/is_integral.hpp>
|
||||||
#include <boost/type_traits/declval.hpp>
|
#include <boost/type_traits/declval.hpp>
|
||||||
#include <boost/type_traits/is_same.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.hpp>
|
||||||
#include <boost/config/workaround.hpp>
|
#include <boost/config/workaround.hpp>
|
||||||
#include <iterator>
|
#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)
|
#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> false_type is_range_( ... );
|
||||||
|
|
||||||
template<class T> struct is_range: decltype( is_range_<T>( 0 ) )
|
template<class T> struct is_range: decltype( is_range_<T>( 0 ) )
|
||||||
|
@@ -71,4 +71,4 @@ run hash_number_test2.cpp ;
|
|||||||
run hash_integral_test.cpp ;
|
run hash_integral_test.cpp ;
|
||||||
run hash_string_test2.cpp ;
|
run hash_string_test2.cpp ;
|
||||||
|
|
||||||
run hash_fs_path_test.cpp ;
|
run hash_fs_path_test.cpp /boost//filesystem/<warnings>off ;
|
||||||
|
@@ -2,6 +2,14 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// https://www.boost.org/LICENSE_1_0.txt
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
# pragma warning(disable: 4714) // forceinline not inlined
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic ignored "-Wsign-conversion"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
#include <boost/container_hash/hash.hpp>
|
#include <boost/container_hash/hash.hpp>
|
||||||
#include <boost/core/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
Reference in New Issue
Block a user