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)
6
#include "../helpers/prefix.hpp"
8
#include <boost/unordered/unordered_set_fwd.hpp>
10
struct true_type { char x[100]; };
11
struct false_type { char x; };
13
false_type is_unordered_set_impl(void*);
15
template <class Value, class Hash, class Pred, class Alloc>
16
true_type is_unordered_set_impl(
17
boost::unordered_set<Value, Hash, Pred, Alloc>*);
20
void call_swap(boost::unordered_set<T>& x,
21
boost::unordered_set<T>& y)
27
bool call_equals(boost::unordered_set<T>& x,
28
boost::unordered_set<T>& y)
34
bool call_not_equals(boost::unordered_set<T>& x,
35
boost::unordered_set<T>& y)
41
void call_swap(boost::unordered_multiset<T>& x,
42
boost::unordered_multiset<T>& y)
48
bool call_equals(boost::unordered_multiset<T>& x,
49
boost::unordered_multiset<T>& y)
55
bool call_not_equals(boost::unordered_multiset<T>& x,
56
boost::unordered_multiset<T>& y)
61
#include "../helpers/test.hpp"
63
typedef boost::unordered_set<int> int_set;
64
typedef boost::unordered_multiset<int> int_multiset;
66
UNORDERED_AUTO_TEST(use_fwd_declared_trait_without_definition) {
67
BOOST_TEST(sizeof(is_unordered_set_impl((int_set*) 0))
68
== sizeof(true_type));
71
#include <boost/unordered_set.hpp>
73
UNORDERED_AUTO_TEST(use_fwd_declared_trait) {
74
boost::unordered_set<int> x;
75
BOOST_TEST(sizeof(is_unordered_set_impl(&x)) == sizeof(true_type));
77
BOOST_TEST(sizeof(is_unordered_set_impl((int*) 0)) == sizeof(false_type));
80
UNORDERED_AUTO_TEST(use_set_fwd_declared_function) {
86
BOOST_TEST(y.find(1) != y.end());
87
BOOST_TEST(y.find(2) == y.end());
89
BOOST_TEST(x.find(1) == x.end());
90
BOOST_TEST(x.find(2) != x.end());
92
BOOST_TEST(!call_equals(x, y));
93
BOOST_TEST(call_not_equals(x, y));
96
UNORDERED_AUTO_TEST(use_multiset_fwd_declared_function) {
99
BOOST_TEST(call_equals(x, y));
100
BOOST_TEST(!call_not_equals(x, y));