]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/unordered/test/unordered/compile_tests.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / unordered / test / unordered / compile_tests.hpp
1
2 // Copyright 2005-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)
5
6 #if defined(BOOST_MSVC)
7 #pragma warning(push)
8 #pragma warning(disable:4100) // unreferenced formal parameter
9 #pragma warning(disable:4610) // class can never be instantiated
10 #pragma warning(disable:4510) // default constructor could not be generated
11 #endif
12
13 #include <boost/concept_check.hpp>
14
15 #if defined(BOOST_MSVC)
16 #pragma warning(pop)
17 #endif
18
19 #include <boost/static_assert.hpp>
20 #include <boost/type_traits/is_same.hpp>
21 #include <boost/type_traits/is_convertible.hpp>
22 #include <boost/iterator/iterator_traits.hpp>
23 #include <boost/limits.hpp>
24 #include <boost/utility/swap.hpp>
25 #include "../helpers/check_return_type.hpp"
26
27 typedef long double comparison_type;
28
29 template <class T> void sink(T const&) {}
30 template <class T> T rvalue(T const& v) { return v; }
31 template <class T> T rvalue_default() { return T(); }
32
33 template <class X, class T>
34 void container_test(X& r, T const&)
35 {
36 typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
37 typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
38 typedef BOOST_DEDUCED_TYPENAME X::difference_type difference_type;
39 typedef BOOST_DEDUCED_TYPENAME X::size_type size_type;
40
41 typedef BOOST_DEDUCED_TYPENAME
42 boost::iterator_value<iterator>::type iterator_value_type;
43 typedef BOOST_DEDUCED_TYPENAME
44 boost::iterator_value<const_iterator>::type const_iterator_value_type;
45 typedef BOOST_DEDUCED_TYPENAME
46 boost::iterator_difference<iterator>::type iterator_difference_type;
47 typedef BOOST_DEDUCED_TYPENAME
48 boost::iterator_difference<const_iterator>::type
49 const_iterator_difference_type;
50
51 typedef BOOST_DEDUCED_TYPENAME X::value_type value_type;
52 typedef BOOST_DEDUCED_TYPENAME X::reference reference;
53 typedef BOOST_DEDUCED_TYPENAME X::const_reference const_reference;
54
55 // value_type
56
57 BOOST_STATIC_ASSERT((boost::is_same<T, value_type>::value));
58 boost::function_requires<boost::CopyConstructibleConcept<X> >();
59
60 // reference_type / const_reference_type
61
62 BOOST_STATIC_ASSERT((boost::is_same<T&, reference>::value));
63 BOOST_STATIC_ASSERT((boost::is_same<T const&, const_reference>::value));
64
65 // iterator
66
67 boost::function_requires<boost::InputIteratorConcept<iterator> >();
68 BOOST_STATIC_ASSERT((boost::is_same<T, iterator_value_type>::value));
69 BOOST_STATIC_ASSERT((boost::is_convertible<iterator, const_iterator>::value));
70
71 // const_iterator
72
73 boost::function_requires<boost::InputIteratorConcept<const_iterator> >();
74 BOOST_STATIC_ASSERT((boost::is_same<T, const_iterator_value_type>::value));
75
76 // difference_type
77
78 BOOST_STATIC_ASSERT(std::numeric_limits<difference_type>::is_signed);
79 BOOST_STATIC_ASSERT(std::numeric_limits<difference_type>::is_integer);
80 BOOST_STATIC_ASSERT((boost::is_same<difference_type,
81 iterator_difference_type>::value));
82 BOOST_STATIC_ASSERT((boost::is_same<difference_type,
83 const_iterator_difference_type>::value));
84
85 // size_type
86
87 BOOST_STATIC_ASSERT(!std::numeric_limits<size_type>::is_signed);
88 BOOST_STATIC_ASSERT(std::numeric_limits<size_type>::is_integer);
89
90 // size_type can represent any non-negative value type of difference_type
91 // I'm not sure about either of these tests...
92 size_type max_diff = static_cast<size_type>(
93 (std::numeric_limits<difference_type>::max)());
94 difference_type converted_diff(static_cast<difference_type>(max_diff));
95 BOOST_TEST((std::numeric_limits<difference_type>::max)()
96 == converted_diff);
97
98 BOOST_TEST(
99 static_cast<comparison_type>(
100 (std::numeric_limits<size_type>::max)()) >
101 static_cast<comparison_type>(
102 (std::numeric_limits<difference_type>::max)()));
103
104 // Constructors
105
106 // I don't test the runtime post-conditions here.
107
108 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
109 // It isn't specified in the container requirements that the no argument
110 // constructor is implicit, but it is defined that way in the concrete
111 // container specification.
112 X u_implicit = {};
113 sink(u_implicit);
114 #endif
115
116 X u;
117 BOOST_TEST(u.size() == 0);
118 BOOST_TEST(X().size() == 0);
119
120 X a,b;
121 X a_const;
122
123 sink(X(a));
124 X u2(a);
125 X u3 = a;
126 X u4(rvalue(a_const));
127 X u5 = rvalue(a_const);
128
129 a.swap(b);
130 boost::swap(a, b);
131 test::check_return_type<X>::equals_ref(r = a);
132
133 // Allocator
134
135 typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
136 test::check_return_type<allocator_type>::equals(a_const.get_allocator());
137
138 allocator_type m = a.get_allocator();
139 sink(X(m));
140 X c(m);
141 sink(X(a_const, m));
142 X c2(a_const, m);
143 sink(X(rvalue(a_const), m));
144 X c3(rvalue(a_const), m);
145
146 // Avoid unused variable warnings:
147
148 sink(u);
149 sink(u2);
150 sink(u3);
151 sink(u4);
152 sink(u5);
153 sink(c);
154 sink(c2);
155 sink(c3);
156 }
157
158 template <class X>
159 void unordered_destructible_test(X&)
160 {
161 typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
162 typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
163 typedef BOOST_DEDUCED_TYPENAME X::size_type size_type;
164
165 X x1;
166
167 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
168 X x2(rvalue_default<X>());
169 X x3 = rvalue_default<X>();
170 // This can only be done if propagate_on_container_move_assignment::value
171 // is true.
172 // x2 = rvalue_default<X>();
173 #endif
174
175 X* ptr = new X();
176 X& a1 = *ptr;
177 (&a1)->~X();
178 ::operator delete((void*)(&a1));
179
180 X a,b;
181 X const a_const;
182 test::check_return_type<iterator>::equals(a.begin());
183 test::check_return_type<const_iterator>::equals(a_const.begin());
184 test::check_return_type<const_iterator>::equals(a.cbegin());
185 test::check_return_type<const_iterator>::equals(a_const.cbegin());
186 test::check_return_type<iterator>::equals(a.end());
187 test::check_return_type<const_iterator>::equals(a_const.end());
188 test::check_return_type<const_iterator>::equals(a.cend());
189 test::check_return_type<const_iterator>::equals(a_const.cend());
190
191 a.swap(b);
192 boost::swap(a, b);
193
194 test::check_return_type<size_type>::equals(a.size());
195 test::check_return_type<size_type>::equals(a.max_size());
196 test::check_return_type<bool>::convertible(a.empty());
197
198 // Allocator
199
200 typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
201 test::check_return_type<allocator_type>::equals(a_const.get_allocator());
202 }
203
204 template <class X, class Key>
205 void unordered_set_test(X&, Key const&)
206 {
207 typedef BOOST_DEDUCED_TYPENAME X::value_type value_type;
208 typedef BOOST_DEDUCED_TYPENAME X::key_type key_type;
209
210 BOOST_STATIC_ASSERT((boost::is_same<value_type, key_type>::value));
211
212 // iterator pointer / const_pointer_type
213
214 typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
215 typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
216 typedef BOOST_DEDUCED_TYPENAME X::local_iterator local_iterator;
217 typedef BOOST_DEDUCED_TYPENAME X::const_local_iterator const_local_iterator;
218 typedef BOOST_DEDUCED_TYPENAME
219 boost::iterator_pointer<iterator>::type iterator_pointer;
220 typedef BOOST_DEDUCED_TYPENAME
221 boost::iterator_pointer<const_iterator>::type
222 const_iterator_pointer;
223 typedef BOOST_DEDUCED_TYPENAME
224 boost::iterator_pointer<local_iterator>::type local_iterator_pointer;
225 typedef BOOST_DEDUCED_TYPENAME
226 boost::iterator_pointer<const_local_iterator>::type
227 const_local_iterator_pointer;
228
229 BOOST_STATIC_ASSERT((boost::is_same<value_type const*, iterator_pointer>::value));
230 BOOST_STATIC_ASSERT((boost::is_same<value_type const*, const_iterator_pointer>::value));
231 BOOST_STATIC_ASSERT((boost::is_same<value_type const*, local_iterator_pointer>::value));
232 BOOST_STATIC_ASSERT((boost::is_same<value_type const*, const_local_iterator_pointer>::value));
233 }
234
235 template <class X, class Key, class T>
236 void unordered_map_test(X& r, Key const& k, T const& v)
237 {
238 typedef BOOST_DEDUCED_TYPENAME X::value_type value_type;
239 typedef BOOST_DEDUCED_TYPENAME X::key_type key_type;
240
241 BOOST_STATIC_ASSERT((
242 boost::is_same<value_type, std::pair<key_type const, T> >::value));
243
244 // iterator pointer / const_pointer_type
245
246 typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
247 typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
248 typedef BOOST_DEDUCED_TYPENAME X::local_iterator local_iterator;
249 typedef BOOST_DEDUCED_TYPENAME X::const_local_iterator const_local_iterator;
250 typedef BOOST_DEDUCED_TYPENAME
251 boost::iterator_pointer<iterator>::type iterator_pointer;
252 typedef BOOST_DEDUCED_TYPENAME
253 boost::iterator_pointer<const_iterator>::type
254 const_iterator_pointer;
255 typedef BOOST_DEDUCED_TYPENAME
256 boost::iterator_pointer<local_iterator>::type local_iterator_pointer;
257 typedef BOOST_DEDUCED_TYPENAME
258 boost::iterator_pointer<const_local_iterator>::type
259 const_local_iterator_pointer;
260
261 BOOST_STATIC_ASSERT((boost::is_same<value_type*, iterator_pointer>::value));
262 BOOST_STATIC_ASSERT((boost::is_same<value_type const*, const_iterator_pointer>::value));
263 BOOST_STATIC_ASSERT((boost::is_same<value_type*, local_iterator_pointer>::value));
264 BOOST_STATIC_ASSERT((boost::is_same<value_type const*, const_local_iterator_pointer>::value));
265
266 // Calling functions
267
268 r.insert(std::pair<Key const, T>(k, v));
269
270 Key k_lvalue(k);
271 T v_lvalue(v);
272
273 r.emplace(k, v);
274 r.emplace(k_lvalue, v_lvalue);
275 r.emplace(rvalue(k), rvalue(v));
276
277 r.emplace(boost::unordered::piecewise_construct,
278 boost::make_tuple(k), boost::make_tuple(v));
279 }
280
281 template <class X>
282 void equality_test(X& r)
283 {
284 X const a = r, b = r;
285
286 test::check_return_type<bool>::equals(a == b);
287 test::check_return_type<bool>::equals(a != b);
288 test::check_return_type<bool>::equals(boost::operator==(a, b));
289 test::check_return_type<bool>::equals(boost::operator!=(a, b));
290 }
291
292 template <class X, class T>
293 void unordered_unique_test(X& r, T const& t)
294 {
295 typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
296 test::check_return_type<std::pair<iterator, bool> >::equals(r.insert(t));
297 test::check_return_type<std::pair<iterator, bool> >::equals(r.emplace(t));
298 }
299
300 template <class X, class T>
301 void unordered_equivalent_test(X& r, T const& t)
302 {
303 typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
304 test::check_return_type<iterator>::equals(r.insert(t));
305 test::check_return_type<iterator>::equals(r.emplace(t));
306 }
307
308 template <class X, class Key, class T>
309 void unordered_map_functions(X&, Key const& k, T const&)
310 {
311 typedef BOOST_DEDUCED_TYPENAME X::mapped_type mapped_type;
312
313 X a;
314 test::check_return_type<mapped_type>::equals_ref(a[k]);
315 test::check_return_type<mapped_type>::equals_ref(a.at(k));
316
317 X const b = a;
318 test::check_return_type<mapped_type const>::equals_ref(b.at(k));
319 }
320
321 template <class X, class Key, class Hash, class Pred>
322 void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
323 {
324 unordered_destructible_test(x);
325
326 typedef BOOST_DEDUCED_TYPENAME X::key_type key_type;
327 typedef BOOST_DEDUCED_TYPENAME X::hasher hasher;
328 typedef BOOST_DEDUCED_TYPENAME X::key_equal key_equal;
329 typedef BOOST_DEDUCED_TYPENAME X::size_type size_type;
330
331 typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
332 typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
333 typedef BOOST_DEDUCED_TYPENAME X::local_iterator local_iterator;
334 typedef BOOST_DEDUCED_TYPENAME X::const_local_iterator const_local_iterator;
335
336 typedef BOOST_DEDUCED_TYPENAME
337 boost::BOOST_ITERATOR_CATEGORY<iterator>::type
338 iterator_category;
339 typedef BOOST_DEDUCED_TYPENAME
340 boost::iterator_difference<iterator>::type
341 iterator_difference;
342 typedef BOOST_DEDUCED_TYPENAME
343 boost::iterator_pointer<iterator>::type
344 iterator_pointer;
345 typedef BOOST_DEDUCED_TYPENAME
346 boost::iterator_reference<iterator>::type
347 iterator_reference;
348
349 typedef BOOST_DEDUCED_TYPENAME
350 boost::BOOST_ITERATOR_CATEGORY<local_iterator>::type
351 local_iterator_category;
352 typedef BOOST_DEDUCED_TYPENAME
353 boost::iterator_difference<local_iterator>::type
354 local_iterator_difference;
355 typedef BOOST_DEDUCED_TYPENAME
356 boost::iterator_pointer<local_iterator>::type
357 local_iterator_pointer;
358 typedef BOOST_DEDUCED_TYPENAME
359 boost::iterator_reference<local_iterator>::type
360 local_iterator_reference;
361
362 typedef BOOST_DEDUCED_TYPENAME
363 boost::BOOST_ITERATOR_CATEGORY<const_iterator>::type
364 const_iterator_category;
365 typedef BOOST_DEDUCED_TYPENAME
366 boost::iterator_difference<const_iterator>::type
367 const_iterator_difference;
368 typedef BOOST_DEDUCED_TYPENAME
369 boost::iterator_pointer<const_iterator>::type
370 const_iterator_pointer;
371 typedef BOOST_DEDUCED_TYPENAME
372 boost::iterator_reference<const_iterator>::type
373 const_iterator_reference;
374
375 typedef BOOST_DEDUCED_TYPENAME
376 boost::BOOST_ITERATOR_CATEGORY<const_local_iterator>::type
377 const_local_iterator_category;
378 typedef BOOST_DEDUCED_TYPENAME
379 boost::iterator_difference<const_local_iterator>::type
380 const_local_iterator_difference;
381 typedef BOOST_DEDUCED_TYPENAME
382 boost::iterator_pointer<const_local_iterator>::type
383 const_local_iterator_pointer;
384 typedef BOOST_DEDUCED_TYPENAME
385 boost::iterator_reference<const_local_iterator>::type
386 const_local_iterator_reference;
387 typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
388
389 BOOST_STATIC_ASSERT((boost::is_same<Key, key_type>::value));
390 //boost::function_requires<boost::CopyConstructibleConcept<key_type> >();
391 //boost::function_requires<boost::AssignableConcept<key_type> >();
392
393 BOOST_STATIC_ASSERT((boost::is_same<Hash, hasher>::value));
394 test::check_return_type<std::size_t>::equals(hf(k));
395
396 BOOST_STATIC_ASSERT((boost::is_same<Pred, key_equal>::value));
397 test::check_return_type<bool>::convertible(eq(k, k));
398
399 boost::function_requires<boost::InputIteratorConcept<local_iterator> >();
400 BOOST_STATIC_ASSERT((boost::is_same<local_iterator_category,
401 iterator_category>::value));
402 BOOST_STATIC_ASSERT((boost::is_same<local_iterator_difference,
403 iterator_difference>::value));
404 BOOST_STATIC_ASSERT((boost::is_same<local_iterator_pointer,
405 iterator_pointer>::value));
406 BOOST_STATIC_ASSERT((boost::is_same<local_iterator_reference,
407 iterator_reference>::value));
408
409 boost::function_requires<
410 boost::InputIteratorConcept<const_local_iterator> >();
411 BOOST_STATIC_ASSERT((boost::is_same<const_local_iterator_category,
412 const_iterator_category>::value));
413 BOOST_STATIC_ASSERT((boost::is_same<const_local_iterator_difference,
414 const_iterator_difference>::value));
415 BOOST_STATIC_ASSERT((boost::is_same<const_local_iterator_pointer,
416 const_iterator_pointer>::value));
417 BOOST_STATIC_ASSERT((boost::is_same<const_local_iterator_reference,
418 const_iterator_reference>::value));
419
420 X a;
421 allocator_type m = a.get_allocator();
422
423 // Constructors
424
425 X(10, hf, eq);
426 X a1(10, hf, eq);
427 X(10, hf);
428 X a2(10, hf);
429 X(10);
430 X a3(10);
431 X();
432 X a4;
433
434 X(10, hf, eq, m);
435 X a1a(10, hf, eq, m);
436 X(10, hf, m);
437 X a2a(10, hf, m);
438 X(10, m);
439 X a3a(10, m);
440 (X(m));
441 X a4a(m);
442
443 test::check_return_type<size_type>::equals(a.erase(k));
444
445 const_iterator q1 = a.cbegin(), q2 = a.cend();
446 test::check_return_type<iterator>::equals(a.erase(q1, q2));
447
448 a.clear();
449
450 X const b;
451
452 test::check_return_type<hasher>::equals(b.hash_function());
453 test::check_return_type<key_equal>::equals(b.key_eq());
454
455 test::check_return_type<iterator>::equals(a.find(k));
456 test::check_return_type<const_iterator>::equals(b.find(k));
457 test::check_return_type<size_type>::equals(b.count(k));
458 test::check_return_type<std::pair<iterator, iterator> >::equals(
459 a.equal_range(k));
460 test::check_return_type<std::pair<const_iterator, const_iterator> >::equals(
461 b.equal_range(k));
462 test::check_return_type<size_type>::equals(b.bucket_count());
463 test::check_return_type<size_type>::equals(b.max_bucket_count());
464 test::check_return_type<size_type>::equals(b.bucket(k));
465 test::check_return_type<size_type>::equals(b.bucket_size(0));
466
467 test::check_return_type<local_iterator>::equals(a.begin(0));
468 test::check_return_type<const_local_iterator>::equals(b.begin(0));
469 test::check_return_type<local_iterator>::equals(a.end(0));
470 test::check_return_type<const_local_iterator>::equals(b.end(0));
471
472 test::check_return_type<const_local_iterator>::equals(a.cbegin(0));
473 test::check_return_type<const_local_iterator>::equals(b.cbegin(0));
474 test::check_return_type<const_local_iterator>::equals(a.cend(0));
475 test::check_return_type<const_local_iterator>::equals(b.cend(0));
476
477 test::check_return_type<float>::equals(b.load_factor());
478 test::check_return_type<float>::equals(b.max_load_factor());
479 a.max_load_factor((float) 2.0);
480 a.rehash(100);
481
482 // Avoid unused variable warnings:
483
484 sink(a);
485 sink(a1);
486 sink(a2);
487 sink(a3);
488 sink(a4);
489 sink(a1a);
490 sink(a2a);
491 sink(a3a);
492 sink(a4a);
493 }
494
495 template <class X, class Key, class T, class Hash, class Pred>
496 void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
497 {
498 unordered_test(x, k, hf, eq);
499
500 typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
501 typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
502 typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
503
504 X a;
505 allocator_type m = a.get_allocator();
506
507 BOOST_DEDUCED_TYPENAME X::value_type* i = 0;
508 BOOST_DEDUCED_TYPENAME X::value_type* j = 0;
509
510 // Constructors
511
512 X(i, j, 10, hf, eq);
513 X a5(i, j, 10, hf, eq);
514 X(i, j, 10, hf);
515 X a6(i, j, 10, hf);
516 X(i, j, 10);
517 X a7(i, j, 10);
518 X(i, j);
519 X a8(i, j);
520
521 X(i, j, 10, hf, eq, m);
522 X a5a(i, j, 10, hf, eq, m);
523 X(i, j, 10, hf, m);
524 X a6a(i, j, 10, hf, m);
525 X(i, j, 10, m);
526 X a7a(i, j, 10, m);
527
528 // Not specified for some reason (maybe ambiguity with another constructor?)
529 //X(i, j, m);
530 //X a8a(i, j, m);
531 //sink(a8a);
532
533 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
534 std::size_t min_buckets = 10;
535 X({t});
536 X({t}, min_buckets);
537 X({t}, min_buckets, hf);
538 X({t}, min_buckets, hf, eq);
539 //X({t}, m);
540 X({t}, min_buckets, m);
541 X({t}, min_buckets, hf, m);
542 X({t}, min_buckets, hf, eq, m);
543 #endif
544
545 X const b;
546 sink(X(b));
547 X a9(b);
548 a = b;
549
550 sink(X(b, m));
551 X a9a(b, m);
552
553 const_iterator q = a.cbegin();
554
555 test::check_return_type<iterator>::equals(a.insert(q, t));
556 test::check_return_type<iterator>::equals(a.emplace_hint(q, t));
557
558 a.insert(i, j);
559 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
560 std::initializer_list<T> list = {t};
561 a.insert(list);
562 a.insert({t,t,t});
563
564 #if !BOOST_WORKAROUND(BOOST_MSVC, < 1900)
565 a.insert({});
566 a.insert({t});
567 a.insert({t,t});
568 #endif
569 #endif
570
571 X a10;
572 a10.insert(t);
573 q = a10.cbegin();
574 test::check_return_type<iterator>::equals(a10.erase(q));
575
576 // Avoid unused variable warnings:
577
578 sink(a);
579 sink(a5);
580 sink(a6);
581 sink(a7);
582 sink(a8);
583 sink(a9);
584 sink(a5a);
585 sink(a6a);
586 sink(a7a);
587 sink(a9a);
588 }
589
590 template <class X, class Key, class T, class Hash, class Pred>
591 void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
592 {
593 unordered_test(x, k, hf, eq);
594
595 typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
596 typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
597 typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
598
599 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
600 X x1(rvalue_default<X>());
601 X x2(boost::move(x1));
602 x1 = rvalue_default<X>();
603 x2 = boost::move(x1);
604 #endif
605
606 X a;
607 allocator_type m = a.get_allocator();
608
609 test::minimal::constructor_param* i = 0;
610 test::minimal::constructor_param* j = 0;
611
612 // Constructors
613
614 X(i, j, 10, hf, eq);
615 X a5(i, j, 10, hf, eq);
616 X(i, j, 10, hf);
617 X a6(i, j, 10, hf);
618 X(i, j, 10);
619 X a7(i, j, 10);
620 X(i, j);
621 X a8(i, j);
622
623 X(i, j, 10, hf, eq, m);
624 X a5a(i, j, 10, hf, eq, m);
625 X(i, j, 10, hf, m);
626 X a6a(i, j, 10, hf, m);
627 X(i, j, 10, m);
628 X a7a(i, j, 10, m);
629
630 // Not specified for some reason (maybe ambiguity with another constructor?)
631 //X(i, j, m);
632 //X a8a(i, j, m);
633 //sink(a8a);
634
635 const_iterator q = a.cbegin();
636
637 test::minimal::constructor_param v;
638 a.emplace(v);
639 test::check_return_type<iterator>::equals(a.emplace_hint(q, v));
640
641 T v1(v);
642 a.emplace(boost::move(v1));
643 T v2(v);
644 a.insert(boost::move(v2));
645 T v3(v);
646 test::check_return_type<iterator>::equals(
647 a.emplace_hint(q, boost::move(v3)));
648 T v4(v);
649 test::check_return_type<iterator>::equals(
650 a.insert(q, boost::move(v4)));
651
652 a.insert(i, j);
653
654 X a10;
655 T v5(v);
656 a10.insert(boost::move(v5));
657 q = a10.cbegin();
658 test::check_return_type<iterator>::equals(a10.erase(q));
659
660 // Avoid unused variable warnings:
661
662 sink(a);
663 sink(a5);
664 sink(a6);
665 sink(a7);
666 sink(a8);
667 sink(a5a);
668 sink(a6a);
669 sink(a7a);
670 sink(a10);
671 }
672
673 template <class X, class T>
674 void unordered_set_member_test(X& x, T& t)
675 {
676 X x1(x);
677 x1.insert(t);
678 x1.begin()->dummy_member();
679 x1.cbegin()->dummy_member();
680 }
681
682 template <class X, class T>
683 void unordered_map_member_test(X& x, T& t)
684 {
685 X x1(x);
686 x1.insert(t);
687 x1.begin()->first.dummy_member();
688 x1.cbegin()->first.dummy_member();
689 x1.begin()->second.dummy_member();
690 x1.cbegin()->second.dummy_member();
691 }