From ed235989eff1bd1577c041058c0a16bb3c54615e Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 18 Sep 2022 14:32:28 +0300 Subject: [PATCH] Add is_unordered_range_test2 --- test/Jamfile.v2 | 1 + test/is_unordered_range_test2.cpp | 60 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 test/is_unordered_range_test2.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 3420c39..6908fef 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -100,3 +100,4 @@ run hash_unordered_map_test.cpp ; run is_range_test3.cpp ; run is_contiguous_range_test2.cpp ; +run is_unordered_range_test2.cpp ; diff --git a/test/is_unordered_range_test2.cpp b/test/is_unordered_range_test2.cpp new file mode 100644 index 0000000..ed943f0 --- /dev/null +++ b/test/is_unordered_range_test2.cpp @@ -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 +#include + +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 struct is_unordered_range; +template<> struct is_unordered_range: boost::false_type {}; + +template struct is_range; +template<> struct is_range: boost::false_type {}; + +} // namespace container_hash +} // namespace boost + +#include +#include + +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)); + +#endif + + BOOST_TEST_TRAIT_FALSE((is_unordered_range)); + BOOST_TEST_TRAIT_FALSE((is_unordered_range)); + + return boost::report_errors(); +}