]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/tr1/test/test_unordered_set.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / tr1 / test / test_unordered_set.cpp
CommitLineData
7c673cae
FG
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)
5
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.
9
10#ifdef TEST_STD_HEADERS
11#include <unordered_set>
12#else
13#include <boost/tr1/unordered_set.hpp>
14#endif
15
16#include "unordered_concepts.hpp"
17#include "boost/concept_archetype.hpp"
18
19
20int main()
21{
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;
27
28 boost::function_requires<boost::UniqueUnorderedContainer<hash_set_type> >();
29 boost::function_requires<boost::MultiUnorderedContainer<hash_multiset_type> >();
30
31 do{
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();
45 input_iterator j = i;
46
47 size_type n = 1;
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();
53
54 hash_set_type x1(n, hf, eq, a);
55 hash_set_type x2(i, j, n, hf, eq, a);
56 swap(x1, x2);
57 std::tr1::swap(x1, x2);
58 }while(0);
59 do{
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();
73 input_iterator j = i;
74
75 size_type n = 1;
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();
81
82 hash_multiset_type x1(n, hf, eq, a);
83 hash_multiset_type x2(i, j, n, hf, eq, a);
84 swap(x1, x2);
85 std::tr1::swap(x1, x2);
86 }while(0);
87}
88
89
90
91