mirror of
https://github.com/boostorg/container_hash.git
synced 2025-08-03 14:34:39 +02:00
Move type classification traits from namespace hash_detail to namespace container_hash
This commit is contained in:
@@ -28,11 +28,16 @@ template<class It, class T, class S>
|
||||
template<class T> decltype( is_contiguous_range_check( declval<T const&>().begin(), declval<T const&>().end(), declval<T const&>().data(), declval<T const&>().data() + declval<T const&>().size(), declval<T const&>().size() ) ) is_contiguous_range_( int );
|
||||
template<class T> false_type is_contiguous_range_( ... );
|
||||
|
||||
} // namespace hash_detail
|
||||
|
||||
namespace container_hash
|
||||
{
|
||||
|
||||
template<class T> struct is_contiguous_range: decltype( hash_detail::is_contiguous_range_<T>( 0 ) )
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace hash_detail
|
||||
} // namespace container_hash
|
||||
} // namespace boost
|
||||
|
||||
#else // !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR)
|
||||
@@ -46,7 +51,7 @@ template<class T> struct is_contiguous_range: decltype( hash_detail::is_contiguo
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
namespace container_hash
|
||||
{
|
||||
|
||||
template<class T> struct is_contiguous_range: false_type
|
||||
@@ -73,7 +78,7 @@ template<class T, std::size_t N> struct is_contiguous_range< std::array<T, N> co
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace hash_detail
|
||||
} // namespace container_hash
|
||||
} // namespace boost
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR)
|
||||
|
@@ -16,11 +16,11 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC, < 40700)
|
||||
|
||||
namespace hash_detail
|
||||
{
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC, < 40700)
|
||||
|
||||
template<class T, class It>
|
||||
integral_constant< bool, !is_same<typename remove_cv<T>::type, typename std::iterator_traits<It>::value_type>::value >
|
||||
is_range_check( It first, It last );
|
||||
@@ -28,12 +28,22 @@ template<class T, class It>
|
||||
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 ) )
|
||||
} // namespace hash_detail
|
||||
|
||||
namespace container_hash
|
||||
{
|
||||
|
||||
template<class T> struct is_range: decltype( hash_detail::is_range_<T>( 0 ) )
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace container_hash
|
||||
|
||||
#else
|
||||
|
||||
namespace hash_detail
|
||||
{
|
||||
|
||||
template<class T, class E = true_type> struct is_range_: false_type
|
||||
{
|
||||
};
|
||||
@@ -45,13 +55,19 @@ template<class T> struct is_range_< T, integral_constant< bool,
|
||||
{
|
||||
};
|
||||
|
||||
template<class T> struct is_range: is_range_<T>
|
||||
} // namespace hash_detail
|
||||
|
||||
namespace container_hash
|
||||
{
|
||||
|
||||
template<class T> struct is_range: hash_detail::is_range_<T>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace container_hash
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR)
|
||||
|
||||
} // namespace hash_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_HASH_DETAIL_IS_RANGE_HPP_INCLUDED
|
||||
|
@@ -24,11 +24,16 @@ template<class T> struct has_hasher_< T, integral_constant< bool,
|
||||
{
|
||||
};
|
||||
|
||||
template<class T> struct is_unordered_range: integral_constant< bool, is_range<T>::value && has_hasher_<T>::value >
|
||||
} // namespace hash_detail
|
||||
|
||||
namespace container_hash
|
||||
{
|
||||
|
||||
template<class T> struct is_unordered_range: integral_constant< bool, is_range<T>::value && hash_detail::has_hasher_<T>::value >
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace hash_detail
|
||||
} // namespace container_hash
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_HASH_DETAIL_IS_UNORDERED_RANGE_HPP_INCLUDED
|
||||
|
@@ -393,7 +393,7 @@ namespace boost
|
||||
// ranges (list, set, deque...)
|
||||
|
||||
template <typename T>
|
||||
typename boost::enable_if_<hash_detail::is_range<T>::value && !hash_detail::is_contiguous_range<T>::value && !hash_detail::is_unordered_range<T>::value, std::size_t>::type
|
||||
typename boost::enable_if_<container_hash::is_range<T>::value && !container_hash::is_contiguous_range<T>::value && !container_hash::is_unordered_range<T>::value, std::size_t>::type
|
||||
hash_value( T const& v )
|
||||
{
|
||||
return boost::hash_range( v.begin(), v.end() );
|
||||
@@ -402,7 +402,7 @@ namespace boost
|
||||
// contiguous ranges (string, vector, array)
|
||||
|
||||
template <typename T>
|
||||
typename boost::enable_if_<hash_detail::is_contiguous_range<T>::value, std::size_t>::type
|
||||
typename boost::enable_if_<container_hash::is_contiguous_range<T>::value, std::size_t>::type
|
||||
hash_value( T const& v )
|
||||
{
|
||||
return boost::hash_range( v.data(), v.data() + v.size() );
|
||||
@@ -411,7 +411,7 @@ namespace boost
|
||||
// unordered ranges (unordered_set, unordered_map)
|
||||
|
||||
template <typename T>
|
||||
typename boost::enable_if_<hash_detail::is_unordered_range<T>::value, std::size_t>::type
|
||||
typename boost::enable_if_<container_hash::is_unordered_range<T>::value, std::size_t>::type
|
||||
hash_value( T const& v )
|
||||
{
|
||||
return boost::hash_unordered_range( v.begin(), v.end() );
|
||||
@@ -422,7 +422,7 @@ namespace boost
|
||||
// resolve ambiguity with unconstrained stdext::hash_value in <xhash> :-/
|
||||
|
||||
template<template<class...> class L, class... T>
|
||||
typename boost::enable_if_<hash_detail::is_range<L<T...>>::value && !hash_detail::is_contiguous_range<L<T...>>::value && !hash_detail::is_unordered_range<L<T...>>::value, std::size_t>::type
|
||||
typename boost::enable_if_<container_hash::is_range<L<T...>>::value && !container_hash::is_contiguous_range<L<T...>>::value && !container_hash::is_unordered_range<L<T...>>::value, std::size_t>::type
|
||||
hash_value( L<T...> const& v )
|
||||
{
|
||||
return boost::hash_range( v.begin(), v.end() );
|
||||
@@ -431,14 +431,14 @@ namespace boost
|
||||
// contiguous ranges (string, vector, array)
|
||||
|
||||
template<template<class...> class L, class... T>
|
||||
typename boost::enable_if_<hash_detail::is_contiguous_range<L<T...>>::value, std::size_t>::type
|
||||
typename boost::enable_if_<container_hash::is_contiguous_range<L<T...>>::value, std::size_t>::type
|
||||
hash_value( L<T...> const& v )
|
||||
{
|
||||
return boost::hash_range( v.data(), v.data() + v.size() );
|
||||
}
|
||||
|
||||
template<template<class, std::size_t> class L, class T, std::size_t N>
|
||||
typename boost::enable_if_<hash_detail::is_contiguous_range<L<T, N>>::value, std::size_t>::type
|
||||
typename boost::enable_if_<container_hash::is_contiguous_range<L<T, N>>::value, std::size_t>::type
|
||||
hash_value( L<T, N> const& v )
|
||||
{
|
||||
return boost::hash_range( v.data(), v.data() + v.size() );
|
||||
@@ -447,7 +447,7 @@ namespace boost
|
||||
// unordered ranges (unordered_set, unordered_map)
|
||||
|
||||
template<template<class...> class L, class... T>
|
||||
typename boost::enable_if_<hash_detail::is_unordered_range<L<T...>>::value, std::size_t>::type
|
||||
typename boost::enable_if_<container_hash::is_unordered_range<L<T...>>::value, std::size_t>::type
|
||||
hash_value( L<T...> const& v )
|
||||
{
|
||||
return boost::hash_unordered_range( v.begin(), v.end() );
|
||||
|
@@ -30,7 +30,7 @@ struct X
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::hash_detail::is_contiguous_range;
|
||||
using boost::container_hash::is_contiguous_range;
|
||||
|
||||
BOOST_TEST_TRAIT_FALSE((is_contiguous_range<void>));
|
||||
BOOST_TEST_TRAIT_FALSE((is_contiguous_range<void const>));
|
||||
|
@@ -30,7 +30,7 @@ struct X
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::hash_detail::is_range;
|
||||
using boost::container_hash::is_range;
|
||||
|
||||
BOOST_TEST_TRAIT_FALSE((is_range<void>));
|
||||
BOOST_TEST_TRAIT_FALSE((is_range<void const>));
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::hash_detail::is_range;
|
||||
using boost::container_hash::is_range;
|
||||
|
||||
BOOST_TEST_TRAIT_FALSE((is_range< boost::filesystem::path >));
|
||||
BOOST_TEST_TRAIT_FALSE((is_range< boost::filesystem::path const >));
|
||||
|
@@ -30,7 +30,7 @@ struct X
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::hash_detail::is_unordered_range;
|
||||
using boost::container_hash::is_unordered_range;
|
||||
|
||||
BOOST_TEST_TRAIT_FALSE((is_unordered_range<void>));
|
||||
BOOST_TEST_TRAIT_FALSE((is_unordered_range<void const>));
|
||||
|
Reference in New Issue
Block a user