]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_FLAT_SET_HPP | |
11 | #define BOOST_CONTAINER_FLAT_SET_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/allocator_traits.hpp> | |
26 | #include <boost/container/container_fwd.hpp> | |
27 | #include <boost/container/new_allocator.hpp> //new_allocator | |
28 | // container/detail | |
29 | #include <boost/container/detail/flat_tree.hpp> | |
30 | #include <boost/container/detail/mpl.hpp> | |
31 | // move | |
32 | #include <boost/move/traits.hpp> | |
33 | #include <boost/move/utility_core.hpp> | |
34 | // move/detail | |
35 | #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | |
36 | #include <boost/move/detail/fwd_macros.hpp> | |
37 | #endif | |
38 | #include <boost/move/detail/move_helpers.hpp> | |
39 | // intrusive/detail | |
40 | #include <boost/intrusive/detail/minimal_pair_header.hpp> //pair | |
41 | #include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal | |
42 | // std | |
43 | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) | |
44 | #include <initializer_list> | |
45 | #endif | |
46 | ||
47 | namespace boost { | |
48 | namespace container { | |
49 | ||
50 | #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
b32b8144 FG |
51 | template <class Key, class Compare, class AllocatorOrContainer> |
52 | class flat_multiset; | |
7c673cae FG |
53 | #endif |
54 | ||
55 | //! flat_set is a Sorted Associative Container that stores objects of type Key. | |
56 | //! It is also a Unique Associative Container, meaning that no two elements are the same. | |
57 | //! | |
b32b8144 FG |
58 | //! flat_set is similar to std::set but it's implemented by as an ordered sequence container. |
59 | //! The underlying sequence container is by default <i>vector</i> but it can also work | |
60 | //! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>). | |
7c673cae | 61 | //! |
b32b8144 FG |
62 | //! Using vector-like sequence containers means that inserting a new element into a flat_set might invalidate |
63 | //! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar | |
64 | //! container that offers stable pointers and references). Similarly, erasing an element might invalidate | |
65 | //! iterators and references pointing to elements that come after (their keys are bigger) the erased element. | |
7c673cae FG |
66 | //! |
67 | //! This container provides random-access iterators. | |
68 | //! | |
69 | //! \tparam Key is the type to be inserted in the set, which is also the key_type | |
70 | //! \tparam Compare is the comparison functor used to order keys | |
b32b8144 FG |
71 | //! \tparam AllocatorOrContainer is either: |
72 | //! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>). | |
73 | //! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>) | |
74 | //! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like | |
75 | //! sequence container with random-access iterators. | |
7c673cae | 76 | #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED |
b32b8144 | 77 | template <class Key, class Compare = std::less<Key>, class AllocatorOrContainer = new_allocator<Key> > |
7c673cae | 78 | #else |
b32b8144 | 79 | template <class Key, class Compare, class AllocatorOrContainer> |
7c673cae FG |
80 | #endif |
81 | class flat_set | |
82 | ///@cond | |
11fdf7f2 | 83 | : public dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer> |
7c673cae FG |
84 | ///@endcond |
85 | { | |
86 | #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
87 | private: | |
88 | BOOST_COPYABLE_AND_MOVABLE(flat_set) | |
11fdf7f2 | 89 | typedef dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer> tree_t; |
7c673cae FG |
90 | |
91 | public: | |
b32b8144 | 92 | tree_t &tree() |
7c673cae FG |
93 | { return *this; } |
94 | ||
b32b8144 | 95 | const tree_t &tree() const |
7c673cae FG |
96 | { return *this; } |
97 | ||
98 | #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
99 | ||
100 | public: | |
101 | ////////////////////////////////////////////// | |
102 | // | |
103 | // types | |
104 | // | |
105 | ////////////////////////////////////////////// | |
b32b8144 FG |
106 | typedef Key key_type; |
107 | typedef Compare key_compare; | |
108 | typedef Key value_type; | |
109 | typedef typename BOOST_CONTAINER_IMPDEF(tree_t::sequence_type) sequence_type; | |
110 | typedef typename sequence_type::allocator_type allocator_type; | |
111 | typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type; | |
112 | typedef typename sequence_type::pointer pointer; | |
113 | typedef typename sequence_type::const_pointer const_pointer; | |
114 | typedef typename sequence_type::reference reference; | |
115 | typedef typename sequence_type::const_reference const_reference; | |
116 | typedef typename sequence_type::size_type size_type; | |
117 | typedef typename sequence_type::difference_type difference_type; | |
118 | typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type) stored_allocator_type; | |
119 | typedef typename BOOST_CONTAINER_IMPDEF(tree_t::value_compare) value_compare; | |
120 | ||
121 | typedef typename sequence_type::iterator iterator; | |
122 | typedef typename sequence_type::const_iterator const_iterator; | |
123 | typedef typename sequence_type::reverse_iterator reverse_iterator; | |
124 | typedef typename sequence_type::const_reverse_iterator const_reverse_iterator; | |
7c673cae FG |
125 | |
126 | public: | |
127 | ////////////////////////////////////////////// | |
128 | // | |
129 | // construct/copy/destroy | |
130 | // | |
131 | ////////////////////////////////////////////// | |
132 | ||
133 | //! <b>Effects</b>: Default constructs an empty container. | |
134 | //! | |
135 | //! <b>Complexity</b>: Constant. | |
b32b8144 | 136 | BOOST_CONTAINER_FORCEINLINE |
11fdf7f2 TL |
137 | flat_set() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<AllocatorOrContainer>::value && |
138 | dtl::is_nothrow_default_constructible<Compare>::value) | |
b32b8144 | 139 | : tree_t() |
7c673cae FG |
140 | {} |
141 | ||
142 | //! <b>Effects</b>: Constructs an empty container using the specified | |
b32b8144 | 143 | //! comparison object. |
7c673cae FG |
144 | //! |
145 | //! <b>Complexity</b>: Constant. | |
b32b8144 FG |
146 | BOOST_CONTAINER_FORCEINLINE |
147 | explicit flat_set(const Compare& comp) | |
148 | : tree_t(comp) | |
7c673cae FG |
149 | {} |
150 | ||
151 | //! <b>Effects</b>: Constructs an empty container using the specified allocator. | |
152 | //! | |
153 | //! <b>Complexity</b>: Constant. | |
b32b8144 | 154 | BOOST_CONTAINER_FORCEINLINE |
7c673cae | 155 | explicit flat_set(const allocator_type& a) |
b32b8144 | 156 | : tree_t(a) |
7c673cae FG |
157 | {} |
158 | ||
b32b8144 FG |
159 | //! <b>Effects</b>: Constructs an empty container using the specified |
160 | //! comparison object and allocator. | |
161 | //! | |
162 | //! <b>Complexity</b>: Constant. | |
163 | BOOST_CONTAINER_FORCEINLINE | |
164 | flat_set(const Compare& comp, const allocator_type& a) | |
165 | : tree_t(comp, a) | |
166 | {} | |
167 | ||
168 | //! <b>Effects</b>: Constructs an empty container and | |
169 | //! inserts elements from the range [first ,last ). | |
7c673cae FG |
170 | //! |
171 | //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using | |
172 | //! comp and otherwise N logN, where N is last - first. | |
173 | template <class InputIterator> | |
b32b8144 FG |
174 | BOOST_CONTAINER_FORCEINLINE |
175 | flat_set(InputIterator first, InputIterator last) | |
176 | : tree_t(true, first, last) | |
7c673cae FG |
177 | {} |
178 | ||
179 | //! <b>Effects</b>: Constructs an empty container using the specified | |
180 | //! allocator, and inserts elements from the range [first ,last ). | |
181 | //! | |
182 | //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using | |
183 | //! comp and otherwise N logN, where N is last - first. | |
184 | template <class InputIterator> | |
b32b8144 | 185 | BOOST_CONTAINER_FORCEINLINE |
7c673cae | 186 | flat_set(InputIterator first, InputIterator last, const allocator_type& a) |
b32b8144 FG |
187 | : tree_t(true, first, last, a) |
188 | {} | |
189 | ||
190 | //! <b>Effects</b>: Constructs an empty container using the specified comparison object and | |
191 | //! inserts elements from the range [first ,last ). | |
192 | //! | |
193 | //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using | |
194 | //! comp and otherwise N logN, where N is last - first. | |
195 | template <class InputIterator> | |
196 | BOOST_CONTAINER_FORCEINLINE | |
197 | flat_set(InputIterator first, InputIterator last, const Compare& comp) | |
198 | : tree_t(true, first, last, comp) | |
199 | {} | |
200 | ||
201 | //! <b>Effects</b>: Constructs an empty container using the specified comparison object and | |
202 | //! allocator, and inserts elements from the range [first ,last ). | |
203 | //! | |
204 | //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using | |
205 | //! comp and otherwise N logN, where N is last - first. | |
206 | template <class InputIterator> | |
207 | BOOST_CONTAINER_FORCEINLINE | |
208 | flat_set(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) | |
209 | : tree_t(true, first, last, comp, a) | |
210 | {} | |
211 | ||
212 | //! <b>Effects</b>: Constructs an empty container and | |
213 | //! inserts elements from the ordered unique range [first ,last). This function | |
214 | //! is more efficient than the normal range creation for ordered ranges. | |
215 | //! | |
216 | //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be | |
217 | //! unique values. | |
218 | //! | |
219 | //! <b>Complexity</b>: Linear in N. | |
220 | //! | |
221 | //! <b>Note</b>: Non-standard extension. | |
222 | template <class InputIterator> | |
223 | BOOST_CONTAINER_FORCEINLINE | |
224 | flat_set(ordered_unique_range_t, InputIterator first, InputIterator last) | |
225 | : tree_t(ordered_unique_range, first, last) | |
226 | {} | |
227 | ||
228 | //! <b>Effects</b>: Constructs an empty container 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 | |
240 | flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp) | |
241 | : tree_t(ordered_unique_range, first, last, comp) | |
7c673cae FG |
242 | {} |
243 | ||
244 | //! <b>Effects</b>: Constructs an empty container using the specified comparison object and | |
245 | //! allocator, and inserts elements from the ordered unique range [first ,last). This function | |
246 | //! is more efficient than the normal range creation for ordered ranges. | |
247 | //! | |
248 | //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be | |
249 | //! unique values. | |
250 | //! | |
251 | //! <b>Complexity</b>: Linear in N. | |
252 | //! | |
253 | //! <b>Note</b>: Non-standard extension. | |
254 | template <class InputIterator> | |
b32b8144 FG |
255 | BOOST_CONTAINER_FORCEINLINE |
256 | flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) | |
257 | : tree_t(ordered_unique_range, first, last, comp, a) | |
7c673cae FG |
258 | {} |
259 | ||
260 | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) | |
b32b8144 FG |
261 | //! <b>Effects</b>: Constructs an empty container and |
262 | //! inserts elements from the range [il.begin(), il.end()). | |
7c673cae FG |
263 | //! |
264 | //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using | |
265 | //! comp and otherwise N logN, where N is il.begin() - il.end(). | |
b32b8144 FG |
266 | BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il) |
267 | : tree_t(true, il.begin(), il.end()) | |
7c673cae FG |
268 | {} |
269 | ||
270 | //! <b>Effects</b>: Constructs an empty container using the specified | |
271 | //! allocator, and inserts elements from the range [il.begin(), il.end()). | |
272 | //! | |
273 | //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using | |
274 | //! comp and otherwise N logN, where N is il.begin() - il.end(). | |
b32b8144 FG |
275 | BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const allocator_type& a) |
276 | : tree_t(true, il.begin(), il.end(), a) | |
277 | {} | |
278 | ||
279 | //! <b>Effects</b>: Constructs an empty container using the specified comparison object and | |
280 | //! inserts elements from the range [il.begin(), il.end()). | |
281 | //! | |
282 | //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using | |
283 | //! comp and otherwise N logN, where N is il.begin() - il.end(). | |
284 | BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const Compare& comp) | |
285 | : tree_t(true, il.begin(), il.end(), comp) | |
286 | {} | |
287 | ||
288 | //! <b>Effects</b>: Constructs an empty container using the specified comparison object and | |
289 | //! allocator, and inserts elements from the range [il.begin(), il.end()). | |
290 | //! | |
291 | //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using | |
292 | //! comp and otherwise N logN, where N is il.begin() - il.end(). | |
293 | BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) | |
294 | : tree_t(true, il.begin(), il.end(), comp, a) | |
295 | {} | |
296 | ||
297 | //! <b>Effects</b>: Constructs an empty container using the specified comparison object and | |
298 | //! inserts elements from the ordered unique range [il.begin(), il.end()). This function | |
299 | //! is more efficient than the normal range creation for ordered ranges. | |
300 | //! | |
301 | //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be | |
302 | //! unique values. | |
303 | //! | |
304 | //! <b>Complexity</b>: Linear in N. | |
305 | //! | |
306 | //! <b>Note</b>: Non-standard extension. | |
307 | BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il) | |
308 | : tree_t(ordered_unique_range, il.begin(), il.end()) | |
309 | {} | |
310 | ||
311 | //! <b>Effects</b>: Constructs an empty container using the specified comparison object and | |
312 | //! inserts elements from the ordered unique range [il.begin(), il.end()). This function | |
313 | //! is more efficient than the normal range creation for ordered ranges. | |
314 | //! | |
315 | //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be | |
316 | //! unique values. | |
317 | //! | |
318 | //! <b>Complexity</b>: Linear in N. | |
319 | //! | |
320 | //! <b>Note</b>: Non-standard extension. | |
321 | BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp) | |
322 | : tree_t(ordered_unique_range, il.begin(), il.end(), comp) | |
7c673cae FG |
323 | {} |
324 | ||
325 | //! <b>Effects</b>: Constructs an empty container using the specified comparison object and | |
326 | //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function | |
327 | //! is more efficient than the normal range creation for ordered ranges. | |
328 | //! | |
329 | //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be | |
330 | //! unique values. | |
331 | //! | |
332 | //! <b>Complexity</b>: Linear in N. | |
333 | //! | |
334 | //! <b>Note</b>: Non-standard extension. | |
b32b8144 FG |
335 | BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) |
336 | : tree_t(ordered_unique_range, il.begin(), il.end(), comp, a) | |
7c673cae FG |
337 | {} |
338 | #endif | |
339 | ||
340 | //! <b>Effects</b>: Copy constructs the container. | |
341 | //! | |
342 | //! <b>Complexity</b>: Linear in x.size(). | |
b32b8144 FG |
343 | BOOST_CONTAINER_FORCEINLINE flat_set(const flat_set& x) |
344 | : tree_t(static_cast<const tree_t&>(x)) | |
7c673cae FG |
345 | {} |
346 | ||
347 | //! <b>Effects</b>: Move constructs thecontainer. Constructs *this using x's resources. | |
348 | //! | |
349 | //! <b>Complexity</b>: Constant. | |
350 | //! | |
351 | //! <b>Postcondition</b>: x is emptied. | |
b32b8144 | 352 | BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x) |
11fdf7f2 | 353 | BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value) |
b32b8144 | 354 | : tree_t(BOOST_MOVE_BASE(tree_t, x)) |
7c673cae FG |
355 | {} |
356 | ||
357 | //! <b>Effects</b>: Copy constructs a container using the specified allocator. | |
358 | //! | |
359 | //! <b>Complexity</b>: Linear in x.size(). | |
b32b8144 FG |
360 | BOOST_CONTAINER_FORCEINLINE flat_set(const flat_set& x, const allocator_type &a) |
361 | : tree_t(static_cast<const tree_t&>(x), a) | |
7c673cae FG |
362 | {} |
363 | ||
364 | //! <b>Effects</b>: Move constructs a container using the specified allocator. | |
365 | //! Constructs *this using x's resources. | |
366 | //! | |
367 | //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise | |
b32b8144 FG |
368 | BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x, const allocator_type &a) |
369 | : tree_t(BOOST_MOVE_BASE(tree_t, x), a) | |
7c673cae FG |
370 | {} |
371 | ||
372 | //! <b>Effects</b>: Makes *this a copy of x. | |
373 | //! | |
374 | //! <b>Complexity</b>: Linear in x.size(). | |
b32b8144 FG |
375 | BOOST_CONTAINER_FORCEINLINE flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x) |
376 | { return static_cast<flat_set&>(this->tree_t::operator=(static_cast<const tree_t&>(x))); } | |
7c673cae FG |
377 | |
378 | //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment | |
379 | //! is false and (allocation throws or value_type's move constructor throws) | |
380 | //! | |
381 | //! <b>Complexity</b>: Constant if allocator_traits_type:: | |
382 | //! propagate_on_container_move_assignment is true or | |
383 | //! this->get>allocator() == x.get_allocator(). Linear otherwise. | |
b32b8144 | 384 | BOOST_CONTAINER_FORCEINLINE flat_set& operator=(BOOST_RV_REF(flat_set) x) |
7c673cae FG |
385 | BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || |
386 | allocator_traits_type::is_always_equal::value) && | |
11fdf7f2 | 387 | boost::container::dtl::is_nothrow_move_assignable<Compare>::value) |
b32b8144 | 388 | { return static_cast<flat_set&>(this->tree_t::operator=(BOOST_MOVE_BASE(tree_t, x))); } |
7c673cae FG |
389 | |
390 | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) | |
391 | //! <b>Effects</b>: Copy all elements from il to *this. | |
392 | //! | |
393 | //! <b>Complexity</b>: Linear in il.size(). | |
394 | flat_set& operator=(std::initializer_list<value_type> il) | |
395 | { | |
396 | this->clear(); | |
397 | this->insert(il.begin(), il.end()); | |
398 | return *this; | |
399 | } | |
400 | #endif | |
401 | ||
402 | #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED | |
403 | //! <b>Effects</b>: Returns a copy of the allocator that | |
404 | //! was passed to the object's constructor. | |
405 | //! | |
406 | //! <b>Complexity</b>: Constant. | |
407 | allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW; | |
408 | ||
409 | //! <b>Effects</b>: Returns a reference to the internal allocator. | |
410 | //! | |
411 | //! <b>Throws</b>: Nothing | |
412 | //! | |
413 | //! <b>Complexity</b>: Constant. | |
414 | //! | |
415 | //! <b>Note</b>: Non-standard extension. | |
416 | stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW; | |
417 | ||
418 | //! <b>Effects</b>: Returns a reference to the internal allocator. | |
419 | //! | |
420 | //! <b>Throws</b>: Nothing | |
421 | //! | |
422 | //! <b>Complexity</b>: Constant. | |
423 | //! | |
424 | //! <b>Note</b>: Non-standard extension. | |
425 | const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW; | |
426 | ||
427 | //! <b>Effects</b>: Returns an iterator to the first element contained in the container. | |
428 | //! | |
429 | //! <b>Throws</b>: Nothing. | |
430 | //! | |
431 | //! <b>Complexity</b>: Constant. | |
432 | iterator begin() BOOST_NOEXCEPT_OR_NOTHROW; | |
433 | ||
434 | //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container. | |
435 | //! | |
436 | //! <b>Throws</b>: Nothing. | |
437 | //! | |
438 | //! <b>Complexity</b>: Constant. | |
439 | const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW; | |
440 | ||
441 | //! <b>Effects</b>: Returns an iterator to the end of the container. | |
442 | //! | |
443 | //! <b>Throws</b>: Nothing. | |
444 | //! | |
445 | //! <b>Complexity</b>: Constant. | |
446 | iterator end() BOOST_NOEXCEPT_OR_NOTHROW; | |
447 | ||
448 | //! <b>Effects</b>: Returns a const_iterator to the end of the container. | |
449 | //! | |
450 | //! <b>Throws</b>: Nothing. | |
451 | //! | |
452 | //! <b>Complexity</b>: Constant. | |
453 | const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW; | |
454 | ||
455 | //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning | |
456 | //! of the reversed container. | |
457 | //! | |
458 | //! <b>Throws</b>: Nothing. | |
459 | //! | |
460 | //! <b>Complexity</b>: Constant. | |
461 | reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW; | |
462 | ||
463 | //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning | |
464 | //! of the reversed container. | |
465 | //! | |
466 | //! <b>Throws</b>: Nothing. | |
467 | //! | |
468 | //! <b>Complexity</b>: Constant. | |
469 | const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW; | |
470 | ||
471 | //! <b>Effects</b>: Returns a reverse_iterator pointing to the end | |
472 | //! of the reversed container. | |
473 | //! | |
474 | //! <b>Throws</b>: Nothing. | |
475 | //! | |
476 | //! <b>Complexity</b>: Constant. | |
477 | reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW; | |
478 | ||
479 | //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end | |
480 | //! of the reversed container. | |
481 | //! | |
482 | //! <b>Throws</b>: Nothing. | |
483 | //! | |
484 | //! <b>Complexity</b>: Constant. | |
485 | const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW; | |
486 | ||
487 | //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container. | |
488 | //! | |
489 | //! <b>Throws</b>: Nothing. | |
490 | //! | |
491 | //! <b>Complexity</b>: Constant. | |
492 | const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW; | |
493 | ||
494 | //! <b>Effects</b>: Returns a const_iterator to the end of the container. | |
495 | //! | |
496 | //! <b>Throws</b>: Nothing. | |
497 | //! | |
498 | //! <b>Complexity</b>: Constant. | |
499 | const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW; | |
500 | ||
501 | //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning | |
502 | //! of the reversed container. | |
503 | //! | |
504 | //! <b>Throws</b>: Nothing. | |
505 | //! | |
506 | //! <b>Complexity</b>: Constant. | |
507 | const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW; | |
508 | ||
509 | //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end | |
510 | //! of the reversed container. | |
511 | //! | |
512 | //! <b>Throws</b>: Nothing. | |
513 | //! | |
514 | //! <b>Complexity</b>: Constant. | |
515 | const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW; | |
516 | ||
517 | //! <b>Effects</b>: Returns true if the container contains no elements. | |
518 | //! | |
519 | //! <b>Throws</b>: Nothing. | |
520 | //! | |
521 | //! <b>Complexity</b>: Constant. | |
522 | bool empty() const BOOST_NOEXCEPT_OR_NOTHROW; | |
523 | ||
524 | //! <b>Effects</b>: Returns the number of the elements contained in the container. | |
525 | //! | |
526 | //! <b>Throws</b>: Nothing. | |
527 | //! | |
528 | //! <b>Complexity</b>: Constant. | |
529 | size_type size() const BOOST_NOEXCEPT_OR_NOTHROW; | |
530 | ||
531 | //! <b>Effects</b>: Returns the largest possible size of the container. | |
532 | //! | |
533 | //! <b>Throws</b>: Nothing. | |
534 | //! | |
535 | //! <b>Complexity</b>: Constant. | |
536 | size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW; | |
537 | ||
538 | //! <b>Effects</b>: Number of elements for which memory has been allocated. | |
539 | //! capacity() is always greater than or equal to size(). | |
540 | //! | |
541 | //! <b>Throws</b>: Nothing. | |
542 | //! | |
543 | //! <b>Complexity</b>: Constant. | |
544 | size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW; | |
545 | ||
b32b8144 FG |
546 | //! <b>Effects</b>: If n is less than or equal to capacity(), or the |
547 | //! underlying container has no `reserve` member, this call has no | |
7c673cae FG |
548 | //! effect. Otherwise, it is a request for allocation of additional memory. |
549 | //! If the request is successful, then capacity() is greater than or equal to | |
550 | //! n; otherwise, capacity() is unchanged. In either case, size() is unchanged. | |
551 | //! | |
b32b8144 | 552 | //! <b>Throws</b>: If memory allocation allocation throws or T's copy constructor throws. |
7c673cae FG |
553 | //! |
554 | //! <b>Note</b>: If capacity() is less than "cnt", iterators and references to | |
555 | //! to values might be invalidated. | |
556 | void reserve(size_type cnt); | |
557 | ||
558 | //! <b>Effects</b>: Tries to deallocate the excess of memory created | |
559 | // with previous allocations. The size of the vector is unchanged | |
560 | //! | |
561 | //! <b>Throws</b>: If memory allocation throws, or Key's copy constructor throws. | |
562 | //! | |
563 | //! <b>Complexity</b>: Linear to size(). | |
564 | void shrink_to_fit(); | |
565 | ||
566 | #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
567 | ||
568 | ////////////////////////////////////////////// | |
569 | // | |
570 | // modifiers | |
571 | // | |
572 | ////////////////////////////////////////////// | |
573 | ||
574 | #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
575 | ||
576 | //! <b>Effects</b>: Inserts an object x of type Key constructed with | |
577 | //! std::forward<Args>(args)... if and only if there is no element in the container | |
578 | //! with key equivalent to the key of x. | |
579 | //! | |
580 | //! <b>Returns</b>: The bool component of the returned pair is true if and only | |
581 | //! if the insertion takes place, and the iterator component of the pair | |
582 | //! points to the element with key equivalent to the key of x. | |
583 | //! | |
584 | //! <b>Complexity</b>: Logarithmic search time plus linear insertion | |
585 | //! to the elements with bigger keys than x. | |
586 | //! | |
587 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
588 | template <class... Args> | |
b32b8144 FG |
589 | BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... args) |
590 | { return this->tree_t::emplace_unique(boost::forward<Args>(args)...); } | |
7c673cae FG |
591 | |
592 | //! <b>Effects</b>: Inserts an object of type Key constructed with | |
593 | //! std::forward<Args>(args)... in the container if and only if there is | |
594 | //! no element in the container with key equivalent to the key of x. | |
595 | //! p is a hint pointing to where the insert should start to search. | |
596 | //! | |
597 | //! <b>Returns</b>: An iterator pointing to the element with key equivalent | |
598 | //! to the key of x. | |
599 | //! | |
600 | //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted | |
601 | //! right before p) plus insertion linear to the elements with bigger keys than x. | |
602 | //! | |
603 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
604 | template <class... Args> | |
b32b8144 FG |
605 | BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args) |
606 | { return this->tree_t::emplace_hint_unique(p, boost::forward<Args>(args)...); } | |
7c673cae FG |
607 | |
608 | #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | |
609 | ||
610 | #define BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE(N) \ | |
611 | BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ | |
b32b8144 FG |
612 | BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##N)\ |
613 | { return this->tree_t::emplace_unique(BOOST_MOVE_FWD##N); }\ | |
7c673cae FG |
614 | \ |
615 | BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ | |
b32b8144 FG |
616 | BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ |
617 | { return this->tree_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ | |
7c673cae FG |
618 | // |
619 | BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE) | |
620 | #undef BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE | |
621 | ||
622 | #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | |
623 | ||
624 | #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
625 | //! <b>Effects</b>: Inserts x if and only if there is no element in the container | |
626 | //! with key equivalent to the key of x. | |
627 | //! | |
628 | //! <b>Returns</b>: The bool component of the returned pair is true if and only | |
629 | //! if the insertion takes place, and the iterator component of the pair | |
630 | //! points to the element with key equivalent to the key of x. | |
631 | //! | |
632 | //! <b>Complexity</b>: Logarithmic search time plus linear insertion | |
633 | //! to the elements with bigger keys than x. | |
634 | //! | |
635 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
636 | std::pair<iterator, bool> insert(const value_type &x); | |
637 | ||
638 | //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and | |
639 | //! only if there is no element in the container with key equivalent to the key of x. | |
640 | //! | |
641 | //! <b>Returns</b>: The bool component of the returned pair is true if and only | |
642 | //! if the insertion takes place, and the iterator component of the pair | |
643 | //! points to the element with key equivalent to the key of x. | |
644 | //! | |
645 | //! <b>Complexity</b>: Logarithmic search time plus linear insertion | |
646 | //! to the elements with bigger keys than x. | |
647 | //! | |
648 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
649 | std::pair<iterator, bool> insert(value_type &&x); | |
650 | #else | |
651 | private: | |
652 | typedef std::pair<iterator, bool> insert_return_pair; | |
653 | public: | |
654 | BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert) | |
655 | #endif | |
656 | ||
657 | #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
658 | //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is | |
659 | //! no element in the container with key equivalent to the key of x. | |
660 | //! p is a hint pointing to where the insert should start to search. | |
661 | //! | |
662 | //! <b>Returns</b>: An iterator pointing to the element with key equivalent | |
663 | //! to the key of x. | |
664 | //! | |
665 | //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted | |
666 | //! right before p) plus insertion linear to the elements with bigger keys than x. | |
667 | //! | |
668 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
669 | iterator insert(const_iterator p, const value_type &x); | |
670 | ||
671 | //! <b>Effects</b>: Inserts an element move constructed from x in the container. | |
672 | //! p is a hint pointing to where the insert should start to search. | |
673 | //! | |
674 | //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x. | |
675 | //! | |
676 | //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted | |
677 | //! right before p) plus insertion linear to the elements with bigger keys than x. | |
678 | //! | |
679 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
680 | iterator insert(const_iterator p, value_type &&x); | |
681 | #else | |
682 | BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator) | |
683 | #endif | |
684 | ||
685 | //! <b>Requires</b>: first, last are not iterators into *this. | |
686 | //! | |
687 | //! <b>Effects</b>: inserts each element from the range [first,last) if and only | |
688 | //! if there is no element with key equivalent to the key of that element. | |
689 | //! | |
11fdf7f2 | 690 | //! <b>Complexity</b>: N log(N). |
7c673cae FG |
691 | //! |
692 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
693 | template <class InputIterator> | |
b32b8144 FG |
694 | BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last) |
695 | { this->tree_t::insert_unique(first, last); } | |
7c673cae FG |
696 | |
697 | //! <b>Requires</b>: first, last are not iterators into *this and | |
698 | //! must be ordered according to the predicate and must be | |
699 | //! unique values. | |
700 | //! | |
701 | //! <b>Effects</b>: inserts each element from the range [first,last) .This function | |
702 | //! is more efficient than the normal range creation for ordered ranges. | |
703 | //! | |
11fdf7f2 | 704 | //! <b>Complexity</b>: Linear. |
7c673cae FG |
705 | //! |
706 | //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. | |
707 | template <class InputIterator> | |
b32b8144 FG |
708 | BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, InputIterator first, InputIterator last) |
709 | { this->tree_t::insert_unique(ordered_unique_range, first, last); } | |
7c673cae FG |
710 | |
711 | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) | |
712 | //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only | |
713 | //! if there is no element with key equivalent to the key of that element. | |
714 | //! | |
11fdf7f2 | 715 | //! <b>Complexity</b>: N log(N). |
7c673cae FG |
716 | //! |
717 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
b32b8144 FG |
718 | BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il) |
719 | { this->tree_t::insert_unique(il.begin(), il.end()); } | |
7c673cae FG |
720 | |
721 | //! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate | |
722 | //! and must be unique values. | |
723 | //! | |
724 | //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) .This function | |
725 | //! is more efficient than the normal range creation for ordered ranges. | |
726 | //! | |
11fdf7f2 | 727 | //! <b>Complexity</b>: Linear. |
7c673cae FG |
728 | //! |
729 | //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. | |
b32b8144 FG |
730 | BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, std::initializer_list<value_type> il) |
731 | { this->tree_t::insert_unique(ordered_unique_range, il.begin(), il.end()); } | |
7c673cae FG |
732 | #endif |
733 | ||
b32b8144 | 734 | //! @copydoc ::boost::container::flat_map::merge(flat_map<Key, T, C2, AllocatorOrContainer>&) |
7c673cae | 735 | template<class C2> |
b32b8144 FG |
736 | BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, AllocatorOrContainer>& source) |
737 | { this->tree_t::merge_unique(source.tree()); } | |
7c673cae | 738 | |
b32b8144 | 739 | //! @copydoc ::boost::container::flat_set::merge(flat_set<Key, C2, AllocatorOrContainer>&) |
7c673cae | 740 | template<class C2> |
b32b8144 FG |
741 | BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source) |
742 | { return this->merge(static_cast<flat_set<Key, C2, AllocatorOrContainer>&>(source)); } | |
7c673cae | 743 | |
b32b8144 | 744 | //! @copydoc ::boost::container::flat_map::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&) |
7c673cae | 745 | template<class C2> |
b32b8144 FG |
746 | BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, AllocatorOrContainer>& source) |
747 | { this->tree_t::merge_unique(source.tree()); } | |
7c673cae | 748 | |
b32b8144 | 749 | //! @copydoc ::boost::container::flat_set::merge(flat_multiset<Key, C2, AllocatorOrContainer>&) |
7c673cae | 750 | template<class C2> |
b32b8144 FG |
751 | BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source) |
752 | { return this->merge(static_cast<flat_multiset<Key, C2, AllocatorOrContainer>&>(source)); } | |
7c673cae FG |
753 | |
754 | #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
755 | ||
756 | //! <b>Effects</b>: Erases the element pointed to by p. | |
757 | //! | |
758 | //! <b>Returns</b>: Returns an iterator pointing to the element immediately | |
759 | //! following q prior to the element being erased. If no such element exists, | |
760 | //! returns end(). | |
761 | //! | |
762 | //! <b>Complexity</b>: Linear to the elements with keys bigger than p | |
763 | //! | |
764 | //! <b>Note</b>: Invalidates elements with keys | |
765 | //! not less than the erased element. | |
766 | iterator erase(const_iterator p); | |
767 | ||
768 | //! <b>Effects</b>: Erases all elements in the container with key equivalent to x. | |
769 | //! | |
770 | //! <b>Returns</b>: Returns the number of erased elements. | |
771 | //! | |
772 | //! <b>Complexity</b>: Logarithmic search time plus erasure time | |
773 | //! linear to the elements with bigger keys. | |
774 | size_type erase(const key_type& x); | |
775 | ||
776 | //! <b>Effects</b>: Erases all the elements in the range [first, last). | |
777 | //! | |
778 | //! <b>Returns</b>: Returns last. | |
779 | //! | |
780 | //! <b>Complexity</b>: size()*N where N is the distance from first to last. | |
781 | //! | |
782 | //! <b>Complexity</b>: Logarithmic search time plus erasure time | |
783 | //! linear to the elements with bigger keys. | |
784 | iterator erase(const_iterator first, const_iterator last); | |
785 | ||
786 | //! <b>Effects</b>: Swaps the contents of *this and x. | |
787 | //! | |
788 | //! <b>Throws</b>: Nothing. | |
789 | //! | |
790 | //! <b>Complexity</b>: Constant. | |
791 | void swap(flat_set& x) | |
792 | BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value | |
11fdf7f2 | 793 | && boost::container::dtl::is_nothrow_swappable<Compare>::value ); |
7c673cae FG |
794 | |
795 | //! <b>Effects</b>: erase(a.begin(),a.end()). | |
796 | //! | |
797 | //! <b>Postcondition</b>: size() == 0. | |
798 | //! | |
799 | //! <b>Complexity</b>: linear in size(). | |
800 | void clear() BOOST_NOEXCEPT_OR_NOTHROW; | |
801 | ||
802 | //! <b>Effects</b>: Returns the comparison object out | |
803 | //! of which a was constructed. | |
804 | //! | |
805 | //! <b>Complexity</b>: Constant. | |
806 | key_compare key_comp() const; | |
807 | ||
808 | //! <b>Effects</b>: Returns an object of value_compare constructed out | |
809 | //! of the comparison object. | |
810 | //! | |
811 | //! <b>Complexity</b>: Constant. | |
812 | value_compare value_comp() const; | |
813 | ||
814 | //! <b>Returns</b>: An iterator pointing to an element with the key | |
815 | //! equivalent to x, or end() if such an element is not found. | |
816 | //! | |
817 | //! <b>Complexity</b>: Logarithmic. | |
818 | iterator find(const key_type& x); | |
819 | ||
820 | //! <b>Returns</b>: A const_iterator pointing to an element with the key | |
821 | //! equivalent to x, or end() if such an element is not found. | |
822 | //! | |
823 | //! <b>Complexity</b>: Logarithmic. | |
824 | const_iterator find(const key_type& x) const; | |
825 | ||
826 | //! <b>Requires</b>: size() >= n. | |
827 | //! | |
828 | //! <b>Effects</b>: Returns an iterator to the nth element | |
829 | //! from the beginning of the container. Returns end() | |
830 | //! if n == size(). | |
831 | //! | |
832 | //! <b>Throws</b>: Nothing. | |
833 | //! | |
834 | //! <b>Complexity</b>: Constant. | |
835 | //! | |
836 | //! <b>Note</b>: Non-standard extension | |
837 | iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW; | |
838 | ||
839 | //! <b>Requires</b>: size() >= n. | |
840 | //! | |
841 | //! <b>Effects</b>: Returns a const_iterator to the nth element | |
842 | //! from the beginning of the container. Returns end() | |
843 | //! if n == size(). | |
844 | //! | |
845 | //! <b>Throws</b>: Nothing. | |
846 | //! | |
847 | //! <b>Complexity</b>: Constant. | |
848 | //! | |
849 | //! <b>Note</b>: Non-standard extension | |
850 | const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW; | |
851 | ||
852 | //! <b>Requires</b>: begin() <= p <= end(). | |
853 | //! | |
854 | //! <b>Effects</b>: Returns the index of the element pointed by p | |
855 | //! and size() if p == end(). | |
856 | //! | |
857 | //! <b>Throws</b>: Nothing. | |
858 | //! | |
859 | //! <b>Complexity</b>: Constant. | |
860 | //! | |
861 | //! <b>Note</b>: Non-standard extension | |
862 | size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW; | |
863 | ||
864 | //! <b>Requires</b>: begin() <= p <= end(). | |
865 | //! | |
866 | //! <b>Effects</b>: Returns the index of the element pointed by p | |
867 | //! and size() if p == end(). | |
868 | //! | |
869 | //! <b>Throws</b>: Nothing. | |
870 | //! | |
871 | //! <b>Complexity</b>: Constant. | |
872 | //! | |
873 | //! <b>Note</b>: Non-standard extension | |
874 | size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW; | |
875 | ||
876 | #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
877 | ||
878 | //! <b>Returns</b>: The number of elements with key equivalent to x. | |
879 | //! | |
880 | //! <b>Complexity</b>: log(size())+count(k) | |
b32b8144 FG |
881 | BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const |
882 | { return static_cast<size_type>(this->tree_t::find(x) != this->tree_t::cend()); } | |
7c673cae FG |
883 | |
884 | #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
885 | //! <b>Returns</b>: An iterator pointing to the first element with key not less | |
886 | //! than k, or a.end() if such an element is not found. | |
887 | //! | |
888 | //! <b>Complexity</b>: Logarithmic | |
889 | iterator lower_bound(const key_type& x); | |
890 | ||
891 | //! <b>Returns</b>: A const iterator pointing to the first element with key not | |
892 | //! less than k, or a.end() if such an element is not found. | |
893 | //! | |
894 | //! <b>Complexity</b>: Logarithmic | |
895 | const_iterator lower_bound(const key_type& x) const; | |
896 | ||
897 | //! <b>Returns</b>: An iterator pointing to the first element with key not less | |
898 | //! than x, or end() if such an element is not found. | |
899 | //! | |
900 | //! <b>Complexity</b>: Logarithmic | |
901 | iterator upper_bound(const key_type& x); | |
902 | ||
903 | //! <b>Returns</b>: A const iterator pointing to the first element with key not | |
904 | //! less than x, or end() if such an element is not found. | |
905 | //! | |
906 | //! <b>Complexity</b>: Logarithmic | |
907 | const_iterator upper_bound(const key_type& x) const; | |
908 | ||
909 | #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
910 | ||
911 | //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). | |
912 | //! | |
913 | //! <b>Complexity</b>: Logarithmic | |
b32b8144 FG |
914 | BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const |
915 | { return this->tree_t::lower_bound_range(x); } | |
7c673cae FG |
916 | |
917 | //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). | |
918 | //! | |
919 | //! <b>Complexity</b>: Logarithmic | |
b32b8144 FG |
920 | BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const key_type& x) |
921 | { return this->tree_t::lower_bound_range(x); } | |
7c673cae FG |
922 | |
923 | #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
924 | ||
925 | //! <b>Effects</b>: Returns true if x and y are equal | |
926 | //! | |
927 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
928 | friend bool operator==(const flat_set& x, const flat_set& y); | |
929 | ||
930 | //! <b>Effects</b>: Returns true if x and y are unequal | |
931 | //! | |
932 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
933 | friend bool operator!=(const flat_set& x, const flat_set& y); | |
934 | ||
935 | //! <b>Effects</b>: Returns true if x is less than y | |
936 | //! | |
937 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
938 | friend bool operator<(const flat_set& x, const flat_set& y); | |
939 | ||
940 | //! <b>Effects</b>: Returns true if x is greater than y | |
941 | //! | |
942 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
943 | friend bool operator>(const flat_set& x, const flat_set& y); | |
944 | ||
945 | //! <b>Effects</b>: Returns true if x is equal or less than y | |
946 | //! | |
947 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
948 | friend bool operator<=(const flat_set& x, const flat_set& y); | |
949 | ||
950 | //! <b>Effects</b>: Returns true if x is equal or greater than y | |
951 | //! | |
952 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
953 | friend bool operator>=(const flat_set& x, const flat_set& y); | |
954 | ||
955 | //! <b>Effects</b>: x.swap(y) | |
956 | //! | |
957 | //! <b>Complexity</b>: Constant. | |
958 | friend void swap(flat_set& x, flat_set& y); | |
959 | ||
b32b8144 FG |
960 | //! <b>Effects</b>: Extracts the internal sequence container. |
961 | //! | |
962 | //! <b>Complexity</b>: Same as the move constructor of sequence_type, usually constant. | |
963 | //! | |
964 | //! <b>Postcondition</b>: this->empty() | |
965 | //! | |
966 | //! <b>Throws</b>: If secuence_type's move constructor throws | |
967 | sequence_type extract_sequence(); | |
968 | ||
7c673cae FG |
969 | #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED |
970 | ||
b32b8144 FG |
971 | //! <b>Effects</b>: Discards the internally hold sequence container and adopts the |
972 | //! one passed externally using the move assignment. Erases non-unique elements. | |
973 | //! | |
974 | //! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size() | |
975 | //! | |
976 | //! <b>Throws</b>: If the comparison or the move constructor throws | |
977 | BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq) | |
978 | { this->tree_t::adopt_sequence_unique(boost::move(seq)); } | |
979 | ||
980 | //! <b>Requires</b>: seq shall be ordered according to this->compare() | |
981 | //! and shall contain unique elements. | |
982 | //! | |
983 | //! <b>Effects</b>: Discards the internally hold sequence container and adopts the | |
984 | //! one passed externally using the move assignment. | |
985 | //! | |
986 | //! <b>Complexity</b>: Assuming O(1) move assignment, O(1) | |
987 | //! | |
988 | //! <b>Throws</b>: If the move assignment throws | |
989 | BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_unique_range_t, BOOST_RV_REF(sequence_type) seq) | |
990 | { this->tree_t::adopt_sequence_unique(ordered_unique_range_t(), boost::move(seq)); } | |
991 | ||
7c673cae FG |
992 | #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED |
993 | private: | |
994 | template<class KeyType> | |
b32b8144 FG |
995 | BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> priv_insert(BOOST_FWD_REF(KeyType) x) |
996 | { return this->tree_t::insert_unique(::boost::forward<KeyType>(x)); } | |
7c673cae FG |
997 | |
998 | template<class KeyType> | |
b32b8144 FG |
999 | BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) |
1000 | { return this->tree_t::insert_unique(p, ::boost::forward<KeyType>(x)); } | |
7c673cae FG |
1001 | #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED |
1002 | }; | |
1003 | ||
1004 | #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
1005 | ||
1006 | } //namespace container { | |
1007 | ||
1008 | //!has_trivial_destructor_after_move<> == true_type | |
1009 | //!specialization for optimizations | |
b32b8144 FG |
1010 | template <class Key, class Compare, class AllocatorOrContainer> |
1011 | struct has_trivial_destructor_after_move<boost::container::flat_set<Key, Compare, AllocatorOrContainer> > | |
7c673cae | 1012 | { |
b32b8144 FG |
1013 | typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer; |
1014 | static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value && | |
7c673cae FG |
1015 | ::boost::has_trivial_destructor_after_move<pointer>::value && |
1016 | ::boost::has_trivial_destructor_after_move<Compare>::value; | |
1017 | }; | |
1018 | ||
1019 | namespace container { | |
1020 | ||
1021 | #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
1022 | ||
b32b8144 FG |
1023 | //! flat_multiset is a Sorted Associative Container that stores objects of type Key and |
1024 | //! can store multiple copies of the same key value. | |
7c673cae | 1025 | //! |
b32b8144 FG |
1026 | //! flat_multiset is similar to std::multiset but it's implemented by as an ordered sequence container. |
1027 | //! The underlying sequence container is by default <i>vector</i> but it can also work | |
1028 | //! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>). | |
7c673cae | 1029 | //! |
b32b8144 FG |
1030 | //! Using vector-like sequence containers means that inserting a new element into a flat_multiset might invalidate |
1031 | //! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar | |
1032 | //! container that offers stable pointers and references). Similarly, erasing an element might invalidate | |
1033 | //! iterators and references pointing to elements that come after (their keys are bigger) the erased element. | |
7c673cae FG |
1034 | //! |
1035 | //! This container provides random-access iterators. | |
1036 | //! | |
1037 | //! \tparam Key is the type to be inserted in the multiset, which is also the key_type | |
1038 | //! \tparam Compare is the comparison functor used to order keys | |
b32b8144 FG |
1039 | //! \tparam AllocatorOrContainer is either: |
1040 | //! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>). | |
1041 | //! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>) | |
1042 | //! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like | |
1043 | //! sequence container with random-access iterators. | |
7c673cae | 1044 | #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED |
b32b8144 | 1045 | template <class Key, class Compare = std::less<Key>, class AllocatorOrContainer = new_allocator<Key> > |
7c673cae | 1046 | #else |
b32b8144 | 1047 | template <class Key, class Compare, class AllocatorOrContainer> |
7c673cae FG |
1048 | #endif |
1049 | class flat_multiset | |
1050 | ///@cond | |
11fdf7f2 | 1051 | : public dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer> |
7c673cae FG |
1052 | ///@endcond |
1053 | { | |
1054 | #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
1055 | private: | |
1056 | BOOST_COPYABLE_AND_MOVABLE(flat_multiset) | |
11fdf7f2 | 1057 | typedef dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer> tree_t; |
7c673cae FG |
1058 | |
1059 | public: | |
b32b8144 | 1060 | tree_t &tree() |
7c673cae FG |
1061 | { return *this; } |
1062 | ||
b32b8144 | 1063 | const tree_t &tree() const |
7c673cae FG |
1064 | { return *this; } |
1065 | #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
1066 | ||
1067 | public: | |
1068 | ////////////////////////////////////////////// | |
1069 | // | |
1070 | // types | |
1071 | // | |
1072 | ////////////////////////////////////////////// | |
b32b8144 FG |
1073 | typedef Key key_type; |
1074 | typedef Compare key_compare; | |
1075 | typedef Key value_type; | |
1076 | typedef typename BOOST_CONTAINER_IMPDEF(tree_t::sequence_type) sequence_type; | |
1077 | typedef typename sequence_type::allocator_type allocator_type; | |
1078 | typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type; | |
1079 | typedef typename sequence_type::pointer pointer; | |
1080 | typedef typename sequence_type::const_pointer const_pointer; | |
1081 | typedef typename sequence_type::reference reference; | |
1082 | typedef typename sequence_type::const_reference const_reference; | |
1083 | typedef typename sequence_type::size_type size_type; | |
1084 | typedef typename sequence_type::difference_type difference_type; | |
1085 | typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type) stored_allocator_type; | |
1086 | typedef typename BOOST_CONTAINER_IMPDEF(tree_t::value_compare) value_compare; | |
1087 | ||
1088 | typedef typename sequence_type::iterator iterator; | |
1089 | typedef typename sequence_type::const_iterator const_iterator; | |
1090 | typedef typename sequence_type::reverse_iterator reverse_iterator; | |
1091 | typedef typename sequence_type::const_reverse_iterator const_reverse_iterator; | |
7c673cae FG |
1092 | |
1093 | //! @copydoc ::boost::container::flat_set::flat_set() | |
11fdf7f2 TL |
1094 | BOOST_CONTAINER_FORCEINLINE flat_multiset() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<AllocatorOrContainer>::value && |
1095 | dtl::is_nothrow_default_constructible<Compare>::value) | |
b32b8144 | 1096 | : tree_t() |
7c673cae FG |
1097 | {} |
1098 | ||
b32b8144 FG |
1099 | //! @copydoc ::boost::container::flat_set::flat_set(const Compare&) |
1100 | BOOST_CONTAINER_FORCEINLINE explicit flat_multiset(const Compare& comp) | |
1101 | : tree_t(comp) | |
7c673cae FG |
1102 | {} |
1103 | ||
1104 | //! @copydoc ::boost::container::flat_set::flat_set(const allocator_type&) | |
b32b8144 FG |
1105 | BOOST_CONTAINER_FORCEINLINE explicit flat_multiset(const allocator_type& a) |
1106 | : tree_t(a) | |
7c673cae FG |
1107 | {} |
1108 | ||
b32b8144 FG |
1109 | //! @copydoc ::boost::container::flat_set::flat_set(const Compare&, const allocator_type&) |
1110 | BOOST_CONTAINER_FORCEINLINE flat_multiset(const Compare& comp, const allocator_type& a) | |
1111 | : tree_t(comp, a) | |
1112 | {} | |
1113 | ||
1114 | //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator) | |
7c673cae | 1115 | template <class InputIterator> |
b32b8144 FG |
1116 | BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last) |
1117 | : tree_t(false, first, last) | |
7c673cae FG |
1118 | {} |
1119 | ||
1120 | //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const allocator_type&) | |
1121 | template <class InputIterator> | |
b32b8144 FG |
1122 | BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const allocator_type& a) |
1123 | : tree_t(false, first, last, a) | |
1124 | {} | |
1125 | ||
1126 | //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp) | |
1127 | template <class InputIterator> | |
1128 | BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const Compare& comp) | |
1129 | : tree_t(false, first, last, comp) | |
1130 | {} | |
1131 | ||
1132 | //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp, const allocator_type&) | |
1133 | template <class InputIterator> | |
1134 | BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) | |
1135 | : tree_t(false, first, last, comp, a) | |
1136 | {} | |
1137 | ||
1138 | //! <b>Effects</b>: Constructs an empty flat_multiset and | |
1139 | //! inserts elements from the ordered range [first ,last ). This function | |
1140 | //! is more efficient than the normal range creation for ordered ranges. | |
1141 | //! | |
1142 | //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. | |
1143 | //! | |
1144 | //! <b>Complexity</b>: Linear in N. | |
1145 | //! | |
1146 | //! <b>Note</b>: Non-standard extension. | |
1147 | template <class InputIterator> | |
1148 | BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last) | |
1149 | : tree_t(ordered_range, first, last) | |
1150 | {} | |
1151 | ||
1152 | //! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and | |
1153 | //! inserts elements from the ordered range [first ,last ). This function | |
1154 | //! is more efficient than the normal range creation for ordered ranges. | |
1155 | //! | |
1156 | //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. | |
1157 | //! | |
1158 | //! <b>Complexity</b>: Linear in N. | |
1159 | //! | |
1160 | //! <b>Note</b>: Non-standard extension. | |
1161 | template <class InputIterator> | |
1162 | BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp) | |
1163 | : tree_t(ordered_range, first, last, comp) | |
7c673cae FG |
1164 | {} |
1165 | ||
1166 | //! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and | |
b32b8144 | 1167 | //! allocator, and inserts elements from the ordered range [first, last ). This function |
7c673cae FG |
1168 | //! is more efficient than the normal range creation for ordered ranges. |
1169 | //! | |
1170 | //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. | |
1171 | //! | |
1172 | //! <b>Complexity</b>: Linear in N. | |
1173 | //! | |
1174 | //! <b>Note</b>: Non-standard extension. | |
1175 | template <class InputIterator> | |
b32b8144 FG |
1176 | BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) |
1177 | : tree_t(ordered_range, first, last, comp, a) | |
7c673cae FG |
1178 | {} |
1179 | ||
1180 | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) | |
b32b8144 FG |
1181 | //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type) |
1182 | BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il) | |
1183 | : tree_t(false, il.begin(), il.end()) | |
7c673cae FG |
1184 | {} |
1185 | ||
1186 | //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const allocator_type&) | |
b32b8144 FG |
1187 | BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const allocator_type& a) |
1188 | : tree_t(false, il.begin(), il.end(), a) | |
1189 | {} | |
1190 | ||
1191 | //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const Compare& comp) | |
1192 | BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const Compare& comp) | |
1193 | : tree_t(false, il.begin(), il.end(), comp) | |
1194 | {} | |
1195 | ||
1196 | //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const Compare& comp, const allocator_type&) | |
1197 | BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) | |
1198 | : tree_t(false, il.begin(), il.end(), comp, a) | |
1199 | {} | |
1200 | ||
1201 | //! <b>Effects</b>: Constructs an empty containerand | |
1202 | //! inserts elements from the ordered unique range [il.begin(), il.end()). This function | |
1203 | //! is more efficient than the normal range creation for ordered ranges. | |
1204 | //! | |
1205 | //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. | |
1206 | //! | |
1207 | //! <b>Complexity</b>: Linear in N. | |
1208 | //! | |
1209 | //! <b>Note</b>: Non-standard extension. | |
1210 | BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il) | |
1211 | : tree_t(ordered_range, il.begin(), il.end()) | |
1212 | {} | |
1213 | ||
1214 | //! <b>Effects</b>: Constructs an empty container using the specified comparison object and | |
1215 | //! inserts elements from the ordered unique range [il.begin(), il.end()). This function | |
1216 | //! is more efficient than the normal range creation for ordered ranges. | |
1217 | //! | |
1218 | //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. | |
1219 | //! | |
1220 | //! <b>Complexity</b>: Linear in N. | |
1221 | //! | |
1222 | //! <b>Note</b>: Non-standard extension. | |
1223 | BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp) | |
1224 | : tree_t(ordered_range, il.begin(), il.end(), comp) | |
7c673cae FG |
1225 | {} |
1226 | ||
1227 | //! <b>Effects</b>: Constructs an empty container using the specified comparison object and | |
1228 | //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function | |
1229 | //! is more efficient than the normal range creation for ordered ranges. | |
1230 | //! | |
1231 | //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. | |
1232 | //! | |
1233 | //! <b>Complexity</b>: Linear in N. | |
1234 | //! | |
1235 | //! <b>Note</b>: Non-standard extension. | |
b32b8144 FG |
1236 | BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) |
1237 | : tree_t(ordered_range, il.begin(), il.end(), comp, a) | |
7c673cae FG |
1238 | {} |
1239 | #endif | |
1240 | ||
1241 | //! @copydoc ::boost::container::flat_set::flat_set(const flat_set &) | |
b32b8144 FG |
1242 | BOOST_CONTAINER_FORCEINLINE flat_multiset(const flat_multiset& x) |
1243 | : tree_t(static_cast<const tree_t&>(x)) | |
7c673cae FG |
1244 | {} |
1245 | ||
1246 | //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&) | |
b32b8144 | 1247 | BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x) |
11fdf7f2 | 1248 | BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value) |
b32b8144 | 1249 | : tree_t(boost::move(static_cast<tree_t&>(x))) |
7c673cae FG |
1250 | {} |
1251 | ||
1252 | //! @copydoc ::boost::container::flat_set::flat_set(const flat_set &, const allocator_type &) | |
b32b8144 FG |
1253 | BOOST_CONTAINER_FORCEINLINE flat_multiset(const flat_multiset& x, const allocator_type &a) |
1254 | : tree_t(static_cast<const tree_t&>(x), a) | |
7c673cae FG |
1255 | {} |
1256 | ||
1257 | //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&, const allocator_type &) | |
b32b8144 FG |
1258 | BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x, const allocator_type &a) |
1259 | : tree_t(BOOST_MOVE_BASE(tree_t, x), a) | |
7c673cae FG |
1260 | {} |
1261 | ||
1262 | //! @copydoc ::boost::container::flat_set::operator=(const flat_set &) | |
b32b8144 FG |
1263 | BOOST_CONTAINER_FORCEINLINE flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x) |
1264 | { return static_cast<flat_multiset&>(this->tree_t::operator=(static_cast<const tree_t&>(x))); } | |
7c673cae FG |
1265 | |
1266 | //! @copydoc ::boost::container::flat_set::operator=(flat_set &&) | |
b32b8144 | 1267 | BOOST_CONTAINER_FORCEINLINE flat_multiset& operator=(BOOST_RV_REF(flat_multiset) x) |
7c673cae FG |
1268 | BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || |
1269 | allocator_traits_type::is_always_equal::value) && | |
11fdf7f2 | 1270 | boost::container::dtl::is_nothrow_move_assignable<Compare>::value) |
b32b8144 | 1271 | { return static_cast<flat_multiset&>(this->tree_t::operator=(BOOST_MOVE_BASE(tree_t, x))); } |
7c673cae FG |
1272 | |
1273 | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) | |
1274 | //! @copydoc ::boost::container::flat_set::operator=(std::initializer_list<value_type>) | |
1275 | flat_multiset& operator=(std::initializer_list<value_type> il) | |
1276 | { | |
1277 | this->clear(); | |
1278 | this->insert(il.begin(), il.end()); | |
1279 | return *this; | |
1280 | } | |
1281 | #endif | |
1282 | ||
1283 | #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
1284 | ||
1285 | //! @copydoc ::boost::container::flat_set::get_allocator() | |
1286 | allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1287 | ||
1288 | //! @copydoc ::boost::container::flat_set::get_stored_allocator() | |
1289 | stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW; | |
1290 | ||
1291 | //! @copydoc ::boost::container::flat_set::get_stored_allocator() const | |
1292 | const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1293 | ||
1294 | //! @copydoc ::boost::container::flat_set::begin() | |
1295 | iterator begin() BOOST_NOEXCEPT_OR_NOTHROW; | |
1296 | ||
1297 | //! @copydoc ::boost::container::flat_set::begin() const | |
1298 | const_iterator begin() const; | |
1299 | ||
1300 | //! @copydoc ::boost::container::flat_set::cbegin() const | |
1301 | const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1302 | ||
1303 | //! @copydoc ::boost::container::flat_set::end() | |
1304 | iterator end() BOOST_NOEXCEPT_OR_NOTHROW; | |
1305 | ||
1306 | //! @copydoc ::boost::container::flat_set::end() const | |
1307 | const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1308 | ||
1309 | //! @copydoc ::boost::container::flat_set::cend() const | |
1310 | const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1311 | ||
1312 | //! @copydoc ::boost::container::flat_set::rbegin() | |
1313 | reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW; | |
1314 | ||
1315 | //! @copydoc ::boost::container::flat_set::rbegin() const | |
1316 | const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1317 | ||
1318 | //! @copydoc ::boost::container::flat_set::crbegin() const | |
1319 | const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1320 | ||
1321 | //! @copydoc ::boost::container::flat_set::rend() | |
1322 | reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW; | |
1323 | ||
1324 | //! @copydoc ::boost::container::flat_set::rend() const | |
1325 | const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1326 | ||
1327 | //! @copydoc ::boost::container::flat_set::crend() const | |
1328 | const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1329 | ||
1330 | //! @copydoc ::boost::container::flat_set::empty() const | |
1331 | bool empty() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1332 | ||
1333 | //! @copydoc ::boost::container::flat_set::size() const | |
1334 | size_type size() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1335 | ||
1336 | //! @copydoc ::boost::container::flat_set::max_size() const | |
1337 | size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1338 | ||
1339 | //! @copydoc ::boost::container::flat_set::capacity() const | |
1340 | size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW; | |
1341 | ||
1342 | //! @copydoc ::boost::container::flat_set::reserve(size_type) | |
1343 | void reserve(size_type cnt); | |
1344 | ||
1345 | //! @copydoc ::boost::container::flat_set::shrink_to_fit() | |
1346 | void shrink_to_fit(); | |
1347 | ||
1348 | #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
1349 | ||
1350 | ////////////////////////////////////////////// | |
1351 | // | |
1352 | // modifiers | |
1353 | // | |
1354 | ////////////////////////////////////////////// | |
1355 | ||
1356 | #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
1357 | ||
1358 | //! <b>Effects</b>: Inserts an object of type Key constructed with | |
1359 | //! std::forward<Args>(args)... and returns the iterator pointing to the | |
1360 | //! newly inserted element. | |
1361 | //! | |
1362 | //! <b>Complexity</b>: Logarithmic search time plus linear insertion | |
1363 | //! to the elements with bigger keys than x. | |
1364 | //! | |
1365 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
1366 | template <class... Args> | |
b32b8144 FG |
1367 | BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_FWD_REF(Args)... args) |
1368 | { return this->tree_t::emplace_equal(boost::forward<Args>(args)...); } | |
7c673cae FG |
1369 | |
1370 | //! <b>Effects</b>: Inserts an object of type Key constructed with | |
1371 | //! std::forward<Args>(args)... in the container. | |
1372 | //! p is a hint pointing to where the insert should start to search. | |
1373 | //! | |
1374 | //! <b>Returns</b>: An iterator pointing to the element with key equivalent | |
1375 | //! to the key of x. | |
1376 | //! | |
1377 | //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted | |
1378 | //! right before p) plus insertion linear to the elements with bigger keys than x. | |
1379 | //! | |
1380 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
1381 | template <class... Args> | |
b32b8144 FG |
1382 | BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args) |
1383 | { return this->tree_t::emplace_hint_equal(p, boost::forward<Args>(args)...); } | |
7c673cae FG |
1384 | |
1385 | #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | |
1386 | ||
1387 | #define BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE(N) \ | |
1388 | BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ | |
b32b8144 FG |
1389 | BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\ |
1390 | { return this->tree_t::emplace_equal(BOOST_MOVE_FWD##N); }\ | |
7c673cae FG |
1391 | \ |
1392 | BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ | |
b32b8144 FG |
1393 | BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ |
1394 | { return this->tree_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ | |
7c673cae FG |
1395 | // |
1396 | BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE) | |
1397 | #undef BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE | |
1398 | ||
1399 | #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | |
1400 | ||
1401 | #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
1402 | //! <b>Effects</b>: Inserts x and returns the iterator pointing to the | |
1403 | //! newly inserted element. | |
1404 | //! | |
1405 | //! <b>Complexity</b>: Logarithmic search time plus linear insertion | |
1406 | //! to the elements with bigger keys than x. | |
1407 | //! | |
1408 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
1409 | iterator insert(const value_type &x); | |
1410 | ||
1411 | //! <b>Effects</b>: Inserts a new value_type move constructed from x | |
1412 | //! and returns the iterator pointing to the newly inserted element. | |
1413 | //! | |
1414 | //! <b>Complexity</b>: Logarithmic search time plus linear insertion | |
1415 | //! to the elements with bigger keys than x. | |
1416 | //! | |
1417 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
1418 | iterator insert(value_type &&x); | |
1419 | #else | |
1420 | BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert) | |
1421 | #endif | |
1422 | ||
1423 | #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
1424 | //! <b>Effects</b>: Inserts a copy of x in the container. | |
1425 | //! p is a hint pointing to where the insert should start to search. | |
1426 | //! | |
1427 | //! <b>Returns</b>: An iterator pointing to the element with key equivalent | |
1428 | //! to the key of x. | |
1429 | //! | |
1430 | //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted | |
1431 | //! right before p) plus insertion linear to the elements with bigger keys than x. | |
1432 | //! | |
1433 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
1434 | iterator insert(const_iterator p, const value_type &x); | |
1435 | ||
1436 | //! <b>Effects</b>: Inserts a new value move constructed from x in the container. | |
1437 | //! p is a hint pointing to where the insert should start to search. | |
1438 | //! | |
1439 | //! <b>Returns</b>: An iterator pointing to the element with key equivalent | |
1440 | //! to the key of x. | |
1441 | //! | |
1442 | //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted | |
1443 | //! right before p) plus insertion linear to the elements with bigger keys than x. | |
1444 | //! | |
1445 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
1446 | iterator insert(const_iterator p, value_type &&x); | |
1447 | #else | |
1448 | BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator) | |
1449 | #endif | |
1450 | ||
1451 | //! <b>Requires</b>: first, last are not iterators into *this. | |
1452 | //! | |
1453 | //! <b>Effects</b>: inserts each element from the range [first,last) . | |
1454 | //! | |
11fdf7f2 | 1455 | //! <b>Complexity</b>: N log(N). |
7c673cae FG |
1456 | //! |
1457 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
1458 | template <class InputIterator> | |
b32b8144 FG |
1459 | BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last) |
1460 | { this->tree_t::insert_equal(first, last); } | |
7c673cae FG |
1461 | |
1462 | //! <b>Requires</b>: first, last are not iterators into *this and | |
1463 | //! must be ordered according to the predicate. | |
1464 | //! | |
1465 | //! <b>Effects</b>: inserts each element from the range [first,last) .This function | |
1466 | //! is more efficient than the normal range creation for ordered ranges. | |
1467 | //! | |
11fdf7f2 | 1468 | //! <b>Complexity</b>: Linear. |
7c673cae FG |
1469 | //! |
1470 | //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. | |
1471 | template <class InputIterator> | |
b32b8144 FG |
1472 | BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, InputIterator first, InputIterator last) |
1473 | { this->tree_t::insert_equal(ordered_range, first, last); } | |
7c673cae FG |
1474 | |
1475 | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) | |
1476 | //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()). | |
1477 | //! | |
11fdf7f2 | 1478 | //! <b>Complexity</b>: N log(N). |
7c673cae FG |
1479 | //! |
1480 | //! <b>Note</b>: If an element is inserted it might invalidate elements. | |
b32b8144 FG |
1481 | BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il) |
1482 | { this->tree_t::insert_equal(il.begin(), il.end()); } | |
7c673cae FG |
1483 | |
1484 | //! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate. | |
1485 | //! | |
1486 | //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()). This function | |
1487 | //! is more efficient than the normal range creation for ordered ranges. | |
1488 | //! | |
11fdf7f2 | 1489 | //! <b>Complexity</b>: Linear. |
7c673cae FG |
1490 | //! |
1491 | //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. | |
b32b8144 FG |
1492 | BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, std::initializer_list<value_type> il) |
1493 | { this->tree_t::insert_equal(ordered_range, il.begin(), il.end()); } | |
7c673cae FG |
1494 | #endif |
1495 | ||
b32b8144 | 1496 | //! @copydoc ::boost::container::flat_multimap::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&) |
7c673cae | 1497 | template<class C2> |
b32b8144 FG |
1498 | BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, AllocatorOrContainer>& source) |
1499 | { this->tree_t::merge_equal(source.tree()); } | |
7c673cae | 1500 | |
b32b8144 | 1501 | //! @copydoc ::boost::container::flat_multiset::merge(flat_multiset<Key, C2, AllocatorOrContainer>&) |
7c673cae | 1502 | template<class C2> |
b32b8144 FG |
1503 | BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source) |
1504 | { return this->merge(static_cast<flat_multiset<Key, C2, AllocatorOrContainer>&>(source)); } | |
7c673cae | 1505 | |
b32b8144 | 1506 | //! @copydoc ::boost::container::flat_multimap::merge(flat_map<Key, T, C2, AllocatorOrContainer>&) |
7c673cae | 1507 | template<class C2> |
b32b8144 FG |
1508 | BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, AllocatorOrContainer>& source) |
1509 | { this->tree_t::merge_equal(source.tree()); } | |
7c673cae | 1510 | |
b32b8144 | 1511 | //! @copydoc ::boost::container::flat_multiset::merge(flat_set<Key, C2, AllocatorOrContainer>&) |
7c673cae | 1512 | template<class C2> |
b32b8144 FG |
1513 | BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source) |
1514 | { return this->merge(static_cast<flat_set<Key, C2, AllocatorOrContainer>&>(source)); } | |
7c673cae FG |
1515 | |
1516 | #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | |
1517 | ||
1518 | //! @copydoc ::boost::container::flat_set::erase(const_iterator) | |
1519 | iterator erase(const_iterator p); | |
1520 | ||
1521 | //! @copydoc ::boost::container::flat_set::erase(const key_type&) | |
1522 | size_type erase(const key_type& x); | |
1523 | ||
1524 | //! @copydoc ::boost::container::flat_set::erase(const_iterator,const_iterator) | |
1525 | iterator erase(const_iterator first, const_iterator last); | |
1526 | ||
1527 | //! @copydoc ::boost::container::flat_set::swap | |
1528 | void swap(flat_multiset& x) | |
1529 | BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value | |
11fdf7f2 | 1530 | && boost::container::dtl::is_nothrow_swappable<Compare>::value ); |
7c673cae FG |
1531 | |
1532 | //! @copydoc ::boost::container::flat_set::clear | |
1533 | void clear() BOOST_NOEXCEPT_OR_NOTHROW; | |
1534 | ||
1535 | //! @copydoc ::boost::container::flat_set::key_comp | |
1536 | key_compare key_comp() const; | |
1537 | ||
1538 | //! @copydoc ::boost::container::flat_set::value_comp | |
1539 | value_compare value_comp() const; | |
1540 | ||
1541 | //! @copydoc ::boost::container::flat_set::find(const key_type& ) | |
1542 | iterator find(const key_type& x); | |
1543 | ||
1544 | //! @copydoc ::boost::container::flat_set::find(const key_type& ) const | |
1545 | const_iterator find(const key_type& x) const; | |
1546 | ||
1547 | //! @copydoc ::boost::container::flat_set::nth(size_type) | |
1548 | iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW; | |
1549 | ||
1550 | //! @copydoc ::boost::container::flat_set::nth(size_type) const | |
1551 | const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW; | |
1552 | ||
1553 | //! @copydoc ::boost::container::flat_set::index_of(iterator) | |
1554 | size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW; | |
1555 | ||
1556 | //! @copydoc ::boost::container::flat_set::index_of(const_iterator) const | |
1557 | size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW; | |
1558 | ||
1559 | //! @copydoc ::boost::container::flat_set::count(const key_type& ) const | |
1560 | size_type count(const key_type& x) const; | |
1561 | ||
1562 | //! @copydoc ::boost::container::flat_set::lower_bound(const key_type& ) | |
1563 | iterator lower_bound(const key_type& x); | |
1564 | ||
1565 | //! @copydoc ::boost::container::flat_set::lower_bound(const key_type& ) const | |
1566 | const_iterator lower_bound(const key_type& x) const; | |
1567 | ||
1568 | //! @copydoc ::boost::container::flat_set::upper_bound(const key_type& ) | |
1569 | iterator upper_bound(const key_type& x); | |
1570 | ||
1571 | //! @copydoc ::boost::container::flat_set::upper_bound(const key_type& ) const | |
1572 | const_iterator upper_bound(const key_type& x) const; | |
1573 | ||
1574 | //! @copydoc ::boost::container::flat_set::equal_range(const key_type& ) const | |
1575 | std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const; | |
1576 | ||
1577 | //! @copydoc ::boost::container::flat_set::equal_range(const key_type& ) | |
1578 | std::pair<iterator,iterator> equal_range(const key_type& x); | |
1579 | ||
1580 | //! <b>Effects</b>: Returns true if x and y are equal | |
1581 | //! | |
1582 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
1583 | friend bool operator==(const flat_multiset& x, const flat_multiset& y); | |
1584 | ||
1585 | //! <b>Effects</b>: Returns true if x and y are unequal | |
1586 | //! | |
1587 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
1588 | friend bool operator!=(const flat_multiset& x, const flat_multiset& y); | |
1589 | ||
1590 | //! <b>Effects</b>: Returns true if x is less than y | |
1591 | //! | |
1592 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
1593 | friend bool operator<(const flat_multiset& x, const flat_multiset& y); | |
1594 | ||
1595 | //! <b>Effects</b>: Returns true if x is greater than y | |
1596 | //! | |
1597 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
1598 | friend bool operator>(const flat_multiset& x, const flat_multiset& y); | |
1599 | ||
1600 | //! <b>Effects</b>: Returns true if x is equal or less than y | |
1601 | //! | |
1602 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
1603 | friend bool operator<=(const flat_multiset& x, const flat_multiset& y); | |
1604 | ||
1605 | //! <b>Effects</b>: Returns true if x is equal or greater than y | |
1606 | //! | |
1607 | //! <b>Complexity</b>: Linear to the number of elements in the container. | |
1608 | friend bool operator>=(const flat_multiset& x, const flat_multiset& y); | |
1609 | ||
1610 | //! <b>Effects</b>: x.swap(y) | |
1611 | //! | |
1612 | //! <b>Complexity</b>: Constant. | |
1613 | friend void swap(flat_multiset& x, flat_multiset& y); | |
1614 | ||
b32b8144 FG |
1615 | //! <b>Effects</b>: Extracts the internal sequence container. |
1616 | //! | |
1617 | //! <b>Complexity</b>: Same as the move constructor of sequence_type, usually constant. | |
1618 | //! | |
1619 | //! <b>Postcondition</b>: this->empty() | |
1620 | //! | |
1621 | //! <b>Throws</b>: If secuence_type's move constructor throws | |
1622 | sequence_type extract_sequence(); | |
1623 | ||
7c673cae FG |
1624 | #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED |
1625 | ||
b32b8144 FG |
1626 | //! <b>Effects</b>: Discards the internally hold sequence container and adopts the |
1627 | //! one passed externally using the move assignment. | |
1628 | //! | |
1629 | //! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size() | |
1630 | //! | |
1631 | //! <b>Throws</b>: If the comparison or the move constructor throws | |
1632 | BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq) | |
1633 | { this->tree_t::adopt_sequence_equal(boost::move(seq)); } | |
1634 | ||
1635 | //! <b>Requires</b>: seq shall be ordered according to this->compare() | |
1636 | //! | |
1637 | //! <b>Effects</b>: Discards the internally hold sequence container and adopts the | |
1638 | //! one passed externally using the move assignment. | |
1639 | //! | |
1640 | //! <b>Complexity</b>: Assuming O(1) move assignment, O(1) | |
1641 | //! | |
1642 | //! <b>Throws</b>: If the move assignment throws | |
1643 | BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_range_t, BOOST_RV_REF(sequence_type) seq) | |
1644 | { this->tree_t::adopt_sequence_equal(ordered_range_t(), boost::move(seq)); } | |
1645 | ||
7c673cae FG |
1646 | #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED |
1647 | private: | |
1648 | template <class KeyType> | |
b32b8144 FG |
1649 | BOOST_CONTAINER_FORCEINLINE iterator priv_insert(BOOST_FWD_REF(KeyType) x) |
1650 | { return this->tree_t::insert_equal(::boost::forward<KeyType>(x)); } | |
7c673cae FG |
1651 | |
1652 | template <class KeyType> | |
b32b8144 FG |
1653 | BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) |
1654 | { return this->tree_t::insert_equal(p, ::boost::forward<KeyType>(x)); } | |
7c673cae FG |
1655 | #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED |
1656 | }; | |
1657 | ||
1658 | #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
1659 | ||
1660 | } //namespace container { | |
1661 | ||
1662 | //!has_trivial_destructor_after_move<> == true_type | |
1663 | //!specialization for optimizations | |
b32b8144 FG |
1664 | template <class Key, class Compare, class AllocatorOrContainer> |
1665 | struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, Compare, AllocatorOrContainer> > | |
7c673cae | 1666 | { |
b32b8144 FG |
1667 | typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer; |
1668 | static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value && | |
7c673cae FG |
1669 | ::boost::has_trivial_destructor_after_move<pointer>::value && |
1670 | ::boost::has_trivial_destructor_after_move<Compare>::value; | |
1671 | }; | |
1672 | ||
1673 | namespace container { | |
1674 | ||
1675 | #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
1676 | ||
1677 | }} | |
1678 | ||
1679 | #include <boost/container/detail/config_end.hpp> | |
1680 | ||
1681 | #endif // BOOST_CONTAINER_FLAT_SET_HPP |