2 // Copyright 2008-2009 Daniel James.
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #include "../helpers/prefix.hpp"
8 #include <boost/unordered/unordered_set_fwd.hpp>
9 #include "../helpers/postfix.hpp"
21 false_type
is_unordered_set_impl(void*);
23 template <class Value
, class Hash
, class Pred
, class Alloc
>
24 true_type
is_unordered_set_impl(
25 boost::unordered_set
<Value
, Hash
, Pred
, Alloc
>*);
28 void call_swap(boost::unordered_set
<T
>& x
, boost::unordered_set
<T
>& y
)
34 bool call_equals(boost::unordered_set
<T
>& x
, boost::unordered_set
<T
>& y
)
40 bool call_not_equals(boost::unordered_set
<T
>& x
, boost::unordered_set
<T
>& y
)
46 void call_swap(boost::unordered_multiset
<T
>& x
, boost::unordered_multiset
<T
>& y
)
53 boost::unordered_multiset
<T
>& x
, boost::unordered_multiset
<T
>& y
)
60 boost::unordered_multiset
<T
>& x
, boost::unordered_multiset
<T
>& y
)
65 #include "../helpers/test.hpp"
67 typedef boost::unordered_set
<int> int_set
;
68 typedef boost::unordered_multiset
<int> int_multiset
;
70 UNORDERED_AUTO_TEST (use_fwd_declared_trait_without_definition
) {
71 BOOST_TEST(sizeof(is_unordered_set_impl((int_set
*)0)) == sizeof(true_type
));
74 #include <boost/unordered_set.hpp>
76 UNORDERED_AUTO_TEST (use_fwd_declared_trait
) {
77 boost::unordered_set
<int> x
;
78 BOOST_TEST(sizeof(is_unordered_set_impl(&x
)) == sizeof(true_type
));
80 BOOST_TEST(sizeof(is_unordered_set_impl((int*)0)) == sizeof(false_type
));
83 UNORDERED_AUTO_TEST (use_set_fwd_declared_function
) {
89 BOOST_TEST(y
.find(1) != y
.end());
90 BOOST_TEST(y
.find(2) == y
.end());
92 BOOST_TEST(x
.find(1) == x
.end());
93 BOOST_TEST(x
.find(2) != x
.end());
95 BOOST_TEST(!call_equals(x
, y
));
96 BOOST_TEST(call_not_equals(x
, y
));
99 UNORDERED_AUTO_TEST (use_multiset_fwd_declared_function
) {
102 BOOST_TEST(call_equals(x
, y
));
103 BOOST_TEST(!call_not_equals(x
, y
));