1 // (C) Copyright John Maddock 2008.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 // These are the headers included by the Boost.TR1 implementation,
7 // by including these directly we probe for problems with cyclic
8 // dependencies when the TR1 headers are in the include search path.
10 #ifdef TEST_STD_HEADERS
11 #include <unordered_set>
13 #include <boost/tr1/unordered_set.hpp>
16 #include "unordered_concepts.hpp"
17 #include "boost/concept_archetype.hpp"
22 typedef boost::copy_constructible_archetype
<boost::assignable_archetype
<> > value_type
;
23 typedef boost::default_constructible_unary_function_archetype
<value_type
, std::size_t> func_type
;
24 typedef boost::default_constructible_binary_predicate_archetype
<value_type
, value_type
> pred_type
;
25 typedef std::tr1::unordered_set
<value_type
, func_type
, pred_type
> hash_set_type
;
26 typedef std::tr1::unordered_multiset
<value_type
, func_type
, pred_type
> hash_multiset_type
;
28 boost::function_requires
<boost::UniqueUnorderedContainer
<hash_set_type
> >();
29 boost::function_requires
<boost::MultiUnorderedContainer
<hash_multiset_type
> >();
32 // unordered_set specific functions:
33 typedef hash_set_type::key_type key_type
;
34 typedef hash_set_type::hasher hasher
;
35 typedef hash_set_type::key_equal key_equal
;
36 typedef hash_set_type::local_iterator local_iterator
;
37 typedef hash_set_type::const_local_iterator const_local_iterator
;
38 typedef hash_set_type::value_type value_type
;
39 typedef hash_set_type::iterator iterator
;
40 typedef hash_set_type::const_iterator const_iterator
;
41 typedef hash_set_type::size_type size_type
;
42 typedef hash_set_type::allocator_type allocator_type
;
43 typedef boost::input_iterator_archetype
<value_type
> input_iterator
;
44 input_iterator i
= boost::static_object
<input_iterator
>::get();
48 const hasher
& hf
= boost::static_object
<hasher
>::get();
49 const key_equal
& eq
= boost::static_object
<key_equal
>::get();
50 //value_type const& t = boost::static_object<value_type>::get();
51 //key_type const& k = boost::static_object<key_type>::get();
52 allocator_type
const& a
= boost::static_object
<allocator_type
>::get();
54 hash_set_type
x1(n
, hf
, eq
, a
);
55 hash_set_type
x2(i
, j
, n
, hf
, eq
, a
);
57 std::tr1::swap(x1
, x2
);
60 // unordered_set specific functions:
61 typedef hash_multiset_type::key_type key_type
;
62 typedef hash_multiset_type::hasher hasher
;
63 typedef hash_multiset_type::key_equal key_equal
;
64 typedef hash_multiset_type::local_iterator local_iterator
;
65 typedef hash_multiset_type::const_local_iterator const_local_iterator
;
66 typedef hash_multiset_type::value_type value_type
;
67 typedef hash_multiset_type::iterator iterator
;
68 typedef hash_multiset_type::const_iterator const_iterator
;
69 typedef hash_multiset_type::size_type size_type
;
70 typedef hash_multiset_type::allocator_type allocator_type
;
71 typedef boost::input_iterator_archetype
<value_type
> input_iterator
;
72 input_iterator i
= boost::static_object
<input_iterator
>::get();
76 const hasher
& hf
= boost::static_object
<hasher
>::get();
77 const key_equal
& eq
= boost::static_object
<key_equal
>::get();
78 //value_type const& t = boost::static_object<value_type>::get();
79 //key_type const& k = boost::static_object<key_type>::get();
80 allocator_type
const& a
= boost::static_object
<allocator_type
>::get();
82 hash_multiset_type
x1(n
, hf
, eq
, a
);
83 hash_multiset_type
x2(i
, j
, n
, hf
, eq
, a
);
85 std::tr1::swap(x1
, x2
);