mirror of
https://github.com/boostorg/container_hash.git
synced 2025-08-04 23:14:33 +02:00
Add is_unordered_range_test2
This commit is contained in:
@@ -100,3 +100,4 @@ run hash_unordered_map_test.cpp ;
|
|||||||
|
|
||||||
run is_range_test3.cpp ;
|
run is_range_test3.cpp ;
|
||||||
run is_contiguous_range_test2.cpp ;
|
run is_contiguous_range_test2.cpp ;
|
||||||
|
run is_unordered_range_test2.cpp ;
|
||||||
|
60
test/is_unordered_range_test2.cpp
Normal file
60
test/is_unordered_range_test2.cpp
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
// Copyright 2022 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/type_traits/integral_constant.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
struct X1
|
||||||
|
{
|
||||||
|
char const* begin() const;
|
||||||
|
char const* end() const;
|
||||||
|
typedef void hasher;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct X2
|
||||||
|
{
|
||||||
|
char const* begin() const;
|
||||||
|
char const* end() const;
|
||||||
|
typedef void hasher;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct X3
|
||||||
|
{
|
||||||
|
char const* begin() const;
|
||||||
|
char const* end() const;
|
||||||
|
typedef void hasher;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace container_hash
|
||||||
|
{
|
||||||
|
|
||||||
|
template<class T> struct is_unordered_range;
|
||||||
|
template<> struct is_unordered_range<X2>: boost::false_type {};
|
||||||
|
|
||||||
|
template<class T> struct is_range;
|
||||||
|
template<> struct is_range<X3>: boost::false_type {};
|
||||||
|
|
||||||
|
} // namespace container_hash
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#include <boost/container_hash/is_unordered_range.hpp>
|
||||||
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
using boost::container_hash::is_unordered_range;
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC, < 40700)
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((is_unordered_range<X1>));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_FALSE((is_unordered_range<X2>));
|
||||||
|
BOOST_TEST_TRAIT_FALSE((is_unordered_range<X3>));
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
Reference in New Issue
Block a user