annotate DEPENDENCIES/generic/include/boost/container/flat_set.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@101 3 // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
Chris@16 4 // Software License, Version 1.0. (See accompanying file
Chris@16 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 //
Chris@16 7 // See http://www.boost.org/libs/container for documentation.
Chris@16 8 //
Chris@16 9 //////////////////////////////////////////////////////////////////////////////
Chris@16 10 #ifndef BOOST_CONTAINER_FLAT_SET_HPP
Chris@16 11 #define BOOST_CONTAINER_FLAT_SET_HPP
Chris@16 12
Chris@101 13 #ifndef BOOST_CONFIG_HPP
Chris@101 14 # include <boost/config.hpp>
Chris@101 15 #endif
Chris@101 16
Chris@101 17 #if defined(BOOST_HAS_PRAGMA_ONCE)
Chris@16 18 # pragma once
Chris@16 19 #endif
Chris@16 20
Chris@16 21 #include <boost/container/detail/config_begin.hpp>
Chris@16 22 #include <boost/container/detail/workaround.hpp>
Chris@16 23
Chris@101 24 // container
Chris@101 25 #include <boost/container/allocator_traits.hpp>
Chris@16 26 #include <boost/container/container_fwd.hpp>
Chris@101 27 #include <boost/container/new_allocator.hpp> //new_allocator
Chris@101 28 // container/detail
Chris@16 29 #include <boost/container/detail/flat_tree.hpp>
Chris@16 30 #include <boost/container/detail/mpl.hpp>
Chris@101 31 // move
Chris@101 32 #include <boost/move/traits.hpp>
Chris@101 33 #include <boost/move/utility_core.hpp>
Chris@101 34 // move/detail
Chris@101 35 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
Chris@101 36 #include <boost/move/detail/fwd_macros.hpp>
Chris@101 37 #endif
Chris@16 38 #include <boost/move/detail/move_helpers.hpp>
Chris@101 39 // intrusive/detail
Chris@101 40 #include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
Chris@101 41 #include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal
Chris@101 42 // std
Chris@101 43 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 44 #include <initializer_list>
Chris@101 45 #endif
Chris@16 46
Chris@16 47 namespace boost {
Chris@16 48 namespace container {
Chris@16 49
Chris@16 50 //! flat_set is a Sorted Associative Container that stores objects of type Key.
Chris@16 51 //! It is also a Unique Associative Container, meaning that no two elements are the same.
Chris@16 52 //!
Chris@16 53 //! flat_set is similar to std::set but it's implemented like an ordered vector.
Chris@16 54 //! This means that inserting a new element into a flat_set invalidates
Chris@16 55 //! previous iterators and references
Chris@16 56 //!
Chris@16 57 //! Erasing an element of a flat_set invalidates iterators and references
Chris@16 58 //! pointing to elements that come after (their keys are bigger) the erased element.
Chris@16 59 //!
Chris@16 60 //! This container provides random-access iterators.
Chris@101 61 //!
Chris@101 62 //! \tparam Key is the type to be inserted in the set, which is also the key_type
Chris@101 63 //! \tparam Compare is the comparison functor used to order keys
Chris@101 64 //! \tparam Allocator is the allocator to be used to allocate memory for this container
Chris@16 65 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@101 66 template <class Key, class Compare = std::less<Key>, class Allocator = new_allocator<Key> >
Chris@16 67 #else
Chris@16 68 template <class Key, class Compare, class Allocator>
Chris@16 69 #endif
Chris@16 70 class flat_set
Chris@101 71 ///@cond
Chris@101 72 : public container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator>
Chris@101 73 ///@endcond
Chris@16 74 {
Chris@101 75 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 76 private:
Chris@16 77 BOOST_COPYABLE_AND_MOVABLE(flat_set)
Chris@101 78 typedef container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator> base_t;
Chris@101 79 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 80
Chris@16 81 public:
Chris@16 82 //////////////////////////////////////////////
Chris@16 83 //
Chris@16 84 // types
Chris@16 85 //
Chris@16 86 //////////////////////////////////////////////
Chris@16 87 typedef Key key_type;
Chris@16 88 typedef Key value_type;
Chris@16 89 typedef Compare key_compare;
Chris@16 90 typedef Compare value_compare;
Chris@101 91 typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
Chris@16 92 typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
Chris@16 93 typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
Chris@16 94 typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
Chris@16 95 typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
Chris@16 96 typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
Chris@16 97 typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
Chris@16 98 typedef Allocator allocator_type;
Chris@101 99 typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
Chris@101 100 typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator;
Chris@101 101 typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator;
Chris@101 102 typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator;
Chris@101 103 typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator;
Chris@16 104
Chris@16 105 public:
Chris@16 106 //////////////////////////////////////////////
Chris@16 107 //
Chris@16 108 // construct/copy/destroy
Chris@16 109 //
Chris@16 110 //////////////////////////////////////////////
Chris@16 111
Chris@101 112 //! <b>Effects</b>: Default constructs an empty container.
Chris@16 113 //!
Chris@16 114 //! <b>Complexity</b>: Constant.
Chris@16 115 explicit flat_set()
Chris@101 116 : base_t()
Chris@16 117 {}
Chris@16 118
Chris@101 119 //! <b>Effects</b>: Constructs an empty container using the specified
Chris@16 120 //! comparison object and allocator.
Chris@16 121 //!
Chris@16 122 //! <b>Complexity</b>: Constant.
Chris@16 123 explicit flat_set(const Compare& comp,
Chris@16 124 const allocator_type& a = allocator_type())
Chris@101 125 : base_t(comp, a)
Chris@16 126 {}
Chris@16 127
Chris@101 128 //! <b>Effects</b>: Constructs an empty container using the specified allocator.
Chris@16 129 //!
Chris@16 130 //! <b>Complexity</b>: Constant.
Chris@16 131 explicit flat_set(const allocator_type& a)
Chris@101 132 : base_t(a)
Chris@16 133 {}
Chris@16 134
Chris@101 135 //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
Chris@16 136 //! allocator, and inserts elements from the range [first ,last ).
Chris@16 137 //!
Chris@16 138 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
Chris@16 139 //! comp and otherwise N logN, where N is last - first.
Chris@16 140 template <class InputIterator>
Chris@16 141 flat_set(InputIterator first, InputIterator last,
Chris@16 142 const Compare& comp = Compare(),
Chris@16 143 const allocator_type& a = allocator_type())
Chris@101 144 : base_t(true, first, last, comp, a)
Chris@16 145 {}
Chris@16 146
Chris@101 147 //! <b>Effects</b>: Constructs an empty container using the specified
Chris@101 148 //! allocator, and inserts elements from the range [first ,last ).
Chris@101 149 //!
Chris@101 150 //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
Chris@101 151 //! comp and otherwise N logN, where N is last - first.
Chris@101 152 template <class InputIterator>
Chris@101 153 flat_set(InputIterator first, InputIterator last, const allocator_type& a)
Chris@101 154 : base_t(true, first, last, Compare(), a)
Chris@101 155 {}
Chris@101 156
Chris@101 157 //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
Chris@16 158 //! allocator, and inserts elements from the ordered unique range [first ,last). This function
Chris@16 159 //! is more efficient than the normal range creation for ordered ranges.
Chris@16 160 //!
Chris@16 161 //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
Chris@16 162 //! unique values.
Chris@16 163 //!
Chris@16 164 //! <b>Complexity</b>: Linear in N.
Chris@16 165 //!
Chris@16 166 //! <b>Note</b>: Non-standard extension.
Chris@16 167 template <class InputIterator>
Chris@16 168 flat_set(ordered_unique_range_t, InputIterator first, InputIterator last,
Chris@16 169 const Compare& comp = Compare(),
Chris@16 170 const allocator_type& a = allocator_type())
Chris@101 171 : base_t(ordered_range, first, last, comp, a)
Chris@16 172 {}
Chris@16 173
Chris@101 174 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 175 //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
Chris@101 176 //! allocator, and inserts elements from the range [il.begin(), il.end()).
Chris@101 177 //!
Chris@101 178 //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
Chris@101 179 //! comp and otherwise N logN, where N is il.begin() - il.end().
Chris@101 180 flat_set(std::initializer_list<value_type> il, const Compare& comp = Compare(),
Chris@101 181 const allocator_type& a = allocator_type())
Chris@101 182 : base_t(true, il.begin(), il.end(), comp, a)
Chris@101 183 {}
Chris@101 184
Chris@101 185 //! <b>Effects</b>: Constructs an empty container using the specified
Chris@101 186 //! allocator, and inserts elements from the range [il.begin(), il.end()).
Chris@101 187 //!
Chris@101 188 //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
Chris@101 189 //! comp and otherwise N logN, where N is il.begin() - il.end().
Chris@101 190 flat_set(std::initializer_list<value_type> il, const allocator_type& a)
Chris@101 191 : base_t(true, il.begin(), il.end(), Compare(), a)
Chris@101 192 {}
Chris@101 193
Chris@101 194 //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
Chris@101 195 //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function
Chris@101 196 //! is more efficient than the normal range creation for ordered ranges.
Chris@101 197 //!
Chris@101 198 //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
Chris@101 199 //! unique values.
Chris@101 200 //!
Chris@101 201 //! <b>Complexity</b>: Linear in N.
Chris@101 202 //!
Chris@101 203 //! <b>Note</b>: Non-standard extension.
Chris@101 204 flat_set(ordered_unique_range_t, std::initializer_list<value_type> il,
Chris@101 205 const Compare& comp = Compare(), const allocator_type& a = allocator_type())
Chris@101 206 : base_t(ordered_range, il.begin(), il.end(), comp, a)
Chris@101 207 {}
Chris@101 208 #endif
Chris@101 209
Chris@101 210 //! <b>Effects</b>: Copy constructs the container.
Chris@16 211 //!
Chris@16 212 //! <b>Complexity</b>: Linear in x.size().
Chris@16 213 flat_set(const flat_set& x)
Chris@101 214 : base_t(static_cast<const base_t&>(x))
Chris@16 215 {}
Chris@16 216
Chris@101 217 //! <b>Effects</b>: Move constructs thecontainer. Constructs *this using x's resources.
Chris@16 218 //!
Chris@16 219 //! <b>Complexity</b>: Constant.
Chris@16 220 //!
Chris@16 221 //! <b>Postcondition</b>: x is emptied.
Chris@101 222 flat_set(BOOST_RV_REF(flat_set) x)
Chris@101 223 : base_t(BOOST_MOVE_BASE(base_t, x))
Chris@16 224 {}
Chris@16 225
Chris@101 226 //! <b>Effects</b>: Copy constructs a container using the specified allocator.
Chris@16 227 //!
Chris@16 228 //! <b>Complexity</b>: Linear in x.size().
Chris@16 229 flat_set(const flat_set& x, const allocator_type &a)
Chris@101 230 : base_t(static_cast<const base_t&>(x), a)
Chris@16 231 {}
Chris@16 232
Chris@101 233 //! <b>Effects</b>: Move constructs a container using the specified allocator.
Chris@16 234 //! Constructs *this using x's resources.
Chris@16 235 //!
Chris@101 236 //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise
Chris@101 237 flat_set(BOOST_RV_REF(flat_set) x, const allocator_type &a)
Chris@101 238 : base_t(BOOST_MOVE_BASE(base_t, x), a)
Chris@16 239 {}
Chris@16 240
Chris@16 241 //! <b>Effects</b>: Makes *this a copy of x.
Chris@16 242 //!
Chris@16 243 //! <b>Complexity</b>: Linear in x.size().
Chris@16 244 flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
Chris@101 245 { return static_cast<flat_set&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
Chris@16 246
Chris@101 247 //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment
Chris@101 248 //! is false and (allocation throws or value_type's move constructor throws)
Chris@16 249 //!
Chris@101 250 //! <b>Complexity</b>: Constant if allocator_traits_type::
Chris@101 251 //! propagate_on_container_move_assignment is true or
Chris@101 252 //! this->get>allocator() == x.get_allocator(). Linear otherwise.
Chris@101 253 flat_set& operator=(BOOST_RV_REF(flat_set) x)
Chris@101 254 BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
Chris@101 255 && boost::container::container_detail::is_nothrow_move_assignable<Compare>::value )
Chris@101 256 { return static_cast<flat_set&>(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); }
Chris@16 257
Chris@101 258 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 259 //! <b>Effects</b>: Copy all elements from il to *this.
Chris@101 260 //!
Chris@101 261 //! <b>Complexity</b>: Linear in il.size().
Chris@101 262 flat_set& operator=(std::initializer_list<value_type> il)
Chris@101 263 {
Chris@101 264 this->clear();
Chris@101 265 this->insert(il.begin(), il.end());
Chris@101 266 return *this;
Chris@101 267 }
Chris@101 268 #endif
Chris@101 269
Chris@101 270 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@101 271 //! <b>Effects</b>: Returns a copy of the allocator that
Chris@16 272 //! was passed to the object's constructor.
Chris@16 273 //!
Chris@16 274 //! <b>Complexity</b>: Constant.
Chris@101 275 allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 276
Chris@16 277 //! <b>Effects</b>: Returns a reference to the internal allocator.
Chris@16 278 //!
Chris@16 279 //! <b>Throws</b>: Nothing
Chris@16 280 //!
Chris@16 281 //! <b>Complexity</b>: Constant.
Chris@16 282 //!
Chris@16 283 //! <b>Note</b>: Non-standard extension.
Chris@101 284 stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 285
Chris@16 286 //! <b>Effects</b>: Returns a reference to the internal allocator.
Chris@16 287 //!
Chris@16 288 //! <b>Throws</b>: Nothing
Chris@16 289 //!
Chris@16 290 //! <b>Complexity</b>: Constant.
Chris@16 291 //!
Chris@16 292 //! <b>Note</b>: Non-standard extension.
Chris@101 293 const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 294
Chris@16 295 //! <b>Effects</b>: Returns an iterator to the first element contained in the container.
Chris@16 296 //!
Chris@16 297 //! <b>Throws</b>: Nothing.
Chris@16 298 //!
Chris@16 299 //! <b>Complexity</b>: Constant.
Chris@101 300 iterator begin() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 301
Chris@16 302 //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
Chris@16 303 //!
Chris@16 304 //! <b>Throws</b>: Nothing.
Chris@16 305 //!
Chris@16 306 //! <b>Complexity</b>: Constant.
Chris@101 307 const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 308
Chris@16 309 //! <b>Effects</b>: Returns an iterator to the end of the container.
Chris@16 310 //!
Chris@16 311 //! <b>Throws</b>: Nothing.
Chris@16 312 //!
Chris@16 313 //! <b>Complexity</b>: Constant.
Chris@101 314 iterator end() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 315
Chris@16 316 //! <b>Effects</b>: Returns a const_iterator to the end of the container.
Chris@16 317 //!
Chris@16 318 //! <b>Throws</b>: Nothing.
Chris@16 319 //!
Chris@16 320 //! <b>Complexity</b>: Constant.
Chris@101 321 const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 322
Chris@16 323 //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
Chris@16 324 //! of the reversed container.
Chris@16 325 //!
Chris@16 326 //! <b>Throws</b>: Nothing.
Chris@16 327 //!
Chris@16 328 //! <b>Complexity</b>: Constant.
Chris@101 329 reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 330
Chris@16 331 //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
Chris@16 332 //! of the reversed container.
Chris@16 333 //!
Chris@16 334 //! <b>Throws</b>: Nothing.
Chris@16 335 //!
Chris@16 336 //! <b>Complexity</b>: Constant.
Chris@101 337 const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 338
Chris@16 339 //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
Chris@16 340 //! of the reversed container.
Chris@16 341 //!
Chris@16 342 //! <b>Throws</b>: Nothing.
Chris@16 343 //!
Chris@16 344 //! <b>Complexity</b>: Constant.
Chris@101 345 reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 346
Chris@16 347 //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
Chris@16 348 //! of the reversed container.
Chris@16 349 //!
Chris@16 350 //! <b>Throws</b>: Nothing.
Chris@16 351 //!
Chris@16 352 //! <b>Complexity</b>: Constant.
Chris@101 353 const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 354
Chris@16 355 //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
Chris@16 356 //!
Chris@16 357 //! <b>Throws</b>: Nothing.
Chris@16 358 //!
Chris@16 359 //! <b>Complexity</b>: Constant.
Chris@101 360 const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 361
Chris@16 362 //! <b>Effects</b>: Returns a const_iterator to the end of the container.
Chris@16 363 //!
Chris@16 364 //! <b>Throws</b>: Nothing.
Chris@16 365 //!
Chris@16 366 //! <b>Complexity</b>: Constant.
Chris@101 367 const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 368
Chris@16 369 //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
Chris@16 370 //! of the reversed container.
Chris@16 371 //!
Chris@16 372 //! <b>Throws</b>: Nothing.
Chris@16 373 //!
Chris@16 374 //! <b>Complexity</b>: Constant.
Chris@101 375 const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 376
Chris@16 377 //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
Chris@16 378 //! of the reversed container.
Chris@16 379 //!
Chris@16 380 //! <b>Throws</b>: Nothing.
Chris@16 381 //!
Chris@16 382 //! <b>Complexity</b>: Constant.
Chris@101 383 const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 384
Chris@16 385 //! <b>Effects</b>: Returns true if the container contains no elements.
Chris@16 386 //!
Chris@16 387 //! <b>Throws</b>: Nothing.
Chris@16 388 //!
Chris@16 389 //! <b>Complexity</b>: Constant.
Chris@101 390 bool empty() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 391
Chris@16 392 //! <b>Effects</b>: Returns the number of the elements contained in the container.
Chris@16 393 //!
Chris@16 394 //! <b>Throws</b>: Nothing.
Chris@16 395 //!
Chris@16 396 //! <b>Complexity</b>: Constant.
Chris@101 397 size_type size() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 398
Chris@16 399 //! <b>Effects</b>: Returns the largest possible size of the container.
Chris@16 400 //!
Chris@16 401 //! <b>Throws</b>: Nothing.
Chris@16 402 //!
Chris@16 403 //! <b>Complexity</b>: Constant.
Chris@101 404 size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 405
Chris@16 406 //! <b>Effects</b>: Number of elements for which memory has been allocated.
Chris@16 407 //! capacity() is always greater than or equal to size().
Chris@16 408 //!
Chris@16 409 //! <b>Throws</b>: Nothing.
Chris@16 410 //!
Chris@16 411 //! <b>Complexity</b>: Constant.
Chris@101 412 size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 413
Chris@16 414 //! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
Chris@16 415 //! effect. Otherwise, it is a request for allocation of additional memory.
Chris@16 416 //! If the request is successful, then capacity() is greater than or equal to
Chris@16 417 //! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
Chris@16 418 //!
Chris@16 419 //! <b>Throws</b>: If memory allocation allocation throws or Key's copy constructor throws.
Chris@16 420 //!
Chris@16 421 //! <b>Note</b>: If capacity() is less than "cnt", iterators and references to
Chris@16 422 //! to values might be invalidated.
Chris@101 423 void reserve(size_type cnt);
Chris@16 424
Chris@16 425 //! <b>Effects</b>: Tries to deallocate the excess of memory created
Chris@16 426 // with previous allocations. The size of the vector is unchanged
Chris@16 427 //!
Chris@16 428 //! <b>Throws</b>: If memory allocation throws, or Key's copy constructor throws.
Chris@16 429 //!
Chris@16 430 //! <b>Complexity</b>: Linear to size().
Chris@101 431 void shrink_to_fit();
Chris@101 432
Chris@101 433 #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 434
Chris@16 435 //////////////////////////////////////////////
Chris@16 436 //
Chris@16 437 // modifiers
Chris@16 438 //
Chris@16 439 //////////////////////////////////////////////
Chris@16 440
Chris@101 441 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 442
Chris@16 443 //! <b>Effects</b>: Inserts an object x of type Key constructed with
Chris@16 444 //! std::forward<Args>(args)... if and only if there is no element in the container
Chris@16 445 //! with key equivalent to the key of x.
Chris@16 446 //!
Chris@16 447 //! <b>Returns</b>: The bool component of the returned pair is true if and only
Chris@16 448 //! if the insertion takes place, and the iterator component of the pair
Chris@16 449 //! points to the element with key equivalent to the key of x.
Chris@16 450 //!
Chris@16 451 //! <b>Complexity</b>: Logarithmic search time plus linear insertion
Chris@16 452 //! to the elements with bigger keys than x.
Chris@16 453 //!
Chris@16 454 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 455 template <class... Args>
Chris@101 456 std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... args)
Chris@101 457 { return this->base_t::emplace_unique(boost::forward<Args>(args)...); }
Chris@16 458
Chris@16 459 //! <b>Effects</b>: Inserts an object of type Key constructed with
Chris@16 460 //! std::forward<Args>(args)... in the container if and only if there is
Chris@16 461 //! no element in the container with key equivalent to the key of x.
Chris@16 462 //! p is a hint pointing to where the insert should start to search.
Chris@16 463 //!
Chris@16 464 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
Chris@16 465 //! to the key of x.
Chris@16 466 //!
Chris@16 467 //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
Chris@16 468 //! right before p) plus insertion linear to the elements with bigger keys than x.
Chris@16 469 //!
Chris@16 470 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 471 template <class... Args>
Chris@101 472 iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
Chris@101 473 { return this->base_t::emplace_hint_unique(p, boost::forward<Args>(args)...); }
Chris@16 474
Chris@101 475 #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
Chris@16 476
Chris@101 477 #define BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE(N) \
Chris@101 478 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
Chris@101 479 std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##N)\
Chris@101 480 { return this->base_t::emplace_unique(BOOST_MOVE_FWD##N); }\
Chris@101 481 \
Chris@101 482 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
Chris@101 483 iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
Chris@101 484 { return this->base_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
Chris@101 485 //
Chris@101 486 BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE)
Chris@101 487 #undef BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE
Chris@16 488
Chris@101 489 #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
Chris@16 490
Chris@16 491 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 492 //! <b>Effects</b>: Inserts x if and only if there is no element in the container
Chris@16 493 //! with key equivalent to the key of x.
Chris@16 494 //!
Chris@16 495 //! <b>Returns</b>: The bool component of the returned pair is true if and only
Chris@16 496 //! if the insertion takes place, and the iterator component of the pair
Chris@16 497 //! points to the element with key equivalent to the key of x.
Chris@16 498 //!
Chris@16 499 //! <b>Complexity</b>: Logarithmic search time plus linear insertion
Chris@16 500 //! to the elements with bigger keys than x.
Chris@16 501 //!
Chris@16 502 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 503 std::pair<iterator, bool> insert(const value_type &x);
Chris@16 504
Chris@16 505 //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
Chris@16 506 //! only if there is no element in the container with key equivalent to the key of x.
Chris@16 507 //!
Chris@16 508 //! <b>Returns</b>: The bool component of the returned pair is true if and only
Chris@16 509 //! if the insertion takes place, and the iterator component of the pair
Chris@16 510 //! points to the element with key equivalent to the key of x.
Chris@16 511 //!
Chris@16 512 //! <b>Complexity</b>: Logarithmic search time plus linear insertion
Chris@16 513 //! to the elements with bigger keys than x.
Chris@16 514 //!
Chris@16 515 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 516 std::pair<iterator, bool> insert(value_type &&x);
Chris@16 517 #else
Chris@16 518 private:
Chris@16 519 typedef std::pair<iterator, bool> insert_return_pair;
Chris@16 520 public:
Chris@16 521 BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert)
Chris@16 522 #endif
Chris@16 523
Chris@16 524 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 525 //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
Chris@16 526 //! no element in the container with key equivalent to the key of x.
Chris@16 527 //! p is a hint pointing to where the insert should start to search.
Chris@16 528 //!
Chris@16 529 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
Chris@16 530 //! to the key of x.
Chris@16 531 //!
Chris@16 532 //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
Chris@16 533 //! right before p) plus insertion linear to the elements with bigger keys than x.
Chris@16 534 //!
Chris@16 535 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 536 iterator insert(const_iterator p, const value_type &x);
Chris@16 537
Chris@16 538 //! <b>Effects</b>: Inserts an element move constructed from x in the container.
Chris@16 539 //! p is a hint pointing to where the insert should start to search.
Chris@16 540 //!
Chris@16 541 //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
Chris@16 542 //!
Chris@16 543 //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
Chris@16 544 //! right before p) plus insertion linear to the elements with bigger keys than x.
Chris@16 545 //!
Chris@16 546 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@101 547 iterator insert(const_iterator p, value_type &&x);
Chris@16 548 #else
Chris@16 549 BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator)
Chris@16 550 #endif
Chris@16 551
Chris@16 552 //! <b>Requires</b>: first, last are not iterators into *this.
Chris@16 553 //!
Chris@16 554 //! <b>Effects</b>: inserts each element from the range [first,last) if and only
Chris@16 555 //! if there is no element with key equivalent to the key of that element.
Chris@16 556 //!
Chris@16 557 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
Chris@16 558 //! search time plus N*size() insertion time.
Chris@16 559 //!
Chris@16 560 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 561 template <class InputIterator>
Chris@16 562 void insert(InputIterator first, InputIterator last)
Chris@101 563 { this->base_t::insert_unique(first, last); }
Chris@16 564
Chris@16 565 //! <b>Requires</b>: first, last are not iterators into *this and
Chris@16 566 //! must be ordered according to the predicate and must be
Chris@16 567 //! unique values.
Chris@16 568 //!
Chris@16 569 //! <b>Effects</b>: inserts each element from the range [first,last) .This function
Chris@16 570 //! is more efficient than the normal range creation for ordered ranges.
Chris@16 571 //!
Chris@16 572 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
Chris@16 573 //! search time plus N*size() insertion time.
Chris@16 574 //!
Chris@16 575 //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
Chris@16 576 template <class InputIterator>
Chris@16 577 void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
Chris@101 578 { this->base_t::insert_unique(ordered_unique_range, first, last); }
Chris@16 579
Chris@101 580 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 581 //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only
Chris@101 582 //! if there is no element with key equivalent to the key of that element.
Chris@101 583 //!
Chris@101 584 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from il.begin() to il.end())
Chris@101 585 //! search time plus N*size() insertion time.
Chris@101 586 //!
Chris@101 587 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@101 588 void insert(std::initializer_list<value_type> il)
Chris@101 589 { this->base_t::insert_unique(il.begin(), il.end()); }
Chris@101 590
Chris@101 591 //! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate
Chris@101 592 //! and must be unique values.
Chris@101 593 //!
Chris@101 594 //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) .This function
Chris@101 595 //! is more efficient than the normal range creation for ordered ranges.
Chris@101 596 //!
Chris@101 597 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from il.begin() to il.end())
Chris@101 598 //! search time plus N*size() insertion time.
Chris@101 599 //!
Chris@101 600 //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
Chris@101 601 void insert(ordered_unique_range_t, std::initializer_list<value_type> il)
Chris@101 602 { this->base_t::insert_unique(ordered_unique_range, il.begin(), il.end()); }
Chris@101 603 #endif
Chris@101 604
Chris@101 605 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@101 606
Chris@101 607 //! <b>Effects</b>: Erases the element pointed to by p.
Chris@16 608 //!
Chris@16 609 //! <b>Returns</b>: Returns an iterator pointing to the element immediately
Chris@16 610 //! following q prior to the element being erased. If no such element exists,
Chris@16 611 //! returns end().
Chris@16 612 //!
Chris@101 613 //! <b>Complexity</b>: Linear to the elements with keys bigger than p
Chris@16 614 //!
Chris@16 615 //! <b>Note</b>: Invalidates elements with keys
Chris@16 616 //! not less than the erased element.
Chris@101 617 iterator erase(const_iterator p);
Chris@16 618
Chris@16 619 //! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
Chris@16 620 //!
Chris@16 621 //! <b>Returns</b>: Returns the number of erased elements.
Chris@16 622 //!
Chris@16 623 //! <b>Complexity</b>: Logarithmic search time plus erasure time
Chris@16 624 //! linear to the elements with bigger keys.
Chris@101 625 size_type erase(const key_type& x);
Chris@16 626
Chris@16 627 //! <b>Effects</b>: Erases all the elements in the range [first, last).
Chris@16 628 //!
Chris@16 629 //! <b>Returns</b>: Returns last.
Chris@16 630 //!
Chris@16 631 //! <b>Complexity</b>: size()*N where N is the distance from first to last.
Chris@16 632 //!
Chris@16 633 //! <b>Complexity</b>: Logarithmic search time plus erasure time
Chris@16 634 //! linear to the elements with bigger keys.
Chris@101 635 iterator erase(const_iterator first, const_iterator last);
Chris@16 636
Chris@16 637 //! <b>Effects</b>: Swaps the contents of *this and x.
Chris@16 638 //!
Chris@16 639 //! <b>Throws</b>: Nothing.
Chris@16 640 //!
Chris@16 641 //! <b>Complexity</b>: Constant.
Chris@16 642 void swap(flat_set& x)
Chris@101 643 BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
Chris@101 644 && boost::container::container_detail::is_nothrow_swappable<Compare>::value );
Chris@16 645
Chris@16 646 //! <b>Effects</b>: erase(a.begin(),a.end()).
Chris@16 647 //!
Chris@16 648 //! <b>Postcondition</b>: size() == 0.
Chris@16 649 //!
Chris@16 650 //! <b>Complexity</b>: linear in size().
Chris@101 651 void clear() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 652
Chris@16 653 //! <b>Effects</b>: Returns the comparison object out
Chris@16 654 //! of which a was constructed.
Chris@16 655 //!
Chris@16 656 //! <b>Complexity</b>: Constant.
Chris@101 657 key_compare key_comp() const;
Chris@16 658
Chris@16 659 //! <b>Effects</b>: Returns an object of value_compare constructed out
Chris@16 660 //! of the comparison object.
Chris@16 661 //!
Chris@16 662 //! <b>Complexity</b>: Constant.
Chris@101 663 value_compare value_comp() const;
Chris@16 664
Chris@16 665 //! <b>Returns</b>: An iterator pointing to an element with the key
Chris@16 666 //! equivalent to x, or end() if such an element is not found.
Chris@16 667 //!
Chris@16 668 //! <b>Complexity</b>: Logarithmic.
Chris@101 669 iterator find(const key_type& x);
Chris@16 670
Chris@101 671 //! <b>Returns</b>: A const_iterator pointing to an element with the key
Chris@16 672 //! equivalent to x, or end() if such an element is not found.
Chris@16 673 //!
Chris@101 674 //! <b>Complexity</b>: Logarithmic.
Chris@101 675 const_iterator find(const key_type& x) const;
Chris@101 676
Chris@101 677 //! <b>Requires</b>: size() >= n.
Chris@101 678 //!
Chris@101 679 //! <b>Effects</b>: Returns an iterator to the nth element
Chris@101 680 //! from the beginning of the container. Returns end()
Chris@101 681 //! if n == size().
Chris@101 682 //!
Chris@101 683 //! <b>Throws</b>: Nothing.
Chris@101 684 //!
Chris@101 685 //! <b>Complexity</b>: Constant.
Chris@101 686 //!
Chris@101 687 //! <b>Note</b>: Non-standard extension
Chris@101 688 iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW;
Chris@101 689
Chris@101 690 //! <b>Requires</b>: size() >= n.
Chris@101 691 //!
Chris@101 692 //! <b>Effects</b>: Returns a const_iterator to the nth element
Chris@101 693 //! from the beginning of the container. Returns end()
Chris@101 694 //! if n == size().
Chris@101 695 //!
Chris@101 696 //! <b>Throws</b>: Nothing.
Chris@101 697 //!
Chris@101 698 //! <b>Complexity</b>: Constant.
Chris@101 699 //!
Chris@101 700 //! <b>Note</b>: Non-standard extension
Chris@101 701 const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@101 702
Chris@101 703 //! <b>Requires</b>: size() >= n.
Chris@101 704 //!
Chris@101 705 //! <b>Effects</b>: Returns an iterator to the nth element
Chris@101 706 //! from the beginning of the container. Returns end()
Chris@101 707 //! if n == size().
Chris@101 708 //!
Chris@101 709 //! <b>Throws</b>: Nothing.
Chris@101 710 //!
Chris@101 711 //! <b>Complexity</b>: Constant.
Chris@101 712 //!
Chris@101 713 //! <b>Note</b>: Non-standard extension
Chris@101 714 size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW;
Chris@101 715
Chris@101 716 //! <b>Requires</b>: begin() <= p <= end().
Chris@101 717 //!
Chris@101 718 //! <b>Effects</b>: Returns the index of the element pointed by p
Chris@101 719 //! and size() if p == end().
Chris@101 720 //!
Chris@101 721 //! <b>Throws</b>: Nothing.
Chris@101 722 //!
Chris@101 723 //! <b>Complexity</b>: Constant.
Chris@101 724 //!
Chris@101 725 //! <b>Note</b>: Non-standard extension
Chris@101 726 size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@101 727
Chris@101 728 #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 729
Chris@16 730 //! <b>Returns</b>: The number of elements with key equivalent to x.
Chris@16 731 //!
Chris@16 732 //! <b>Complexity</b>: log(size())+count(k)
Chris@16 733 size_type count(const key_type& x) const
Chris@101 734 { return static_cast<size_type>(this->base_t::find(x) != this->base_t::cend()); }
Chris@16 735
Chris@101 736 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 737 //! <b>Returns</b>: An iterator pointing to the first element with key not less
Chris@16 738 //! than k, or a.end() if such an element is not found.
Chris@16 739 //!
Chris@16 740 //! <b>Complexity</b>: Logarithmic
Chris@101 741 iterator lower_bound(const key_type& x);
Chris@16 742
Chris@101 743 //! <b>Returns</b>: A const iterator pointing to the first element with key not
Chris@16 744 //! less than k, or a.end() if such an element is not found.
Chris@16 745 //!
Chris@16 746 //! <b>Complexity</b>: Logarithmic
Chris@101 747 const_iterator lower_bound(const key_type& x) const;
Chris@16 748
Chris@16 749 //! <b>Returns</b>: An iterator pointing to the first element with key not less
Chris@16 750 //! than x, or end() if such an element is not found.
Chris@16 751 //!
Chris@16 752 //! <b>Complexity</b>: Logarithmic
Chris@101 753 iterator upper_bound(const key_type& x);
Chris@16 754
Chris@101 755 //! <b>Returns</b>: A const iterator pointing to the first element with key not
Chris@16 756 //! less than x, or end() if such an element is not found.
Chris@16 757 //!
Chris@16 758 //! <b>Complexity</b>: Logarithmic
Chris@101 759 const_iterator upper_bound(const key_type& x) const;
Chris@101 760
Chris@101 761 #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 762
Chris@16 763 //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
Chris@16 764 //!
Chris@16 765 //! <b>Complexity</b>: Logarithmic
Chris@16 766 std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const
Chris@101 767 { return this->base_t::lower_bound_range(x); }
Chris@16 768
Chris@16 769 //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
Chris@16 770 //!
Chris@16 771 //! <b>Complexity</b>: Logarithmic
Chris@16 772 std::pair<iterator,iterator> equal_range(const key_type& x)
Chris@101 773 { return this->base_t::lower_bound_range(x); }
Chris@16 774
Chris@101 775 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 776
Chris@101 777 //! <b>Effects</b>: Returns true if x and y are equal
Chris@101 778 //!
Chris@101 779 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 780 friend bool operator==(const flat_set& x, const flat_set& y);
Chris@16 781
Chris@101 782 //! <b>Effects</b>: Returns true if x and y are unequal
Chris@101 783 //!
Chris@101 784 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 785 friend bool operator!=(const flat_set& x, const flat_set& y);
Chris@101 786
Chris@101 787 //! <b>Effects</b>: Returns true if x is less than y
Chris@101 788 //!
Chris@101 789 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 790 friend bool operator<(const flat_set& x, const flat_set& y);
Chris@101 791
Chris@101 792 //! <b>Effects</b>: Returns true if x is greater than y
Chris@101 793 //!
Chris@101 794 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 795 friend bool operator>(const flat_set& x, const flat_set& y);
Chris@101 796
Chris@101 797 //! <b>Effects</b>: Returns true if x is equal or less than y
Chris@101 798 //!
Chris@101 799 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 800 friend bool operator<=(const flat_set& x, const flat_set& y);
Chris@101 801
Chris@101 802 //! <b>Effects</b>: Returns true if x is equal or greater than y
Chris@101 803 //!
Chris@101 804 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 805 friend bool operator>=(const flat_set& x, const flat_set& y);
Chris@101 806
Chris@101 807 //! <b>Effects</b>: x.swap(y)
Chris@101 808 //!
Chris@101 809 //! <b>Complexity</b>: Constant.
Chris@101 810 friend void swap(flat_set& x, flat_set& y);
Chris@101 811
Chris@101 812 #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@101 813
Chris@101 814 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 815 private:
Chris@16 816 template<class KeyType>
Chris@16 817 std::pair<iterator, bool> priv_insert(BOOST_FWD_REF(KeyType) x)
Chris@101 818 { return this->base_t::insert_unique(::boost::forward<KeyType>(x)); }
Chris@16 819
Chris@16 820 template<class KeyType>
Chris@16 821 iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
Chris@101 822 { return this->base_t::insert_unique(p, ::boost::forward<KeyType>(x)); }
Chris@101 823 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 824 };
Chris@16 825
Chris@101 826 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 827
Chris@16 828 } //namespace container {
Chris@16 829
Chris@16 830 //!has_trivial_destructor_after_move<> == true_type
Chris@16 831 //!specialization for optimizations
Chris@101 832 template <class Key, class Compare, class Allocator>
Chris@101 833 struct has_trivial_destructor_after_move<boost::container::flat_set<Key, Compare, Allocator> >
Chris@16 834 {
Chris@101 835 typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
Chris@101 836 static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
Chris@101 837 ::boost::has_trivial_destructor_after_move<pointer>::value &&
Chris@101 838 ::boost::has_trivial_destructor_after_move<Compare>::value;
Chris@16 839 };
Chris@16 840
Chris@16 841 namespace container {
Chris@16 842
Chris@101 843 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 844
Chris@16 845 //! flat_multiset is a Sorted Associative Container that stores objects of type Key.
Chris@16 846 //!
Chris@16 847 //! flat_multiset can store multiple copies of the same key value.
Chris@16 848 //!
Chris@16 849 //! flat_multiset is similar to std::multiset but it's implemented like an ordered vector.
Chris@16 850 //! This means that inserting a new element into a flat_multiset invalidates
Chris@16 851 //! previous iterators and references
Chris@16 852 //!
Chris@16 853 //! Erasing an element invalidates iterators and references
Chris@16 854 //! pointing to elements that come after (their keys are bigger) the erased element.
Chris@16 855 //!
Chris@16 856 //! This container provides random-access iterators.
Chris@101 857 //!
Chris@101 858 //! \tparam Key is the type to be inserted in the multiset, which is also the key_type
Chris@101 859 //! \tparam Compare is the comparison functor used to order keys
Chris@101 860 //! \tparam Allocator is the allocator to be used to allocate memory for this container
Chris@16 861 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@101 862 template <class Key, class Compare = std::less<Key>, class Allocator = new_allocator<Key> >
Chris@16 863 #else
Chris@16 864 template <class Key, class Compare, class Allocator>
Chris@16 865 #endif
Chris@16 866 class flat_multiset
Chris@101 867 ///@cond
Chris@101 868 : public container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator>
Chris@101 869 ///@endcond
Chris@16 870 {
Chris@101 871 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 872 private:
Chris@16 873 BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
Chris@101 874 typedef container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator> base_t;
Chris@101 875 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 876
Chris@16 877 public:
Chris@16 878 //////////////////////////////////////////////
Chris@16 879 //
Chris@16 880 // types
Chris@16 881 //
Chris@16 882 //////////////////////////////////////////////
Chris@16 883 typedef Key key_type;
Chris@16 884 typedef Key value_type;
Chris@16 885 typedef Compare key_compare;
Chris@16 886 typedef Compare value_compare;
Chris@101 887 typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
Chris@16 888 typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
Chris@16 889 typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
Chris@16 890 typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
Chris@16 891 typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
Chris@16 892 typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
Chris@16 893 typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
Chris@16 894 typedef Allocator allocator_type;
Chris@101 895 typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
Chris@101 896 typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator;
Chris@101 897 typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator;
Chris@101 898 typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator;
Chris@101 899 typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator;
Chris@16 900
Chris@101 901 //! @copydoc ::boost::container::flat_set::flat_set()
Chris@16 902 explicit flat_multiset()
Chris@101 903 : base_t()
Chris@16 904 {}
Chris@16 905
Chris@101 906 //! @copydoc ::boost::container::flat_set::flat_set(const Compare&, const allocator_type&)
Chris@16 907 explicit flat_multiset(const Compare& comp,
Chris@16 908 const allocator_type& a = allocator_type())
Chris@101 909 : base_t(comp, a)
Chris@16 910 {}
Chris@16 911
Chris@101 912 //! @copydoc ::boost::container::flat_set::flat_set(const allocator_type&)
Chris@16 913 explicit flat_multiset(const allocator_type& a)
Chris@101 914 : base_t(a)
Chris@16 915 {}
Chris@16 916
Chris@101 917 //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp, const allocator_type&)
Chris@16 918 template <class InputIterator>
Chris@16 919 flat_multiset(InputIterator first, InputIterator last,
Chris@16 920 const Compare& comp = Compare(),
Chris@16 921 const allocator_type& a = allocator_type())
Chris@101 922 : base_t(false, first, last, comp, a)
Chris@101 923 {}
Chris@101 924
Chris@101 925 //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const allocator_type&)
Chris@101 926 template <class InputIterator>
Chris@101 927 flat_multiset(InputIterator first, InputIterator last, const allocator_type& a)
Chris@101 928 : base_t(false, first, last, Compare(), a)
Chris@16 929 {}
Chris@16 930
Chris@16 931 //! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and
Chris@16 932 //! allocator, and inserts elements from the ordered range [first ,last ). This function
Chris@16 933 //! is more efficient than the normal range creation for ordered ranges.
Chris@16 934 //!
Chris@16 935 //! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
Chris@16 936 //!
Chris@16 937 //! <b>Complexity</b>: Linear in N.
Chris@16 938 //!
Chris@16 939 //! <b>Note</b>: Non-standard extension.
Chris@16 940 template <class InputIterator>
Chris@16 941 flat_multiset(ordered_range_t, InputIterator first, InputIterator last,
Chris@16 942 const Compare& comp = Compare(),
Chris@16 943 const allocator_type& a = allocator_type())
Chris@101 944 : base_t(ordered_range, first, last, comp, a)
Chris@16 945 {}
Chris@16 946
Chris@101 947 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 948 //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const Compare& comp, const allocator_type&)
Chris@101 949 flat_multiset(std::initializer_list<value_type> il, const Compare& comp = Compare(),
Chris@101 950 const allocator_type& a = allocator_type())
Chris@101 951 : base_t(false, il.begin(), il.end(), comp, a)
Chris@16 952 {}
Chris@16 953
Chris@101 954 //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const allocator_type&)
Chris@101 955 flat_multiset(std::initializer_list<value_type> il, const allocator_type& a)
Chris@101 956 : base_t(false, il.begin(), il.end(), Compare(), a)
Chris@16 957 {}
Chris@16 958
Chris@101 959 //! @copydoc ::boost::container::flat_set::flat_set(ordered_unique_range_t, std::initializer_list<value_type>, const Compare& comp, const allocator_type&)
Chris@101 960 flat_multiset(ordered_unique_range_t, std::initializer_list<value_type> il,
Chris@101 961 const Compare& comp = Compare(), const allocator_type& a = allocator_type())
Chris@101 962 : base_t(ordered_range, il.begin(), il.end(), comp, a)
Chris@101 963 {}
Chris@101 964 #endif
Chris@101 965
Chris@101 966 //! @copydoc ::boost::container::flat_set::flat_set(const flat_set &)
Chris@101 967 flat_multiset(const flat_multiset& x)
Chris@101 968 : base_t(static_cast<const base_t&>(x))
Chris@16 969 {}
Chris@16 970
Chris@101 971 //! @copydoc ::boost::container::flat_set(flat_set &&)
Chris@101 972 flat_multiset(BOOST_RV_REF(flat_multiset) x)
Chris@101 973 : base_t(boost::move(static_cast<base_t&>(x)))
Chris@16 974 {}
Chris@16 975
Chris@101 976 //! @copydoc ::boost::container::flat_set(const flat_set &, const allocator_type &)
Chris@101 977 flat_multiset(const flat_multiset& x, const allocator_type &a)
Chris@101 978 : base_t(static_cast<const base_t&>(x), a)
Chris@101 979 {}
Chris@101 980
Chris@101 981 //! @copydoc ::boost::container::flat_set(flat_set &&, const allocator_type &)
Chris@101 982 flat_multiset(BOOST_RV_REF(flat_multiset) x, const allocator_type &a)
Chris@101 983 : base_t(BOOST_MOVE_BASE(base_t, x), a)
Chris@101 984 {}
Chris@101 985
Chris@101 986 //! @copydoc ::boost::container::flat_set::operator=(const flat_set &)
Chris@16 987 flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x)
Chris@101 988 { return static_cast<flat_multiset&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
Chris@16 989
Chris@101 990 //! @copydoc ::boost::container::flat_set::operator=(flat_set &&)
Chris@101 991 flat_multiset& operator=(BOOST_RV_REF(flat_multiset) x)
Chris@101 992 BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
Chris@101 993 && boost::container::container_detail::is_nothrow_move_assignable<Compare>::value )
Chris@101 994 { return static_cast<flat_multiset&>(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); }
Chris@16 995
Chris@101 996 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 997 //! @copydoc ::boost::container::flat_set::operator=(std::initializer_list<value_type>)
Chris@101 998 flat_multiset& operator=(std::initializer_list<value_type> il)
Chris@101 999 {
Chris@101 1000 this->clear();
Chris@101 1001 this->insert(il.begin(), il.end());
Chris@101 1002 return *this;
Chris@101 1003 }
Chris@101 1004 #endif
Chris@16 1005
Chris@101 1006 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 1007
Chris@101 1008 //! @copydoc ::boost::container::flat_set::get_allocator()
Chris@101 1009 allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1010
Chris@101 1011 //! @copydoc ::boost::container::flat_set::get_stored_allocator()
Chris@101 1012 stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1013
Chris@101 1014 //! @copydoc ::boost::container::flat_set::get_stored_allocator() const
Chris@101 1015 const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1016
Chris@101 1017 //! @copydoc ::boost::container::flat_set::begin()
Chris@101 1018 iterator begin() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1019
Chris@101 1020 //! @copydoc ::boost::container::flat_set::begin() const
Chris@101 1021 const_iterator begin() const;
Chris@16 1022
Chris@101 1023 //! @copydoc ::boost::container::flat_set::cbegin() const
Chris@101 1024 const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1025
Chris@101 1026 //! @copydoc ::boost::container::flat_set::end()
Chris@101 1027 iterator end() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1028
Chris@101 1029 //! @copydoc ::boost::container::flat_set::end() const
Chris@101 1030 const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1031
Chris@101 1032 //! @copydoc ::boost::container::flat_set::cend() const
Chris@101 1033 const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1034
Chris@101 1035 //! @copydoc ::boost::container::flat_set::rbegin()
Chris@101 1036 reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1037
Chris@101 1038 //! @copydoc ::boost::container::flat_set::rbegin() const
Chris@101 1039 const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1040
Chris@101 1041 //! @copydoc ::boost::container::flat_set::crbegin() const
Chris@101 1042 const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1043
Chris@101 1044 //! @copydoc ::boost::container::flat_set::rend()
Chris@101 1045 reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1046
Chris@101 1047 //! @copydoc ::boost::container::flat_set::rend() const
Chris@101 1048 const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1049
Chris@101 1050 //! @copydoc ::boost::container::flat_set::crend() const
Chris@101 1051 const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1052
Chris@101 1053 //! @copydoc ::boost::container::flat_set::empty() const
Chris@101 1054 bool empty() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1055
Chris@101 1056 //! @copydoc ::boost::container::flat_set::size() const
Chris@101 1057 size_type size() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1058
Chris@101 1059 //! @copydoc ::boost::container::flat_set::max_size() const
Chris@101 1060 size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1061
Chris@101 1062 //! @copydoc ::boost::container::flat_set::capacity() const
Chris@101 1063 size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@16 1064
Chris@101 1065 //! @copydoc ::boost::container::flat_set::reserve(size_type)
Chris@101 1066 void reserve(size_type cnt);
Chris@101 1067
Chris@101 1068 //! @copydoc ::boost::container::flat_set::shrink_to_fit()
Chris@101 1069 void shrink_to_fit();
Chris@101 1070
Chris@101 1071 #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 1072
Chris@16 1073 //////////////////////////////////////////////
Chris@16 1074 //
Chris@16 1075 // modifiers
Chris@16 1076 //
Chris@16 1077 //////////////////////////////////////////////
Chris@16 1078
Chris@101 1079 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 1080
Chris@16 1081 //! <b>Effects</b>: Inserts an object of type Key constructed with
Chris@16 1082 //! std::forward<Args>(args)... and returns the iterator pointing to the
Chris@16 1083 //! newly inserted element.
Chris@16 1084 //!
Chris@16 1085 //! <b>Complexity</b>: Logarithmic search time plus linear insertion
Chris@16 1086 //! to the elements with bigger keys than x.
Chris@16 1087 //!
Chris@16 1088 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 1089 template <class... Args>
Chris@101 1090 iterator emplace(BOOST_FWD_REF(Args)... args)
Chris@101 1091 { return this->base_t::emplace_equal(boost::forward<Args>(args)...); }
Chris@16 1092
Chris@16 1093 //! <b>Effects</b>: Inserts an object of type Key constructed with
Chris@16 1094 //! std::forward<Args>(args)... in the container.
Chris@16 1095 //! p is a hint pointing to where the insert should start to search.
Chris@16 1096 //!
Chris@16 1097 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
Chris@16 1098 //! to the key of x.
Chris@16 1099 //!
Chris@16 1100 //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
Chris@16 1101 //! right before p) plus insertion linear to the elements with bigger keys than x.
Chris@16 1102 //!
Chris@16 1103 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 1104 template <class... Args>
Chris@101 1105 iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
Chris@101 1106 { return this->base_t::emplace_hint_equal(p, boost::forward<Args>(args)...); }
Chris@16 1107
Chris@101 1108 #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
Chris@16 1109
Chris@101 1110 #define BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE(N) \
Chris@101 1111 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
Chris@101 1112 iterator emplace(BOOST_MOVE_UREF##N)\
Chris@101 1113 { return this->base_t::emplace_equal(BOOST_MOVE_FWD##N); }\
Chris@101 1114 \
Chris@101 1115 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
Chris@101 1116 iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
Chris@101 1117 { return this->base_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
Chris@101 1118 //
Chris@101 1119 BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE)
Chris@101 1120 #undef BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE
Chris@16 1121
Chris@101 1122 #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
Chris@16 1123
Chris@16 1124 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 1125 //! <b>Effects</b>: Inserts x and returns the iterator pointing to the
Chris@16 1126 //! newly inserted element.
Chris@16 1127 //!
Chris@16 1128 //! <b>Complexity</b>: Logarithmic search time plus linear insertion
Chris@16 1129 //! to the elements with bigger keys than x.
Chris@16 1130 //!
Chris@16 1131 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 1132 iterator insert(const value_type &x);
Chris@16 1133
Chris@16 1134 //! <b>Effects</b>: Inserts a new value_type move constructed from x
Chris@16 1135 //! and returns the iterator pointing to the newly inserted element.
Chris@16 1136 //!
Chris@16 1137 //! <b>Complexity</b>: Logarithmic search time plus linear insertion
Chris@16 1138 //! to the elements with bigger keys than x.
Chris@16 1139 //!
Chris@16 1140 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 1141 iterator insert(value_type &&x);
Chris@16 1142 #else
Chris@16 1143 BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert)
Chris@16 1144 #endif
Chris@16 1145
Chris@16 1146 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 1147 //! <b>Effects</b>: Inserts a copy of x in the container.
Chris@16 1148 //! p is a hint pointing to where the insert should start to search.
Chris@16 1149 //!
Chris@16 1150 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
Chris@16 1151 //! to the key of x.
Chris@16 1152 //!
Chris@16 1153 //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
Chris@16 1154 //! right before p) plus insertion linear to the elements with bigger keys than x.
Chris@16 1155 //!
Chris@16 1156 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 1157 iterator insert(const_iterator p, const value_type &x);
Chris@16 1158
Chris@16 1159 //! <b>Effects</b>: Inserts a new value move constructed from x in the container.
Chris@16 1160 //! p is a hint pointing to where the insert should start to search.
Chris@16 1161 //!
Chris@16 1162 //! <b>Returns</b>: An iterator pointing to the element with key equivalent
Chris@16 1163 //! to the key of x.
Chris@16 1164 //!
Chris@16 1165 //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
Chris@16 1166 //! right before p) plus insertion linear to the elements with bigger keys than x.
Chris@16 1167 //!
Chris@16 1168 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@101 1169 iterator insert(const_iterator p, value_type &&x);
Chris@16 1170 #else
Chris@16 1171 BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator)
Chris@16 1172 #endif
Chris@16 1173
Chris@16 1174 //! <b>Requires</b>: first, last are not iterators into *this.
Chris@16 1175 //!
Chris@16 1176 //! <b>Effects</b>: inserts each element from the range [first,last) .
Chris@16 1177 //!
Chris@16 1178 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
Chris@16 1179 //! search time plus N*size() insertion time.
Chris@16 1180 //!
Chris@16 1181 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@16 1182 template <class InputIterator>
Chris@16 1183 void insert(InputIterator first, InputIterator last)
Chris@101 1184 { this->base_t::insert_equal(first, last); }
Chris@16 1185
Chris@16 1186 //! <b>Requires</b>: first, last are not iterators into *this and
Chris@16 1187 //! must be ordered according to the predicate.
Chris@16 1188 //!
Chris@16 1189 //! <b>Effects</b>: inserts each element from the range [first,last) .This function
Chris@16 1190 //! is more efficient than the normal range creation for ordered ranges.
Chris@16 1191 //!
Chris@16 1192 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
Chris@16 1193 //! search time plus N*size() insertion time.
Chris@16 1194 //!
Chris@16 1195 //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
Chris@16 1196 template <class InputIterator>
Chris@16 1197 void insert(ordered_range_t, InputIterator first, InputIterator last)
Chris@101 1198 { this->base_t::insert_equal(ordered_range, first, last); }
Chris@16 1199
Chris@101 1200 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 1201 //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()).
Chris@16 1202 //!
Chris@101 1203 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
Chris@101 1204 //! search time plus N*size() insertion time.
Chris@16 1205 //!
Chris@101 1206 //! <b>Note</b>: If an element is inserted it might invalidate elements.
Chris@101 1207 void insert(std::initializer_list<value_type> il)
Chris@101 1208 { this->base_t::insert_equal(il.begin(), il.end()); }
Chris@101 1209
Chris@101 1210 //! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate.
Chris@16 1211 //!
Chris@101 1212 //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()). This function
Chris@101 1213 //! is more efficient than the normal range creation for ordered ranges.
Chris@101 1214 //!
Chris@101 1215 //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from il.begin() to il.end())
Chris@101 1216 //! search time plus N*size() insertion time.
Chris@101 1217 //!
Chris@101 1218 //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
Chris@101 1219 void insert(ordered_range_t, std::initializer_list<value_type> il)
Chris@101 1220 { this->base_t::insert_equal(ordered_range, il.begin(), il.end()); }
Chris@101 1221 #endif
Chris@16 1222
Chris@101 1223 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@101 1224
Chris@101 1225 //! @copydoc ::boost::container::flat_set::erase(const_iterator)
Chris@101 1226 iterator erase(const_iterator p);
Chris@101 1227
Chris@101 1228 //! @copydoc ::boost::container::flat_set::erase(const key_type&)
Chris@101 1229 size_type erase(const key_type& x);
Chris@101 1230
Chris@101 1231 //! @copydoc ::boost::container::flat_set::erase(const_iterator,const_iterator)
Chris@101 1232 iterator erase(const_iterator first, const_iterator last);
Chris@101 1233
Chris@101 1234 //! @copydoc ::boost::container::flat_set::swap
Chris@101 1235 void swap(flat_multiset& x)
Chris@101 1236 BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
Chris@101 1237 && boost::container::container_detail::is_nothrow_swappable<Compare>::value );
Chris@101 1238
Chris@101 1239 //! @copydoc ::boost::container::flat_set::clear
Chris@101 1240 void clear() BOOST_NOEXCEPT_OR_NOTHROW;
Chris@101 1241
Chris@101 1242 //! @copydoc ::boost::container::flat_set::key_comp
Chris@101 1243 key_compare key_comp() const;
Chris@101 1244
Chris@101 1245 //! @copydoc ::boost::container::flat_set::value_comp
Chris@101 1246 value_compare value_comp() const;
Chris@101 1247
Chris@101 1248 //! @copydoc ::boost::container::flat_set::find(const key_type& )
Chris@101 1249 iterator find(const key_type& x);
Chris@101 1250
Chris@101 1251 //! @copydoc ::boost::container::flat_set::find(const key_type& ) const
Chris@101 1252 const_iterator find(const key_type& x) const;
Chris@101 1253
Chris@101 1254 //! @copydoc ::boost::container::flat_set::nth(size_type)
Chris@101 1255 iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW;
Chris@101 1256
Chris@101 1257 //! @copydoc ::boost::container::flat_set::nth(size_type) const
Chris@101 1258 const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@101 1259
Chris@101 1260 //! @copydoc ::boost::container::flat_set::index_of(iterator)
Chris@101 1261 size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW;
Chris@101 1262
Chris@101 1263 //! @copydoc ::boost::container::flat_set::index_of(const_iterator) const
Chris@101 1264 size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW;
Chris@101 1265
Chris@101 1266 //! @copydoc ::boost::container::flat_set::count(const key_type& ) const
Chris@101 1267 size_type count(const key_type& x) const;
Chris@101 1268
Chris@101 1269 //! @copydoc ::boost::container::flat_set::lower_bound(const key_type& )
Chris@101 1270 iterator lower_bound(const key_type& x);
Chris@101 1271
Chris@101 1272 //! @copydoc ::boost::container::flat_set::lower_bound(const key_type& ) const
Chris@101 1273 const_iterator lower_bound(const key_type& x) const;
Chris@101 1274
Chris@101 1275 //! @copydoc ::boost::container::flat_set::upper_bound(const key_type& )
Chris@101 1276 iterator upper_bound(const key_type& x);
Chris@101 1277
Chris@101 1278 //! @copydoc ::boost::container::flat_set::upper_bound(const key_type& ) const
Chris@101 1279 const_iterator upper_bound(const key_type& x) const;
Chris@101 1280
Chris@101 1281 //! @copydoc ::boost::container::flat_set::equal_range(const key_type& ) const
Chris@101 1282 std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
Chris@101 1283
Chris@101 1284 //! @copydoc ::boost::container::flat_set::equal_range(const key_type& )
Chris@101 1285 std::pair<iterator,iterator> equal_range(const key_type& x);
Chris@101 1286
Chris@101 1287 //! <b>Effects</b>: Returns true if x and y are equal
Chris@16 1288 //!
Chris@101 1289 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1290 friend bool operator==(const flat_multiset& x, const flat_multiset& y);
Chris@101 1291
Chris@101 1292 //! <b>Effects</b>: Returns true if x and y are unequal
Chris@16 1293 //!
Chris@101 1294 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1295 friend bool operator!=(const flat_multiset& x, const flat_multiset& y);
Chris@16 1296
Chris@101 1297 //! <b>Effects</b>: Returns true if x is less than y
Chris@16 1298 //!
Chris@101 1299 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1300 friend bool operator<(const flat_multiset& x, const flat_multiset& y);
Chris@101 1301
Chris@101 1302 //! <b>Effects</b>: Returns true if x is greater than y
Chris@16 1303 //!
Chris@101 1304 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1305 friend bool operator>(const flat_multiset& x, const flat_multiset& y);
Chris@101 1306
Chris@101 1307 //! <b>Effects</b>: Returns true if x is equal or less than y
Chris@16 1308 //!
Chris@101 1309 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1310 friend bool operator<=(const flat_multiset& x, const flat_multiset& y);
Chris@16 1311
Chris@101 1312 //! <b>Effects</b>: Returns true if x is equal or greater than y
Chris@16 1313 //!
Chris@101 1314 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1315 friend bool operator>=(const flat_multiset& x, const flat_multiset& y);
Chris@101 1316
Chris@101 1317 //! <b>Effects</b>: x.swap(y)
Chris@16 1318 //!
Chris@16 1319 //! <b>Complexity</b>: Constant.
Chris@101 1320 friend void swap(flat_multiset& x, flat_multiset& y);
Chris@16 1321
Chris@101 1322 #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1323
Chris@101 1324 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1325 private:
Chris@16 1326 template <class KeyType>
Chris@16 1327 iterator priv_insert(BOOST_FWD_REF(KeyType) x)
Chris@101 1328 { return this->base_t::insert_equal(::boost::forward<KeyType>(x)); }
Chris@16 1329
Chris@16 1330 template <class KeyType>
Chris@16 1331 iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
Chris@101 1332 { return this->base_t::insert_equal(p, ::boost::forward<KeyType>(x)); }
Chris@101 1333 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1334 };
Chris@16 1335
Chris@101 1336 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1337
Chris@16 1338 } //namespace container {
Chris@16 1339
Chris@16 1340 //!has_trivial_destructor_after_move<> == true_type
Chris@16 1341 //!specialization for optimizations
Chris@101 1342 template <class Key, class Compare, class Allocator>
Chris@101 1343 struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, Compare, Allocator> >
Chris@16 1344 {
Chris@101 1345 typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
Chris@101 1346 static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
Chris@101 1347 ::boost::has_trivial_destructor_after_move<pointer>::value &&
Chris@101 1348 ::boost::has_trivial_destructor_after_move<Compare>::value;
Chris@16 1349 };
Chris@16 1350
Chris@16 1351 namespace container {
Chris@16 1352
Chris@101 1353 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1354
Chris@16 1355 }}
Chris@16 1356
Chris@16 1357 #include <boost/container/detail/config_end.hpp>
Chris@16 1358
Chris@101 1359 #endif // BOOST_CONTAINER_FLAT_SET_HPP