]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/container/map.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / container / map.hpp
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // See http://www.boost.org/libs/container for documentation.
8 //
9 //////////////////////////////////////////////////////////////////////////////
10 #ifndef BOOST_CONTAINER_MAP_HPP
11 #define BOOST_CONTAINER_MAP_HPP
12
13 #ifndef BOOST_CONFIG_HPP
14 # include <boost/config.hpp>
15 #endif
16
17 #if defined(BOOST_HAS_PRAGMA_ONCE)
18 # pragma once
19 #endif
20
21 #include <boost/container/detail/config_begin.hpp>
22 #include <boost/container/detail/workaround.hpp>
23
24 // container
25 #include <boost/container/container_fwd.hpp>
26 #include <boost/container/new_allocator.hpp> //new_allocator
27 #include <boost/container/throw_exception.hpp>
28 // container/detail
29 #include <boost/container/detail/mpl.hpp>
30 #include <boost/container/detail/tree.hpp>
31 #include <boost/container/detail/type_traits.hpp>
32 #include <boost/container/detail/value_init.hpp>
33 #include <boost/container/detail/pair.hpp>
34 #include <boost/container/detail/pair_key_mapped_of_value.hpp>
35
36 // move
37 #include <boost/move/traits.hpp>
38 #include <boost/move/utility_core.hpp>
39 // move/detail
40 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
41 #include <boost/move/detail/fwd_macros.hpp>
42 #endif
43 #include <boost/move/detail/move_helpers.hpp>
44 // intrusive/detail
45 #include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
46 #include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal
47 // other
48 #include <boost/static_assert.hpp>
49 #include <boost/core/no_exceptions_support.hpp>
50 // std
51 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
52 #include <initializer_list>
53 #endif
54
55 namespace boost {
56 namespace container {
57
58 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
59
60 //! A map is a kind of associative container that supports unique keys (contains at
61 //! most one of each key value) and provides for fast retrieval of values of another
62 //! type T based on the keys. The map class supports bidirectional iterators.
63 //!
64 //! A map satisfies all of the requirements of a container and of a reversible
65 //! container and of an associative container. The <code>value_type</code> stored
66 //! by this container is the value_type is std::pair<const Key, T>.
67 //!
68 //! \tparam Key is the key_type of the map
69 //! \tparam T is the <code>mapped_type</code>
70 //! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
71 //! \tparam Allocator is the allocator to allocate the <code>value_type</code>s
72 //! (e.g. <i>allocator< std::pair<const Key, T> > </i>).
73 //! \tparam Options is an packed option type generated using using boost::container::tree_assoc_options.
74 template < class Key, class T, class Compare = std::less<Key>
75 , class Allocator = new_allocator< std::pair< const Key, T> >, class Options = tree_assoc_defaults >
76 #else
77 template <class Key, class T, class Compare, class Allocator, class Options>
78 #endif
79 class map
80 ///@cond
81 : public container_detail::tree
82 < std::pair<const Key, T>
83 , container_detail::select1st<Key>
84 , Compare, Allocator, Options>
85 ///@endcond
86 {
87 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
88 private:
89 BOOST_COPYABLE_AND_MOVABLE(map)
90
91 typedef container_detail::select1st<Key> select_1st_t;
92 typedef std::pair<const Key, T> value_type_impl;
93 typedef container_detail::tree
94 <value_type_impl, select_1st_t, Compare, Allocator, Options> base_t;
95 typedef container_detail::pair <Key, T> movable_value_type_impl;
96 typedef typename base_t::value_compare value_compare_impl;
97 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
98
99 public:
100 //////////////////////////////////////////////
101 //
102 // types
103 //
104 //////////////////////////////////////////////
105
106 typedef Key key_type;
107 typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
108 typedef T mapped_type;
109 typedef typename boost::container::allocator_traits<Allocator>::value_type value_type;
110 typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
111 typedef typename boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
112 typedef typename boost::container::allocator_traits<Allocator>::reference reference;
113 typedef typename boost::container::allocator_traits<Allocator>::const_reference const_reference;
114 typedef typename boost::container::allocator_traits<Allocator>::size_type size_type;
115 typedef typename boost::container::allocator_traits<Allocator>::difference_type difference_type;
116 typedef Allocator allocator_type;
117 typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
118 typedef BOOST_CONTAINER_IMPDEF(value_compare_impl) value_compare;
119 typedef Compare key_compare;
120 typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator;
121 typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator;
122 typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator;
123 typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator;
124 typedef std::pair<key_type, mapped_type> nonconst_value_type;
125 typedef BOOST_CONTAINER_IMPDEF(movable_value_type_impl) movable_value_type;
126 typedef BOOST_CONTAINER_IMPDEF(node_handle<
127 typename base_t::stored_allocator_type
128 BOOST_MOVE_I pair_key_mapped_of_value
129 <key_type BOOST_MOVE_I mapped_type> >) node_type;
130 typedef BOOST_CONTAINER_IMPDEF
131 (insert_return_type_base<iterator BOOST_MOVE_I node_type>) insert_return_type;
132
133 //allocator_type::value_type type must be std::pair<CONST Key, T>
134 BOOST_STATIC_ASSERT((container_detail::is_same<typename allocator_type::value_type, std::pair<const Key, T> >::value));
135
136 //////////////////////////////////////////////
137 //
138 // construct/copy/destroy
139 //
140 //////////////////////////////////////////////
141
142 //! <b>Effects</b>: Default constructs an empty map.
143 //!
144 //! <b>Complexity</b>: Constant.
145 BOOST_CONTAINER_FORCEINLINE
146 map() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
147 container_detail::is_nothrow_default_constructible<Compare>::value)
148 : base_t()
149 {}
150
151 //! <b>Effects</b>: Constructs an empty map using the specified comparison object
152 //! and allocator.
153 //!
154 //! <b>Complexity</b>: Constant.
155 BOOST_CONTAINER_FORCEINLINE map(const Compare& comp, const allocator_type& a)
156 : base_t(comp, a)
157 {}
158
159 //! <b>Effects</b>: Constructs an empty map using the specified comparison object.
160 //!
161 //! <b>Complexity</b>: Constant.
162 BOOST_CONTAINER_FORCEINLINE explicit map(const Compare& comp)
163 : base_t(comp)
164 {}
165
166 //! <b>Effects</b>: Constructs an empty map using the specified allocator.
167 //!
168 //! <b>Complexity</b>: Constant.
169 BOOST_CONTAINER_FORCEINLINE explicit map(const allocator_type& a)
170 : base_t(a)
171 {}
172
173 //! <b>Effects</b>: Constructs an empty map and
174 //! inserts elements from the range [first ,last ).
175 //!
176 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
177 //! the predicate and otherwise N logN, where N is last - first.
178 template <class InputIterator>
179 BOOST_CONTAINER_FORCEINLINE map(InputIterator first, InputIterator last)
180 : base_t(true, first, last)
181 {}
182
183 //! <b>Effects</b>: Constructs an empty map using the specified
184 //! allocator, and inserts elements from the range [first ,last ).
185 //!
186 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
187 //! the predicate and otherwise N logN, where N is last - first.
188 template <class InputIterator>
189 BOOST_CONTAINER_FORCEINLINE map(InputIterator first, InputIterator last, const allocator_type& a)
190 : base_t(true, first, last, Compare(), a)
191 {}
192
193 //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
194 //! inserts elements from the range [first ,last ).
195 //!
196 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
197 //! the predicate and otherwise N logN, where N is last - first.
198 template <class InputIterator>
199 BOOST_CONTAINER_FORCEINLINE map(InputIterator first, InputIterator last, const Compare& comp)
200 : base_t(true, first, last, comp)
201 {}
202
203 //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
204 //! allocator, and inserts elements from the range [first ,last ).
205 //!
206 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
207 //! the predicate and otherwise N logN, where N is last - first.
208 template <class InputIterator>
209 BOOST_CONTAINER_FORCEINLINE map(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
210 : base_t(true, first, last, comp, a)
211 {}
212
213 //! <b>Effects</b>: Constructs an empty map and
214 //! inserts elements from the ordered unique range [first ,last). This function
215 //! is more efficient than the normal range creation for ordered ranges.
216 //!
217 //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
218 //! unique values.
219 //!
220 //! <b>Complexity</b>: Linear in N.
221 //!
222 //! <b>Note</b>: Non-standard extension.
223 template <class InputIterator>
224 BOOST_CONTAINER_FORCEINLINE map( ordered_unique_range_t, InputIterator first, InputIterator last)
225 : base_t(ordered_range, first, last)
226 {}
227
228 //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
229 //! inserts elements from the ordered unique range [first ,last). This function
230 //! is more efficient than the normal range creation for ordered ranges.
231 //!
232 //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
233 //! unique values.
234 //!
235 //! <b>Complexity</b>: Linear in N.
236 //!
237 //! <b>Note</b>: Non-standard extension.
238 template <class InputIterator>
239 BOOST_CONTAINER_FORCEINLINE map( ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp)
240 : base_t(ordered_range, first, last, comp)
241 {}
242
243 //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
244 //! allocator, and inserts elements from the ordered unique range [first ,last). This function
245 //! is more efficient than the normal range creation for ordered ranges.
246 //!
247 //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
248 //! unique values.
249 //!
250 //! <b>Complexity</b>: Linear in N.
251 //!
252 //! <b>Note</b>: Non-standard extension.
253 template <class InputIterator>
254 BOOST_CONTAINER_FORCEINLINE map( ordered_unique_range_t, InputIterator first, InputIterator last
255 , const Compare& comp, const allocator_type& a)
256 : base_t(ordered_range, first, last, comp, a)
257 {}
258
259 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
260 //! <b>Effects</b>: Constructs an empty map and
261 //! inserts elements from the range [il.begin(), il.end()).
262 //!
263 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted according
264 //! to the predicate and otherwise N logN, where N is il.first() - il.end().
265 BOOST_CONTAINER_FORCEINLINE map(std::initializer_list<value_type> il)
266 : base_t(true, il.begin(), il.end())
267 {}
268
269 //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
270 //! inserts elements from the range [il.begin(), il.end()).
271 //!
272 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
273 //! the predicate and otherwise N logN, where N is il.first() - il.end().
274 BOOST_CONTAINER_FORCEINLINE map(std::initializer_list<value_type> il, const Compare& comp)
275 : base_t(true, il.begin(), il.end(), comp)
276 {}
277
278 //! <b>Effects</b>: Constructs an empty map using the specified
279 //! allocator, and inserts elements from the range [il.begin(), il.end()).
280 //!
281 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
282 //! the predicate and otherwise N logN, where N is il.first() - il.end().
283 BOOST_CONTAINER_FORCEINLINE map(std::initializer_list<value_type> il, const allocator_type& a)
284 : base_t(true, il.begin(), il.end(), Compare(), a)
285 {}
286
287 //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
288 //! allocator, and inserts elements from the range [il.begin(), il.end()).
289 //!
290 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
291 //! the predicate and otherwise N logN, where N is il.first() - il.end().
292 BOOST_CONTAINER_FORCEINLINE map(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
293 : base_t(true, il.begin(), il.end(), comp, a)
294 {}
295
296 //! <b>Effects</b>: Constructs an empty map and inserts elements from the ordered unique range [il.begin(), il.end()).
297 //! This function is more efficient than the normal range creation for ordered ranges.
298 //!
299 //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
300 //! unique values.
301 //!
302 //! <b>Complexity</b>: Linear in N.
303 //!
304 //! <b>Note</b>: Non-standard extension.
305 BOOST_CONTAINER_FORCEINLINE map(ordered_unique_range_t, std::initializer_list<value_type> il)
306 : base_t(ordered_range, il.begin(), il.end())
307 {}
308
309 //! <b>Effects</b>: Constructs an empty map using the specified comparison object,
310 //! and inserts elements from the ordered unique range [il.begin(), il.end()). This function
311 //! is more efficient than the normal range creation for ordered ranges.
312 //!
313 //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
314 //! unique values.
315 //!
316 //! <b>Complexity</b>: Linear in N.
317 //!
318 //! <b>Note</b>: Non-standard extension.
319 BOOST_CONTAINER_FORCEINLINE map(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp)
320 : base_t(ordered_range, il.begin(), il.end(), comp)
321 {}
322
323 //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
324 //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function
325 //! is more efficient than the normal range creation for ordered ranges.
326 //!
327 //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
328 //! unique values.
329 //!
330 //! <b>Complexity</b>: Linear in N.
331 //!
332 //! <b>Note</b>: Non-standard extension.
333 BOOST_CONTAINER_FORCEINLINE map( ordered_unique_range_t, std::initializer_list<value_type> il
334 , const Compare& comp, const allocator_type& a)
335 : base_t(ordered_range, il.begin(), il.end(), comp, a)
336 {}
337
338 #endif
339
340 //! <b>Effects</b>: Copy constructs a map.
341 //!
342 //! <b>Complexity</b>: Linear in x.size().
343 BOOST_CONTAINER_FORCEINLINE map(const map& x)
344 : base_t(static_cast<const base_t&>(x))
345 {}
346
347 //! <b>Effects</b>: Move constructs a map. Constructs *this using x's resources.
348 //!
349 //! <b>Complexity</b>: Constant.
350 //!
351 //! <b>Postcondition</b>: x is emptied.
352 BOOST_CONTAINER_FORCEINLINE map(BOOST_RV_REF(map) x)
353 BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
354 : base_t(BOOST_MOVE_BASE(base_t, x))
355 {}
356
357 //! <b>Effects</b>: Copy constructs a map using the specified allocator.
358 //!
359 //! <b>Complexity</b>: Linear in x.size().
360 BOOST_CONTAINER_FORCEINLINE map(const map& x, const allocator_type &a)
361 : base_t(static_cast<const base_t&>(x), a)
362 {}
363
364 //! <b>Effects</b>: Move constructs a map using the specified allocator.
365 //! Constructs *this using x's resources.
366 //!
367 //! <b>Complexity</b>: Constant if x == x.get_allocator(), linear otherwise.
368 //!
369 //! <b>Postcondition</b>: x is emptied.
370 BOOST_CONTAINER_FORCEINLINE map(BOOST_RV_REF(map) x, const allocator_type &a)
371 : base_t(BOOST_MOVE_BASE(base_t, x), a)
372 {}
373
374 //! <b>Effects</b>: Makes *this a copy of x.
375 //!
376 //! <b>Complexity</b>: Linear in x.size().
377 BOOST_CONTAINER_FORCEINLINE map& operator=(BOOST_COPY_ASSIGN_REF(map) x)
378 { return static_cast<map&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
379
380 //! <b>Effects</b>: this->swap(x.get()).
381 //!
382 //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment
383 //! is false and (allocation throws or value_type's move constructor throws)
384 //!
385 //! <b>Complexity</b>: Constant if allocator_traits_type::
386 //! propagate_on_container_move_assignment is true or
387 //! this->get>allocator() == x.get_allocator(). Linear otherwise.
388 BOOST_CONTAINER_FORCEINLINE map& operator=(BOOST_RV_REF(map) x)
389 BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
390 allocator_traits_type::is_always_equal::value) &&
391 boost::container::container_detail::is_nothrow_move_assignable<Compare>::value)
392 { return static_cast<map&>(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); }
393
394 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
395 //! <b>Effects</b>: Assign content of il to *this.
396 //!
397 BOOST_CONTAINER_FORCEINLINE map& operator=(std::initializer_list<value_type> il)
398 {
399 this->clear();
400 insert(il.begin(), il.end());
401 return *this;
402 }
403 #endif
404
405 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
406
407 //! <b>Effects</b>: Returns a copy of the allocator that
408 //! was passed to the object's constructor.
409 //!
410 //! <b>Complexity</b>: Constant.
411 allocator_type get_allocator() const;
412
413 //! <b>Effects</b>: Returns a reference to the internal allocator.
414 //!
415 //! <b>Throws</b>: Nothing
416 //!
417 //! <b>Complexity</b>: Constant.
418 //!
419 //! <b>Note</b>: Non-standard extension.
420 stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW;
421
422 //! <b>Effects</b>: Returns a reference to the internal allocator.
423 //!
424 //! <b>Throws</b>: Nothing
425 //!
426 //! <b>Complexity</b>: Constant.
427 //!
428 //! <b>Note</b>: Non-standard extension.
429 const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW;
430
431 //! <b>Effects</b>: Returns an iterator to the first element contained in the container.
432 //!
433 //! <b>Throws</b>: Nothing.
434 //!
435 //! <b>Complexity</b>: Constant.
436 iterator begin() BOOST_NOEXCEPT_OR_NOTHROW;
437
438 //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
439 //!
440 //! <b>Throws</b>: Nothing.
441 //!
442 //! <b>Complexity</b>: Constant.
443 const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW;
444
445 //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
446 //!
447 //! <b>Throws</b>: Nothing.
448 //!
449 //! <b>Complexity</b>: Constant.
450 const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
451
452 //! <b>Effects</b>: Returns an iterator to the end of the container.
453 //!
454 //! <b>Throws</b>: Nothing.
455 //!
456 //! <b>Complexity</b>: Constant.
457 iterator end() BOOST_NOEXCEPT_OR_NOTHROW;
458
459 //! <b>Effects</b>: Returns a const_iterator to the end of the container.
460 //!
461 //! <b>Throws</b>: Nothing.
462 //!
463 //! <b>Complexity</b>: Constant.
464 const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW;
465
466 //! <b>Effects</b>: Returns a const_iterator to the end of the container.
467 //!
468 //! <b>Throws</b>: Nothing.
469 //!
470 //! <b>Complexity</b>: Constant.
471 const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW;
472
473 //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
474 //! of the reversed container.
475 //!
476 //! <b>Throws</b>: Nothing.
477 //!
478 //! <b>Complexity</b>: Constant.
479 reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW;
480
481 //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
482 //! of the reversed container.
483 //!
484 //! <b>Throws</b>: Nothing.
485 //!
486 //! <b>Complexity</b>: Constant.
487 const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
488
489 //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
490 //! of the reversed container.
491 //!
492 //! <b>Throws</b>: Nothing.
493 //!
494 //! <b>Complexity</b>: Constant.
495 const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
496
497 //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
498 //! of the reversed container.
499 //!
500 //! <b>Throws</b>: Nothing.
501 //!
502 //! <b>Complexity</b>: Constant.
503 reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW;
504
505 //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
506 //! of the reversed container.
507 //!
508 //! <b>Throws</b>: Nothing.
509 //!
510 //! <b>Complexity</b>: Constant.
511 const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW;
512
513 //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
514 //! of the reversed container.
515 //!
516 //! <b>Throws</b>: Nothing.
517 //!
518 //! <b>Complexity</b>: Constant.
519 const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW;
520
521 //! <b>Effects</b>: Returns true if the container contains no elements.
522 //!
523 //! <b>Throws</b>: Nothing.
524 //!
525 //! <b>Complexity</b>: Constant.
526 bool empty() const BOOST_NOEXCEPT_OR_NOTHROW;
527
528 //! <b>Effects</b>: Returns the number of the elements contained in the container.
529 //!
530 //! <b>Throws</b>: Nothing.
531 //!
532 //! <b>Complexity</b>: Constant.
533 size_type size() const BOOST_NOEXCEPT_OR_NOTHROW;
534
535 //! <b>Effects</b>: Returns the largest possible size of the container.
536 //!
537 //! <b>Throws</b>: Nothing.
538 //!
539 //! <b>Complexity</b>: Constant.
540 size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW;
541
542 #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
543
544 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
545 //! <b>Effects</b>: If there is no key equivalent to x in the map, inserts
546 //! value_type(x, T()) into the map.
547 //!
548 //! <b>Returns</b>: A reference to the mapped_type corresponding to x in *this.
549 //!
550 //! <b>Complexity</b>: Logarithmic.
551 mapped_type& operator[](const key_type &k);
552
553 //! <b>Effects</b>: If there is no key equivalent to x in the map, inserts
554 //! value_type(boost::move(x), T()) into the map (the key is move-constructed)
555 //!
556 //! <b>Returns</b>: A reference to the mapped_type corresponding to x in *this.
557 //!
558 //! <b>Complexity</b>: Logarithmic.
559 mapped_type& operator[](key_type &&k);
560 #elif defined(BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN)
561 //in compilers like GCC 3.4, we can't catch temporaries
562 BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](const key_type &k) { return this->priv_subscript(k); }
563 BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](BOOST_RV_REF(key_type) k) { return this->priv_subscript(::boost::move(k)); }
564 #else
565 BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript)
566 #endif
567
568 //! <b>Effects</b>: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
569 //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
570 //! as if by insert, constructing it from value_type(k, forward<M>(obj)).
571 //!
572 //! No iterators or references are invalidated. If the insertion is successful, pointers and references
573 //! to the element obtained while it is held in the node handle are invalidated, and pointers and
574 //! references obtained to that element before it was extracted become valid.
575 //!
576 //! <b>Returns</b>: The bool component is true if the insertion took place and false if the assignment
577 //! took place. The iterator component is pointing at the element that was inserted or updated.
578 //!
579 //! <b>Complexity</b>: Logarithmic in the size of the container.
580 template <class M>
581 BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> insert_or_assign(const key_type& k, BOOST_FWD_REF(M) obj)
582 { return this->base_t::insert_or_assign(const_iterator(), k, ::boost::forward<M>(obj)); }
583
584 //! <b>Effects</b>: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
585 //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
586 //! as if by insert, constructing it from value_type(k, move(obj)).
587 //!
588 //! No iterators or references are invalidated. If the insertion is successful, pointers and references
589 //! to the element obtained while it is held in the node handle are invalidated, and pointers and
590 //! references obtained to that element before it was extracted become valid.
591 //!
592 //! <b>Returns</b>: The bool component is true if the insertion took place and false if the assignment
593 //! took place. The iterator component is pointing at the element that was inserted or updated.
594 //!
595 //! <b>Complexity</b>: Logarithmic in the size of the container.
596 template <class M>
597 BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> insert_or_assign(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
598 { return this->base_t::insert_or_assign(const_iterator(), ::boost::move(k), ::boost::forward<M>(obj)); }
599
600 //! <b>Effects</b>: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
601 //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
602 //! as if by insert, constructing it from value_type(k, forward<M>(obj)) and the new element
603 //! to the container as close as possible to the position just before hint.
604 //!
605 //! No iterators or references are invalidated. If the insertion is successful, pointers and references
606 //! to the element obtained while it is held in the node handle are invalidated, and pointers and
607 //! references obtained to that element before it was extracted become valid.
608 //!
609 //! <b>Returns</b>: The bool component is true if the insertion took place and false if the assignment
610 //! took place. The iterator component is pointing at the element that was inserted or updated.
611 //!
612 //! <b>Complexity</b>: Logarithmic in the size of the container in general, but amortized constant if
613 //! the new element is inserted just before hint.
614 template <class M>
615 BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, const key_type& k, BOOST_FWD_REF(M) obj)
616 { return this->base_t::insert_or_assign(hint, k, ::boost::forward<M>(obj)); }
617
618 //! <b>Effects</b>: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
619 //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
620 //! as if by insert, constructing it from value_type(k, move(obj)) and the new element
621 //! to the container as close as possible to the position just before hint.
622 //!
623 //! No iterators or references are invalidated. If the insertion is successful, pointers and references
624 //! to the element obtained while it is held in the node handle are invalidated, and pointers and
625 //! references obtained to that element before it was extracted become valid.
626 //!
627 //! <b>Returns</b>: The bool component is true if the insertion took place and false if the assignment
628 //! took place. The iterator component is pointing at the element that was inserted or updated.
629 //!
630 //! <b>Complexity</b>: Logarithmic in the size of the container in general, but amortized constant if
631 //! the new element is inserted just before hint.
632 template <class M>
633 BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
634 { return this->base_t::insert_or_assign(hint, ::boost::move(k), ::boost::forward<M>(obj)); }
635
636 //! <b>Returns</b>: A reference to the element whose key is equivalent to x.
637 //! Throws: An exception object of type out_of_range if no such element is present.
638 //! <b>Complexity</b>: logarithmic.
639 T& at(const key_type& k)
640 {
641 iterator i = this->find(k);
642 if(i == this->end()){
643 throw_out_of_range("map::at key not found");
644 }
645 return i->second;
646 }
647
648 //! <b>Returns</b>: A reference to the element whose key is equivalent to x.
649 //! Throws: An exception object of type out_of_range if no such element is present.
650 //! <b>Complexity</b>: logarithmic.
651 const T& at(const key_type& k) const
652 {
653 const_iterator i = this->find(k);
654 if(i == this->end()){
655 throw_out_of_range("map::at key not found");
656 }
657 return i->second;
658 }
659
660 //////////////////////////////////////////////
661 //
662 // modifiers
663 //
664 //////////////////////////////////////////////
665
666 //! <b>Effects</b>: Inserts x if and only if there is no element in the container
667 //! with key equivalent to the key of x.
668 //!
669 //! <b>Returns</b>: The bool component of the returned pair is true if and only
670 //! if the insertion takes place, and the iterator component of the pair
671 //! points to the element with key equivalent to the key of x.
672 //!
673 //! <b>Complexity</b>: Logarithmic.
674 BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(const value_type& x)
675 { return this->base_t::insert_unique(x); }
676
677 //! <b>Effects</b>: Inserts a new value_type created from the pair if and only if
678 //! there is no element in the container with key equivalent to the key of x.
679 //!
680 //! <b>Returns</b>: The bool component of the returned pair is true if and only
681 //! if the insertion takes place, and the iterator component of the pair
682 //! points to the element with key equivalent to the key of x.
683 //!
684 //! <b>Complexity</b>: Logarithmic.
685 BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(const nonconst_value_type& x)
686 { return this->try_emplace(x.first, x.second); }
687
688 //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
689 //! only if there is no element in the container with key equivalent to the key of x.
690 //!
691 //! <b>Returns</b>: The bool component of the returned pair is true if and only
692 //! if the insertion takes place, and the iterator component of the pair
693 //! points to the element with key equivalent to the key of x.
694 //!
695 //! <b>Complexity</b>: Logarithmic.
696 BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(BOOST_RV_REF(nonconst_value_type) x)
697 { return this->try_emplace(boost::move(x.first), boost::move(x.second)); }
698
699 //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
700 //! only if there is no element in the container with key equivalent to the key of x.
701 //!
702 //! <b>Returns</b>: The bool component of the returned pair is true if and only
703 //! if the insertion takes place, and the iterator component of the pair
704 //! points to the element with key equivalent to the key of x.
705 //!
706 //! <b>Complexity</b>: Logarithmic.
707 BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(BOOST_RV_REF(movable_value_type) x)
708 { return this->try_emplace(boost::move(x.first), boost::move(x.second)); }
709
710 //! <b>Effects</b>: Move constructs a new value from x if and only if there is
711 //! no element in the container with key equivalent to the key of x.
712 //!
713 //! <b>Returns</b>: The bool component of the returned pair is true if and only
714 //! if the insertion takes place, and the iterator component of the pair
715 //! points to the element with key equivalent to the key of x.
716 //!
717 //! <b>Complexity</b>: Logarithmic.
718 BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
719 { return this->base_t::insert_unique(boost::move(x)); }
720
721 //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
722 //! no element in the container with key equivalent to the key of x.
723 //! p is a hint pointing to where the insert should start to search.
724 //!
725 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
726 //! to the key of x.
727 //!
728 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
729 //! is inserted right before p.
730 BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const value_type& x)
731 { return this->base_t::insert_unique(p, x); }
732
733 //! <b>Effects</b>: Move constructs a new value from x if and only if there is
734 //! no element in the container with key equivalent to the key of x.
735 //! p is a hint pointing to where the insert should start to search.
736 //!
737 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
738 //! to the key of x.
739 //!
740 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
741 //! is inserted right before p.
742 BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x)
743 { return this->try_emplace(p, boost::move(x.first), boost::move(x.second)); }
744
745 //! <b>Effects</b>: Move constructs a new value from x if and only if there is
746 //! no element in the container with key equivalent to the key of x.
747 //! p is a hint pointing to where the insert should start to search.
748 //!
749 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
750 //! to the key of x.
751 //!
752 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
753 //! is inserted right before p.
754 BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x)
755 { return this->try_emplace(p, boost::move(x.first), boost::move(x.second)); }
756
757 //! <b>Effects</b>: Inserts a copy of x in the container.
758 //! p is a hint pointing to where the insert should start to search.
759 //!
760 //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
761 //!
762 //! <b>Complexity</b>: Logarithmic.
763 iterator insert(const_iterator p, const nonconst_value_type& x)
764 { return this->try_emplace(p, x.first, x.second); }
765
766 //! <b>Effects</b>: Inserts an element move constructed from x in the container.
767 //! p is a hint pointing to where the insert should start to search.
768 //!
769 //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
770 //!
771 //! <b>Complexity</b>: Logarithmic.
772 BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
773 { return this->base_t::insert_unique(p, boost::move(x)); }
774
775 //! <b>Requires</b>: first, last are not iterators into *this.
776 //!
777 //! <b>Effects</b>: inserts each element from the range [first,last) if and only
778 //! if there is no element with key equivalent to the key of that element.
779 //!
780 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
781 template <class InputIterator>
782 BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
783 { this->base_t::insert_unique(first, last); }
784
785 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
786 //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only
787 //! if there is no element with key equivalent to the key of that element.
788 //!
789 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from il.begin() to il.end())
790 BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
791 { this->base_t::insert_unique(il.begin(), il.end()); }
792 #endif
793
794 //! <b>Requires</b>: nh is empty or this->get_allocator() == nh.get_allocator().
795 //!
796 //! <b>Effects</b>: If nh is empty, has no effect. Otherwise, inserts the element owned
797 //! by nh if and only if there is no element in the container with a key equivalent to nh.key().
798 //!
799 //! <b>Returns</b>: If nh is empty, insert_return_type.inserted is false, insert_return_type.position
800 //! is end(), and insert_return_type.node is empty. Otherwise if the insertion took place,
801 //! insert_return_type.inserted is true, insert_return_type.position points to the inserted element,
802 //! and insert_return_type.node is empty; if the insertion failed, insert_return_type.inserted is
803 //! false, insert_return_type.node has the previous value of nh, and insert_return_type.position
804 //! points to an element with a key equivalent to nh.key().
805 //!
806 //! <b>Complexity</b>: Logarithmic
807 insert_return_type insert(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh)
808 {
809 typename base_t::node_type n(boost::move(nh));
810 typename base_t::insert_return_type base_ret(this->base_t::insert_unique_node(boost::move(n)));
811 return insert_return_type (base_ret.inserted, base_ret.position, boost::move(base_ret.node));
812 }
813
814 //! <b>Effects</b>: Same as `insert(node_type && nh)` but the element is inserted as close as possible
815 //! to the position just prior to "hint".
816 //!
817 //! <b>Complexity</b>: logarithmic in general, but amortized constant if the element is inserted
818 //! right before "hint".
819 insert_return_type insert(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh)
820 {
821 typename base_t::node_type n(boost::move(nh));
822 typename base_t::insert_return_type base_ret(this->base_t::insert_unique_node(hint, boost::move(n)));
823 return insert_return_type (base_ret.inserted, base_ret.position, boost::move(base_ret.node));
824 }
825
826 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
827
828 //! <b>Effects</b>: Inserts an object x of type T constructed with
829 //! std::forward<Args>(args)... in the container if and only if there is
830 //! no element in the container with an equivalent key.
831 //! p is a hint pointing to where the insert should start to search.
832 //!
833 //! <b>Returns</b>: The bool component of the returned pair is true if and only
834 //! if the insertion takes place, and the iterator component of the pair
835 //! points to the element with key equivalent to the key of x.
836 //!
837 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
838 //! is inserted right before p.
839 template <class... Args>
840 BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... args)
841 { return this->base_t::emplace_unique(boost::forward<Args>(args)...); }
842
843 //! <b>Effects</b>: Inserts an object of type T constructed with
844 //! std::forward<Args>(args)... in the container if and only if there is
845 //! no element in the container with an equivalent key.
846 //! p is a hint pointing to where the insert should start to search.
847 //!
848 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
849 //! to the key of x.
850 //!
851 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
852 //! is inserted right before p.
853 template <class... Args>
854 BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
855 { return this->base_t::emplace_hint_unique(p, boost::forward<Args>(args)...); }
856
857 //! <b>Requires</b>: value_type shall be EmplaceConstructible into map from piecewise_construct,
858 //! forward_as_tuple(k), forward_as_tuple(forward<Args>(args)...).
859 //!
860 //! <b>Effects</b>: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise
861 //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(k),
862 //! forward_as_tuple(forward<Args>(args)...).
863 //!
864 //! <b>Returns</b>: The bool component of the returned pair is true if and only if the
865 //! insertion took place. The returned iterator points to the map element whose key is equivalent to k.
866 //!
867 //! <b>Complexity</b>: Logarithmic.
868 template <class... Args>
869 BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> try_emplace(const key_type& k, BOOST_FWD_REF(Args)... args)
870 { return this->base_t::try_emplace(const_iterator(), k, boost::forward<Args>(args)...); }
871
872 //! <b>Requires</b>: value_type shall be EmplaceConstructible into map from piecewise_construct,
873 //! forward_as_tuple(k), forward_as_tuple(forward<Args>(args)...).
874 //!
875 //! <b>Effects</b>: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise
876 //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(k),
877 //! forward_as_tuple(forward<Args>(args)...).
878 //!
879 //! <b>Returns</b>: The returned iterator points to the map element whose key is equivalent to k.
880 //!
881 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if value
882 //! is inserted right before p.
883 template <class... Args>
884 BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, const key_type &k, BOOST_FWD_REF(Args)... args)
885 { return this->base_t::try_emplace(hint, k, boost::forward<Args>(args)...).first; }
886
887 //! <b>Requires</b>: value_type shall be EmplaceConstructible into map from piecewise_construct,
888 //! forward_as_tuple(move(k)), forward_as_tuple(forward<Args>(args)...).
889 //!
890 //! <b>Effects</b>: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise
891 //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(move(k)),
892 //! forward_as_tuple(forward<Args>(args)...).
893 //!
894 //! <b>Returns</b>: The bool component of the returned pair is true if and only if the
895 //! insertion took place. The returned iterator points to the map element whose key is equivalent to k.
896 //!
897 //! <b>Complexity</b>: Logarithmic.
898 template <class... Args>
899 BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> try_emplace(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args)
900 { return this->base_t::try_emplace(const_iterator(), boost::move(k), boost::forward<Args>(args)...); }
901
902 //! <b>Requires</b>: value_type shall be EmplaceConstructible into map from piecewise_construct,
903 //! forward_as_tuple(move(k)), forward_as_tuple(forward<Args>(args)...).
904 //!
905 //! <b>Effects</b>: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise
906 //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(move(k)),
907 //! forward_as_tuple(forward<Args>(args)...).
908 //!
909 //! <b>Returns</b>: The returned iterator points to the map element whose key is equivalent to k.
910 //!
911 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if value
912 //! is inserted right before p.
913 template <class... Args>
914 BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args)
915 { return this->base_t::try_emplace(hint, boost::move(k), boost::forward<Args>(args)...).first; }
916
917 #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
918
919 #define BOOST_CONTAINER_MAP_EMPLACE_CODE(N) \
920 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
921 BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##N)\
922 { return this->base_t::emplace_unique(BOOST_MOVE_FWD##N); }\
923 \
924 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
925 BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
926 { return this->base_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
927 \
928 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
929 BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> try_emplace(const key_type& k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
930 { return this->base_t::try_emplace(const_iterator(), k BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
931 \
932 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
933 BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, const key_type &k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
934 { return this->base_t::try_emplace(hint, k BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first; }\
935 \
936 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
937 BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> try_emplace(BOOST_RV_REF(key_type) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
938 { return this->base_t::try_emplace(const_iterator(), boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
939 \
940 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
941 BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
942 { return this->base_t::try_emplace(hint, boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first; }\
943 //
944 BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_MAP_EMPLACE_CODE)
945 #undef BOOST_CONTAINER_MAP_EMPLACE_CODE
946
947 #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
948
949 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
950
951 //! <b>Effects</b>: Erases the element pointed to by p.
952 //!
953 //! <b>Returns</b>: Returns an iterator pointing to the element immediately
954 //! following q prior to the element being erased. If no such element exists,
955 //! returns end().
956 //!
957 //! <b>Complexity</b>: Amortized constant time
958 iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW;
959
960 //! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
961 //!
962 //! <b>Returns</b>: Returns the number of erased elements.
963 //!
964 //! <b>Complexity</b>: log(size()) + count(k)
965 size_type erase(const key_type& x) BOOST_NOEXCEPT_OR_NOTHROW;
966
967 //! <b>Effects</b>: Erases all the elements in the range [first, last).
968 //!
969 //! <b>Returns</b>: Returns last.
970 //!
971 //! <b>Complexity</b>: log(size())+N where N is the distance from first to last.
972 iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW;
973
974 #endif
975
976 //! <b>Effects</b>: Removes the first element in the container with key equivalent to k.
977 //!
978 //! <b>Returns</b>: A node_type owning the element if found, otherwise an empty node_type.
979 //!
980 //! <b>Complexity</b>: log(a.size()).
981 node_type extract(const key_type& k)
982 {
983 typename base_t::node_type base_nh(this->base_t::extract(k));
984 node_type nh(boost::move(base_nh));
985 return BOOST_MOVE_RET(node_type, nh);
986 }
987
988 //! <b>Effects</b>: Removes the element pointed to by "position".
989 //!
990 //! <b>Returns</b>: A node_type owning the element, otherwise an empty node_type.
991 //!
992 //! <b>Complexity</b>: Amortized constant.
993 node_type extract(const_iterator position)
994 {
995 typename base_t::node_type base_nh(this->base_t::extract(position));
996 node_type nh(boost::move(base_nh));
997 return BOOST_MOVE_RET(node_type, nh);
998 }
999
1000 //! <b>Requires</b>: this->get_allocator() == source.get_allocator().
1001 //!
1002 //! <b>Effects</b>: Attempts to extract each element in source and insert it into a using
1003 //! the comparison object of *this. If there is an element in a with key equivalent to the
1004 //! key of an element from source, then that element is not extracted from source.
1005 //!
1006 //! <b>Postcondition</b>: Pointers and references to the transferred elements of source refer
1007 //! to those same elements but as members of *this. Iterators referring to the transferred
1008 //! elements will continue to refer to their elements, but they now behave as iterators into *this,
1009 //! not into source.
1010 //!
1011 //! <b>Throws</b>: Nothing unless the comparison object throws.
1012 //!
1013 //! <b>Complexity</b>: N log(a.size() + N) (N has the value source.size())
1014 template<class C2>
1015 BOOST_CONTAINER_FORCEINLINE void merge(map<Key, T, C2, Allocator, Options>& source)
1016 {
1017 typedef container_detail::tree
1018 <value_type_impl, select_1st_t, C2, Allocator, Options> base2_t;
1019 this->merge_unique(static_cast<base2_t&>(source));
1020 }
1021
1022 //! @copydoc ::boost::container::map::merge(map<Key, T, C2, Allocator, Options>&)
1023 template<class C2>
1024 BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG map<Key, T, C2, Allocator, Options> BOOST_RV_REF_END source)
1025 { return this->merge(static_cast<map<Key, T, C2, Allocator, Options>&>(source)); }
1026
1027 //! @copydoc ::boost::container::map::merge(map<Key, T, C2, Allocator, Options>&)
1028 template<class C2>
1029 BOOST_CONTAINER_FORCEINLINE void merge(multimap<Key, T, C2, Allocator, Options>& source)
1030 {
1031 typedef container_detail::tree
1032 <value_type_impl, select_1st_t, C2, Allocator, Options> base2_t;
1033 this->base_t::merge_unique(static_cast<base2_t&>(source));
1034 }
1035
1036 //! @copydoc ::boost::container::map::merge(map<Key, T, C2, Allocator, Options>&)
1037 template<class C2>
1038 BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG multimap<Key, T, C2, Allocator, Options> BOOST_RV_REF_END source)
1039 { return this->merge(static_cast<multimap<Key, T, C2, Allocator, Options>&>(source)); }
1040
1041 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
1042 //! <b>Effects</b>: Swaps the contents of *this and x.
1043 //!
1044 //! <b>Throws</b>: Nothing.
1045 //!
1046 //! <b>Complexity</b>: Constant.
1047 void swap(map& x)
1048 BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
1049 && boost::container::container_detail::is_nothrow_swappable<Compare>::value )
1050
1051 //! <b>Effects</b>: erase(a.begin(),a.end()).
1052 //!
1053 //! <b>Postcondition</b>: size() == 0.
1054 //!
1055 //! <b>Complexity</b>: linear in size().
1056 void clear() BOOST_NOEXCEPT_OR_NOTHROW;
1057
1058 //! <b>Effects</b>: Returns the comparison object out
1059 //! of which a was constructed.
1060 //!
1061 //! <b>Complexity</b>: Constant.
1062 key_compare key_comp() const;
1063
1064 //! <b>Effects</b>: Returns an object of value_compare constructed out
1065 //! of the comparison object.
1066 //!
1067 //! <b>Complexity</b>: Constant.
1068 value_compare value_comp() const;
1069
1070 //! <b>Returns</b>: An iterator pointing to an element with the key
1071 //! equivalent to x, or end() if such an element is not found.
1072 //!
1073 //! <b>Complexity</b>: Logarithmic.
1074 iterator find(const key_type& x);
1075
1076 //! <b>Returns</b>: A const_iterator pointing to an element with the key
1077 //! equivalent to x, or end() if such an element is not found.
1078 //!
1079 //! <b>Complexity</b>: Logarithmic.
1080 const_iterator find(const key_type& x) const;
1081
1082 #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
1083
1084 //! <b>Returns</b>: The number of elements with key equivalent to x.
1085 //!
1086 //! <b>Complexity</b>: log(size())+count(k)
1087 BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const
1088 { return static_cast<size_type>(this->find(x) != this->cend()); }
1089
1090 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
1091
1092 //! <b>Returns</b>: An iterator pointing to the first element with key not less
1093 //! than k, or a.end() if such an element is not found.
1094 //!
1095 //! <b>Complexity</b>: Logarithmic
1096 iterator lower_bound(const key_type& x);
1097
1098 //! <b>Returns</b>: A const iterator pointing to the first element with key not
1099 //! less than k, or a.end() if such an element is not found.
1100 //!
1101 //! <b>Complexity</b>: Logarithmic
1102 const_iterator lower_bound(const key_type& x) const;
1103
1104 //! <b>Returns</b>: An iterator pointing to the first element with key not less
1105 //! than x, or end() if such an element is not found.
1106 //!
1107 //! <b>Complexity</b>: Logarithmic
1108 iterator upper_bound(const key_type& x);
1109
1110 //! <b>Returns</b>: A const iterator pointing to the first element with key not
1111 //! less than x, or end() if such an element is not found.
1112 //!
1113 //! <b>Complexity</b>: Logarithmic
1114 const_iterator upper_bound(const key_type& x) const;
1115
1116 //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
1117 //!
1118 //! <b>Complexity</b>: Logarithmic
1119 std::pair<iterator,iterator> equal_range(const key_type& x);
1120
1121 //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
1122 //!
1123 //! <b>Complexity</b>: Logarithmic
1124 std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const;
1125
1126 //! <b>Effects</b>: Rebalances the tree. It's a no-op for Red-Black and AVL trees.
1127 //!
1128 //! <b>Complexity</b>: Linear
1129 void rebalance();
1130
1131 //! <b>Effects</b>: Returns true if x and y are equal
1132 //!
1133 //! <b>Complexity</b>: Linear to the number of elements in the container.
1134 friend bool operator==(const map& x, const map& y);
1135
1136 //! <b>Effects</b>: Returns true if x and y are unequal
1137 //!
1138 //! <b>Complexity</b>: Linear to the number of elements in the container.
1139 friend bool operator!=(const map& x, const map& y);
1140
1141 //! <b>Effects</b>: Returns true if x is less than y
1142 //!
1143 //! <b>Complexity</b>: Linear to the number of elements in the container.
1144 friend bool operator<(const map& x, const map& y);
1145
1146 //! <b>Effects</b>: Returns true if x is greater than y
1147 //!
1148 //! <b>Complexity</b>: Linear to the number of elements in the container.
1149 friend bool operator>(const map& x, const map& y);
1150
1151 //! <b>Effects</b>: Returns true if x is equal or less than y
1152 //!
1153 //! <b>Complexity</b>: Linear to the number of elements in the container.
1154 friend bool operator<=(const map& x, const map& y);
1155
1156 //! <b>Effects</b>: Returns true if x is equal or greater than y
1157 //!
1158 //! <b>Complexity</b>: Linear to the number of elements in the container.
1159 friend bool operator>=(const map& x, const map& y);
1160
1161 //! <b>Effects</b>: x.swap(y)
1162 //!
1163 //! <b>Complexity</b>: Constant.
1164 friend void swap(map& x, map& y);
1165
1166 #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
1167
1168 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
1169 private:
1170 template<class KeyConvertible>
1171 BOOST_CONTAINER_FORCEINLINE mapped_type& priv_subscript(BOOST_FWD_REF(KeyConvertible) k)
1172 {
1173 return this->try_emplace(boost::forward<KeyConvertible>(k)).first->second;
1174 }
1175 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
1176 };
1177
1178
1179 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
1180
1181 } //namespace container {
1182
1183 //!has_trivial_destructor_after_move<> == true_type
1184 //!specialization for optimizations
1185 template <class Key, class T, class Compare, class Allocator>
1186 struct has_trivial_destructor_after_move<boost::container::map<Key, T, Compare, Allocator> >
1187 {
1188 typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
1189 static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
1190 ::boost::has_trivial_destructor_after_move<pointer>::value &&
1191 ::boost::has_trivial_destructor_after_move<Compare>::value;
1192 };
1193
1194 namespace container {
1195
1196 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
1197
1198 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
1199
1200 //! A multimap is a kind of associative container that supports equivalent keys
1201 //! (possibly containing multiple copies of the same key value) and provides for
1202 //! fast retrieval of values of another type T based on the keys. The multimap class
1203 //! supports bidirectional iterators.
1204 //!
1205 //! A multimap satisfies all of the requirements of a container and of a reversible
1206 //! container and of an associative container. The <code>value_type</code> stored
1207 //! by this container is the value_type is std::pair<const Key, T>.
1208 //!
1209 //! \tparam Key is the key_type of the map
1210 //! \tparam Value is the <code>mapped_type</code>
1211 //! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
1212 //! \tparam Allocator is the allocator to allocate the <code>value_type</code>s
1213 //! (e.g. <i>allocator< std::pair<const Key, T> > </i>).
1214 //! \tparam Options is an packed option type generated using using boost::container::tree_assoc_options.
1215 template < class Key, class T, class Compare = std::less<Key>
1216 , class Allocator = new_allocator< std::pair< const Key, T> >, class Options = tree_assoc_defaults>
1217 #else
1218 template <class Key, class T, class Compare, class Allocator, class Options>
1219 #endif
1220 class multimap
1221 ///@cond
1222 : public container_detail::tree
1223 < std::pair<const Key, T>
1224 , container_detail::select1st<Key>
1225 , Compare, Allocator, Options>
1226 ///@endcond
1227 {
1228 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
1229 private:
1230 BOOST_COPYABLE_AND_MOVABLE(multimap)
1231
1232 typedef container_detail::select1st<Key> select_1st_t;
1233 typedef std::pair<const Key, T> value_type_impl;
1234 typedef container_detail::tree
1235 <value_type_impl, select_1st_t, Compare, Allocator, Options> base_t;
1236 typedef container_detail::pair <Key, T> movable_value_type_impl;
1237 typedef typename base_t::value_compare value_compare_impl;
1238 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
1239
1240 typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
1241
1242 public:
1243 //////////////////////////////////////////////
1244 //
1245 // types
1246 //
1247 //////////////////////////////////////////////
1248
1249 typedef Key key_type;
1250 typedef T mapped_type;
1251 typedef typename boost::container::allocator_traits<Allocator>::value_type value_type;
1252 typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
1253 typedef typename boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
1254 typedef typename boost::container::allocator_traits<Allocator>::reference reference;
1255 typedef typename boost::container::allocator_traits<Allocator>::const_reference const_reference;
1256 typedef typename boost::container::allocator_traits<Allocator>::size_type size_type;
1257 typedef typename boost::container::allocator_traits<Allocator>::difference_type difference_type;
1258 typedef Allocator allocator_type;
1259 typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
1260 typedef BOOST_CONTAINER_IMPDEF(value_compare_impl) value_compare;
1261 typedef Compare key_compare;
1262 typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator;
1263 typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator;
1264 typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator;
1265 typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator;
1266 typedef std::pair<key_type, mapped_type> nonconst_value_type;
1267 typedef BOOST_CONTAINER_IMPDEF(movable_value_type_impl) movable_value_type;
1268 typedef BOOST_CONTAINER_IMPDEF(node_handle<
1269 typename base_t::stored_allocator_type
1270 BOOST_MOVE_I pair_key_mapped_of_value
1271 <key_type BOOST_MOVE_I mapped_type> >) node_type;
1272
1273 //allocator_type::value_type type must be std::pair<CONST Key, T>
1274 BOOST_STATIC_ASSERT((container_detail::is_same<typename allocator_type::value_type, std::pair<const Key, T> >::value));
1275
1276 //////////////////////////////////////////////
1277 //
1278 // construct/copy/destroy
1279 //
1280 //////////////////////////////////////////////
1281
1282 //! <b>Effects</b>: Default constructs an empty multimap.
1283 //!
1284 //! <b>Complexity</b>: Constant.
1285 BOOST_CONTAINER_FORCEINLINE multimap()
1286 BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
1287 container_detail::is_nothrow_default_constructible<Compare>::value)
1288 : base_t()
1289 {}
1290
1291 //! <b>Effects</b>: Constructs an empty multimap using the specified allocator
1292 //! object and allocator.
1293 //!
1294 //! <b>Complexity</b>: Constant.
1295 BOOST_CONTAINER_FORCEINLINE explicit multimap(const allocator_type& a)
1296 : base_t(a)
1297 {}
1298
1299 //! <b>Effects</b>: Constructs an empty multimap using the specified comparison.
1300 //!
1301 //! <b>Complexity</b>: Constant.
1302 BOOST_CONTAINER_FORCEINLINE explicit multimap(const Compare& comp)
1303 : base_t(comp)
1304 {}
1305
1306 //! <b>Effects</b>: Constructs an empty multimap using the specified comparison and allocator.
1307 //!
1308 //! <b>Complexity</b>: Constant.
1309 BOOST_CONTAINER_FORCEINLINE multimap(const Compare& comp, const allocator_type& a)
1310 : base_t(comp, a)
1311 {}
1312
1313 //! <b>Effects</b>: Constructs an empty multimap and
1314 //! inserts elements from the range [first ,last ).
1315 //!
1316 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
1317 //! the predicate and otherwise N logN, where N is last - first.
1318 template <class InputIterator>
1319 BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last)
1320 : base_t(false, first, last)
1321 {}
1322
1323 //! <b>Effects</b>: Constructs an empty multimap using the specified
1324 //! allocator, and inserts elements from the range [first ,last ).
1325 //!
1326 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
1327 //! the predicate and otherwise N logN, where N is last - first.
1328 template <class InputIterator>
1329 BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last, const allocator_type& a)
1330 : base_t(false, first, last, Compare(), a)
1331 {}
1332
1333 //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
1334 //! inserts elements from the range [first ,last ).
1335 //!
1336 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
1337 //! the predicate and otherwise N logN, where N is last - first.
1338 template <class InputIterator>
1339 BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last, const Compare& comp)
1340 : base_t(false, first, last, comp)
1341 {}
1342
1343 //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object
1344 //! and allocator, and inserts elements from the range [first ,last ).
1345 //!
1346 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
1347 //! the predicate and otherwise N logN, where N is last - first.
1348 template <class InputIterator>
1349 BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last,
1350 const Compare& comp, const allocator_type& a)
1351 : base_t(false, first, last, comp, a)
1352 {}
1353
1354 //! <b>Effects</b>: Constructs an empty multimap and
1355 //! inserts elements from the ordered range [first ,last). This function
1356 //! is more efficient than the normal range creation for ordered ranges.
1357 //!
1358 //! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
1359 //!
1360 //! <b>Complexity</b>: Linear in N.
1361 //!
1362 //! <b>Note</b>: Non-standard extension.
1363 template <class InputIterator>
1364 BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, InputIterator first, InputIterator last)
1365 : base_t(ordered_range, first, last)
1366 {}
1367
1368 //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
1369 //! inserts elements from the ordered range [first ,last). This function
1370 //! is more efficient than the normal range creation for ordered ranges.
1371 //!
1372 //! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
1373 //!
1374 //! <b>Complexity</b>: Linear in N.
1375 //!
1376 //! <b>Note</b>: Non-standard extension.
1377 template <class InputIterator>
1378 BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp)
1379 : base_t(ordered_range, first, last, comp)
1380 {}
1381
1382 //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
1383 //! allocator, and inserts elements from the ordered range [first ,last). This function
1384 //! is more efficient than the normal range creation for ordered ranges.
1385 //!
1386 //! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
1387 //!
1388 //! <b>Complexity</b>: Linear in N.
1389 //!
1390 //! <b>Note</b>: Non-standard extension.
1391 template <class InputIterator>
1392 BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp,
1393 const allocator_type& a)
1394 : base_t(ordered_range, first, last, comp, a)
1395 {}
1396
1397 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
1398 //! <b>Effects</b>: Constructs an empty multimap and
1399 //! and inserts elements from the range [il.begin(), il.end()).
1400 //!
1401 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
1402 //! the predicate and otherwise N logN, where N is il.first() - il.end().
1403 BOOST_CONTAINER_FORCEINLINE multimap(std::initializer_list<value_type> il)
1404 : base_t(false, il.begin(), il.end())
1405 {}
1406
1407 //! <b>Effects</b>: Constructs an empty multimap using the specified
1408 //! allocator, and inserts elements from the range [il.begin(), il.end()).
1409 //!
1410 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
1411 //! the predicate and otherwise N logN, where N is il.first() - il.end().
1412 BOOST_CONTAINER_FORCEINLINE multimap(std::initializer_list<value_type> il, const allocator_type& a)
1413 : base_t(false, il.begin(), il.end(), Compare(), a)
1414 {}
1415
1416 //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
1417 //! inserts elements from the range [il.begin(), il.end()).
1418 //!
1419 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
1420 //! the predicate and otherwise N logN, where N is il.first() - il.end().
1421 BOOST_CONTAINER_FORCEINLINE multimap(std::initializer_list<value_type> il, const Compare& comp)
1422 : base_t(false, il.begin(), il.end(), comp)
1423 {}
1424
1425 //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
1426 //! allocator, and inserts elements from the range [il.begin(), il.end()).
1427 //!
1428 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
1429 //! the predicate and otherwise N logN, where N is il.first() - il.end().
1430 BOOST_CONTAINER_FORCEINLINE multimap(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
1431 : base_t(false, il.begin(), il.end(), comp, a)
1432 {}
1433
1434
1435 //! <b>Effects</b>: Constructs an empty map and
1436 //! inserts elements from the ordered range [il.begin(), il.end()). This function
1437 //! is more efficient than the normal range creation for ordered ranges.
1438 //!
1439 //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
1440 //!
1441 //! <b>Complexity</b>: Linear in N.
1442 //!
1443 //! <b>Note</b>: Non-standard extension.
1444 BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, std::initializer_list<value_type> il)
1445 : base_t(ordered_range, il.begin(), il.end())
1446 {}
1447
1448 //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
1449 //! inserts elements from the ordered range [il.begin(), il.end()). This function
1450 //! is more efficient than the normal range creation for ordered ranges.
1451 //!
1452 //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
1453 //!
1454 //! <b>Complexity</b>: Linear in N.
1455 //!
1456 //! <b>Note</b>: Non-standard extension.
1457 BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp)
1458 : base_t(ordered_range, il.begin(), il.end(), comp)
1459 {}
1460
1461 //! <b>Effects</b>: Constructs an empty map and
1462 //! inserts elements from the ordered range [il.begin(), il.end()). This function
1463 //! is more efficient than the normal range creation for ordered ranges.
1464 //!
1465 //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
1466 //!
1467 //! <b>Complexity</b>: Linear in N.
1468 //!
1469 //! <b>Note</b>: Non-standard extension.
1470 BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
1471 : base_t(ordered_range, il.begin(), il.end(), comp, a)
1472 {}
1473
1474 #endif
1475
1476 //! <b>Effects</b>: Copy constructs a multimap.
1477 //!
1478 //! <b>Complexity</b>: Linear in x.size().
1479 BOOST_CONTAINER_FORCEINLINE multimap(const multimap& x)
1480 : base_t(static_cast<const base_t&>(x))
1481 {}
1482
1483 //! <b>Effects</b>: Move constructs a multimap. Constructs *this using x's resources.
1484 //!
1485 //! <b>Complexity</b>: Constant.
1486 //!
1487 //! <b>Postcondition</b>: x is emptied.
1488 BOOST_CONTAINER_FORCEINLINE multimap(BOOST_RV_REF(multimap) x)
1489 BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
1490 : base_t(BOOST_MOVE_BASE(base_t, x))
1491 {}
1492
1493 //! <b>Effects</b>: Copy constructs a multimap.
1494 //!
1495 //! <b>Complexity</b>: Linear in x.size().
1496 BOOST_CONTAINER_FORCEINLINE multimap(const multimap& x, const allocator_type &a)
1497 : base_t(static_cast<const base_t&>(x), a)
1498 {}
1499
1500 //! <b>Effects</b>: Move constructs a multimap using the specified allocator.
1501 //! Constructs *this using x's resources.
1502 //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
1503 //!
1504 //! <b>Postcondition</b>: x is emptied.
1505 BOOST_CONTAINER_FORCEINLINE multimap(BOOST_RV_REF(multimap) x, const allocator_type &a)
1506 : base_t(BOOST_MOVE_BASE(base_t, x), a)
1507 {}
1508
1509 //! <b>Effects</b>: Makes *this a copy of x.
1510 //!
1511 //! <b>Complexity</b>: Linear in x.size().
1512 BOOST_CONTAINER_FORCEINLINE multimap& operator=(BOOST_COPY_ASSIGN_REF(multimap) x)
1513 { return static_cast<multimap&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
1514
1515 //! <b>Effects</b>: this->swap(x.get()).
1516 //!
1517 //! <b>Complexity</b>: Constant.
1518 BOOST_CONTAINER_FORCEINLINE multimap& operator=(BOOST_RV_REF(multimap) x)
1519 BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
1520 allocator_traits_type::is_always_equal::value) &&
1521 boost::container::container_detail::is_nothrow_move_assignable<Compare>::value)
1522 { return static_cast<multimap&>(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); }
1523
1524 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
1525 //! <b>Effects</b>: Assign content of il to *this.
1526 //!
1527 BOOST_CONTAINER_FORCEINLINE multimap& operator=(std::initializer_list<value_type> il)
1528 {
1529 this->clear();
1530 insert(il.begin(), il.end());
1531 return *this;
1532 }
1533 #endif
1534
1535 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
1536
1537 //! @copydoc ::boost::container::set::get_allocator()
1538 allocator_type get_allocator() const;
1539
1540 //! @copydoc ::boost::container::set::get_stored_allocator()
1541 stored_allocator_type &get_stored_allocator();
1542
1543 //! @copydoc ::boost::container::set::get_stored_allocator() const
1544 const stored_allocator_type &get_stored_allocator() const;
1545
1546 //! @copydoc ::boost::container::set::begin()
1547 iterator begin();
1548
1549 //! @copydoc ::boost::container::set::begin() const
1550 const_iterator begin() const;
1551
1552 //! @copydoc ::boost::container::set::cbegin() const
1553 const_iterator cbegin() const;
1554
1555 //! @copydoc ::boost::container::set::end()
1556 iterator end() BOOST_NOEXCEPT_OR_NOTHROW;
1557
1558 //! @copydoc ::boost::container::set::end() const
1559 const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW;
1560
1561 //! @copydoc ::boost::container::set::cend() const
1562 const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW;
1563
1564 //! @copydoc ::boost::container::set::rbegin()
1565 reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW;
1566
1567 //! @copydoc ::boost::container::set::rbegin() const
1568 const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
1569
1570 //! @copydoc ::boost::container::set::crbegin() const
1571 const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
1572
1573 //! @copydoc ::boost::container::set::rend()
1574 reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW;
1575
1576 //! @copydoc ::boost::container::set::rend() const
1577 const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW;
1578
1579 //! @copydoc ::boost::container::set::crend() const
1580 const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW;
1581
1582 //! @copydoc ::boost::container::set::empty() const
1583 bool empty() const;
1584
1585 //! @copydoc ::boost::container::set::size() const
1586 size_type size() const;
1587
1588 //! @copydoc ::boost::container::set::max_size() const
1589 size_type max_size() const;
1590
1591 #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
1592
1593 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
1594
1595 //! <b>Effects</b>: Inserts an object of type T constructed with
1596 //! std::forward<Args>(args)... in the container.
1597 //! p is a hint pointing to where the insert should start to search.
1598 //!
1599 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
1600 //! to the key of x.
1601 //!
1602 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
1603 //! is inserted right before p.
1604 template <class... Args>
1605 BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_FWD_REF(Args)... args)
1606 { return this->base_t::emplace_equal(boost::forward<Args>(args)...); }
1607
1608 //! <b>Effects</b>: Inserts an object of type T constructed with
1609 //! std::forward<Args>(args)... in the container.
1610 //! p is a hint pointing to where the insert should start to search.
1611 //!
1612 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
1613 //! to the key of x.
1614 //!
1615 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
1616 //! is inserted right before p.
1617 template <class... Args>
1618 BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
1619 { return this->base_t::emplace_hint_equal(p, boost::forward<Args>(args)...); }
1620
1621 #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
1622
1623 #define BOOST_CONTAINER_MULTIMAP_EMPLACE_CODE(N) \
1624 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
1625 BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\
1626 { return this->base_t::emplace_equal(BOOST_MOVE_FWD##N); }\
1627 \
1628 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
1629 BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
1630 { return this->base_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
1631 //
1632 BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_MULTIMAP_EMPLACE_CODE)
1633 #undef BOOST_CONTAINER_MULTIMAP_EMPLACE_CODE
1634
1635 #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
1636
1637 //! <b>Effects</b>: Inserts x and returns the iterator pointing to the
1638 //! newly inserted element.
1639 //!
1640 //! <b>Complexity</b>: Logarithmic.
1641 BOOST_CONTAINER_FORCEINLINE iterator insert(const value_type& x)
1642 { return this->base_t::insert_equal(x); }
1643
1644 //! <b>Effects</b>: Inserts a new value constructed from x and returns
1645 //! the iterator pointing to the newly inserted element.
1646 //!
1647 //! <b>Complexity</b>: Logarithmic.
1648 BOOST_CONTAINER_FORCEINLINE iterator insert(const nonconst_value_type& x)
1649 { return this->base_t::emplace_equal(x); }
1650
1651 //! <b>Effects</b>: Inserts a new value move-constructed from x and returns
1652 //! the iterator pointing to the newly inserted element.
1653 //!
1654 //! <b>Complexity</b>: Logarithmic.
1655 BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF(nonconst_value_type) x)
1656 { return this->base_t::emplace_equal(boost::move(x)); }
1657
1658 //! <b>Effects</b>: Inserts a new value move-constructed from x and returns
1659 //! the iterator pointing to the newly inserted element.
1660 //!
1661 //! <b>Complexity</b>: Logarithmic.
1662 iterator insert(BOOST_RV_REF(movable_value_type) x)
1663 { return this->base_t::emplace_equal(boost::move(x)); }
1664
1665 //! <b>Effects</b>: Inserts a copy of x in the container.
1666 //! p is a hint pointing to where the insert should start to search.
1667 //!
1668 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
1669 //! to the key of x.
1670 //!
1671 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
1672 //! is inserted right before p.
1673 BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const value_type& x)
1674 { return this->base_t::insert_equal(p, x); }
1675
1676 //! <b>Effects</b>: Inserts a new value constructed from x in the container.
1677 //! p is a hint pointing to where the insert should start to search.
1678 //!
1679 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
1680 //! to the key of x.
1681 //!
1682 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
1683 //! is inserted right before p.
1684 BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const nonconst_value_type& x)
1685 { return this->base_t::emplace_hint_equal(p, x); }
1686
1687 //! <b>Effects</b>: Inserts a new value move constructed from x in the container.
1688 //! p is a hint pointing to where the insert should start to search.
1689 //!
1690 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
1691 //! to the key of x.
1692 //!
1693 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
1694 //! is inserted right before p.
1695 BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x)
1696 { return this->base_t::emplace_hint_equal(p, boost::move(x)); }
1697
1698 //! <b>Effects</b>: Inserts a new value move constructed from x in the container.
1699 //! p is a hint pointing to where the insert should start to search.
1700 //!
1701 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
1702 //! to the key of x.
1703 //!
1704 //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
1705 //! is inserted right before p.
1706 BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x)
1707 { return this->base_t::emplace_hint_equal(p, boost::move(x)); }
1708
1709 //! <b>Requires</b>: first, last are not iterators into *this.
1710 //!
1711 //! <b>Effects</b>: inserts each element from the range [first,last) .
1712 //!
1713 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
1714 template <class InputIterator>
1715 BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
1716 { this->base_t::insert_equal(first, last); }
1717
1718 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
1719 //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end().
1720 //!
1721 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from il.begin() to il.end())
1722 BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
1723 { this->base_t::insert_equal(il.begin(), il.end()); }
1724 #endif
1725
1726 //! <b>Requires</b>: nh is empty or this->get_allocator() == nh.get_allocator().
1727 //!
1728 //! <b>Effects/Returns</b>: If nh is empty, has no effect and returns end(). Otherwise, inserts
1729 //! the element owned by nh and returns an iterator pointing to the newly inserted element.
1730 //! If a range containing elements with keys equivalent to nh.key() exists,
1731 //! the element is inserted at the end of that range. nh is always emptied.
1732 //!
1733 //! <b>Complexity</b>: Logarithmic
1734 iterator insert(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh)
1735 {
1736 typename base_t::node_type n(boost::move(nh));
1737 return this->base_t::insert_equal_node(boost::move(n));
1738 }
1739
1740 //! <b>Effects</b>: Same as `insert(node_type && nh)` but the element is inserted as close as possible
1741 //! to the position just prior to "hint".
1742 //!
1743 //! <b>Complexity</b>: logarithmic in general, but amortized constant if the element is inserted
1744 //! right before "hint".
1745 iterator insert(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh)
1746 {
1747 typename base_t::node_type n(boost::move(nh));
1748 return this->base_t::insert_equal_node(hint, boost::move(n));
1749 }
1750
1751 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
1752
1753 //! @copydoc ::boost::container::set::erase(const_iterator)
1754 iterator erase(const_iterator p);
1755
1756 //! @copydoc ::boost::container::set::erase(const key_type&)
1757 size_type erase(const key_type& x);
1758
1759 //! @copydoc ::boost::container::set::erase(const_iterator,const_iterator)
1760 iterator erase(const_iterator first, const_iterator last);
1761 #endif
1762
1763 //! @copydoc ::boost::container::map::extract(const key_type&)
1764 node_type extract(const key_type& k)
1765 {
1766 typename base_t::node_type base_nh(this->base_t::extract(k));
1767 return node_type(boost::move(base_nh));
1768 }
1769
1770 //! @copydoc ::boost::container::map::extract(const_iterator)
1771 node_type extract(const_iterator position)
1772 {
1773 typename base_t::node_type base_nh(this->base_t::extract(position));
1774 return node_type (boost::move(base_nh));
1775 }
1776
1777 //! <b>Requires</b>: this->get_allocator() == source.get_allocator().
1778 //!
1779 //! <b>Effects</b>: Extracts each element in source and insert it into a using
1780 //! the comparison object of *this.
1781 //!
1782 //! <b>Postcondition</b>: Pointers and references to the transferred elements of source refer
1783 //! to those same elements but as members of *this. Iterators referring to the transferred
1784 //! elements will continue to refer to their elements, but they now behave as iterators into *this,
1785 //! not into source.
1786 //!
1787 //! <b>Throws</b>: Nothing unless the comparison object throws.
1788 //!
1789 //! <b>Complexity</b>: N log(a.size() + N) (N has the value source.size())
1790 template<class C2>
1791 BOOST_CONTAINER_FORCEINLINE void merge(multimap<Key, T, C2, Allocator, Options>& source)
1792 {
1793 typedef container_detail::tree
1794 <value_type_impl, select_1st_t, C2, Allocator, Options> base2_t;
1795 this->base_t::merge_equal(static_cast<base2_t&>(source));
1796 }
1797
1798 //! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&)
1799 template<class C2>
1800 BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG multimap<Key, T, C2, Allocator, Options> BOOST_RV_REF_END source)
1801 { return this->merge(static_cast<multimap<Key, T, C2, Allocator, Options>&>(source)); }
1802
1803 //! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&)
1804 template<class C2>
1805 BOOST_CONTAINER_FORCEINLINE void merge(map<Key, T, C2, Allocator, Options>& source)
1806 {
1807 typedef container_detail::tree
1808 <value_type_impl, select_1st_t, C2, Allocator, Options> base2_t;
1809 this->base_t::merge_equal(static_cast<base2_t&>(source));
1810 }
1811
1812 //! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&)
1813 template<class C2>
1814 BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG map<Key, T, C2, Allocator, Options> BOOST_RV_REF_END source)
1815 { return this->merge(static_cast<map<Key, T, C2, Allocator, Options>&>(source)); }
1816
1817 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
1818 //! @copydoc ::boost::container::set::swap
1819 void swap(multiset& x)
1820 BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
1821 && boost::container::container_detail::is_nothrow_swappable<Compare>::value );
1822
1823 //! @copydoc ::boost::container::set::clear
1824 void clear() BOOST_NOEXCEPT_OR_NOTHROW;
1825
1826 //! @copydoc ::boost::container::set::key_comp
1827 key_compare key_comp() const;
1828
1829 //! @copydoc ::boost::container::set::value_comp
1830 value_compare value_comp() const;
1831
1832 //! <b>Returns</b>: An iterator pointing to an element with the key
1833 //! equivalent to x, or end() if such an element is not found.
1834 //!
1835 //! <b>Complexity</b>: Logarithmic.
1836 iterator find(const key_type& x);
1837
1838 //! <b>Returns</b>: A const iterator pointing to an element with the key
1839 //! equivalent to x, or end() if such an element is not found.
1840 //!
1841 //! <b>Complexity</b>: Logarithmic.
1842 const_iterator find(const key_type& x) const;
1843
1844 //! <b>Returns</b>: The number of elements with key equivalent to x.
1845 //!
1846 //! <b>Complexity</b>: log(size())+count(k)
1847 size_type count(const key_type& x) const;
1848
1849 //! <b>Returns</b>: An iterator pointing to the first element with key not less
1850 //! than k, or a.end() if such an element is not found.
1851 //!
1852 //! <b>Complexity</b>: Logarithmic
1853 iterator lower_bound(const key_type& x);
1854
1855 //! <b>Returns</b>: A const iterator pointing to the first element with key not
1856 //! less than k, or a.end() if such an element is not found.
1857 //!
1858 //! <b>Complexity</b>: Logarithmic
1859 const_iterator lower_bound(const key_type& x) const;
1860
1861 //! <b>Returns</b>: An iterator pointing to the first element with key not less
1862 //! than x, or end() if such an element is not found.
1863 //!
1864 //! <b>Complexity</b>: Logarithmic
1865 iterator upper_bound(const key_type& x);
1866
1867 //! <b>Returns</b>: A const iterator pointing to the first element with key not
1868 //! less than x, or end() if such an element is not found.
1869 //!
1870 //! <b>Complexity</b>: Logarithmic
1871 const_iterator upper_bound(const key_type& x) const;
1872
1873 //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
1874 //!
1875 //! <b>Complexity</b>: Logarithmic
1876 std::pair<iterator,iterator> equal_range(const key_type& x);
1877
1878 //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
1879 //!
1880 //! <b>Complexity</b>: Logarithmic
1881 std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const;
1882
1883 //! <b>Effects</b>: Rebalances the tree. It's a no-op for Red-Black and AVL trees.
1884 //!
1885 //! <b>Complexity</b>: Linear
1886 void rebalance();
1887
1888 //! <b>Effects</b>: Returns true if x and y are equal
1889 //!
1890 //! <b>Complexity</b>: Linear to the number of elements in the container.
1891 friend bool operator==(const multimap& x, const multimap& y);
1892
1893 //! <b>Effects</b>: Returns true if x and y are unequal
1894 //!
1895 //! <b>Complexity</b>: Linear to the number of elements in the container.
1896 friend bool operator!=(const multimap& x, const multimap& y);
1897
1898 //! <b>Effects</b>: Returns true if x is less than y
1899 //!
1900 //! <b>Complexity</b>: Linear to the number of elements in the container.
1901 friend bool operator<(const multimap& x, const multimap& y);
1902
1903 //! <b>Effects</b>: Returns true if x is greater than y
1904 //!
1905 //! <b>Complexity</b>: Linear to the number of elements in the container.
1906 friend bool operator>(const multimap& x, const multimap& y);
1907
1908 //! <b>Effects</b>: Returns true if x is equal or less than y
1909 //!
1910 //! <b>Complexity</b>: Linear to the number of elements in the container.
1911 friend bool operator<=(const multimap& x, const multimap& y);
1912
1913 //! <b>Effects</b>: Returns true if x is equal or greater than y
1914 //!
1915 //! <b>Complexity</b>: Linear to the number of elements in the container.
1916 friend bool operator>=(const multimap& x, const multimap& y);
1917
1918 //! <b>Effects</b>: x.swap(y)
1919 //!
1920 //! <b>Complexity</b>: Constant.
1921 friend void swap(multimap& x, multimap& y);
1922
1923 #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
1924 };
1925
1926 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
1927
1928 } //namespace container {
1929
1930 //!has_trivial_destructor_after_move<> == true_type
1931 //!specialization for optimizations
1932 template <class Key, class T, class Compare, class Allocator>
1933 struct has_trivial_destructor_after_move<boost::container::multimap<Key, T, Compare, Allocator> >
1934 {
1935 typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
1936 static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
1937 ::boost::has_trivial_destructor_after_move<pointer>::value &&
1938 ::boost::has_trivial_destructor_after_move<Compare>::value;
1939 };
1940
1941 namespace container {
1942
1943 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
1944
1945 }}
1946
1947 #include <boost/container/detail/config_end.hpp>
1948
1949 #endif // BOOST_CONTAINER_MAP_HPP
1950