Add is_range_test3

This commit is contained in:
Peter Dimov
2022-09-18 14:04:05 +03:00
parent 60be3b131e
commit 20c03417b0
2 changed files with 43 additions and 0 deletions

View File

@@ -97,3 +97,5 @@ run hash_unordered_multimap_test.cpp ;
run hash_unordered_set_test.cpp ;
run hash_unordered_map_test.cpp ;
run is_range_test3.cpp ;

41
test/is_range_test3.cpp Normal file
View File

@@ -0,0 +1,41 @@
// 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>
struct X1
{
char const* begin() const;
char const* end() const;
};
struct X2
{
char const* begin() const;
char const* end() const;
};
namespace boost
{
namespace container_hash
{
template<class T> struct is_range;
template<> struct is_range<X2>: boost::false_type {};
} // namespace container_hash
} // namespace boost
#include <boost/container_hash/is_range.hpp>
#include <boost/core/lightweight_test_trait.hpp>
int main()
{
using boost::container_hash::is_range;
BOOST_TEST_TRAIT_TRUE((is_range<X1>));
BOOST_TEST_TRAIT_FALSE((is_range<X2>));
return boost::report_errors();
}