Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@101: // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost Chris@16: // Software License, Version 1.0. (See accompanying file Chris@16: // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // See http://www.boost.org/libs/container for documentation. Chris@16: // Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: Chris@16: #ifndef BOOST_CONTAINER_SET_HPP Chris@16: #define BOOST_CONTAINER_SET_HPP Chris@16: Chris@101: #ifndef BOOST_CONFIG_HPP Chris@101: # include Chris@101: #endif Chris@101: Chris@101: #if defined(BOOST_HAS_PRAGMA_ONCE) Chris@16: # pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@101: // container Chris@16: #include Chris@101: // container/detail Chris@16: #include Chris@16: #include Chris@101: #include //new_allocator Chris@101: // intrusive/detail Chris@101: #include //pair Chris@101: #include //less, equal Chris@101: // move Chris@101: #include Chris@101: #include Chris@101: // move/detail Chris@101: #include Chris@101: #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) Chris@101: #include Chris@101: #endif Chris@101: // std Chris@101: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@101: #include Chris@16: #endif Chris@16: Chris@16: namespace boost { Chris@16: namespace container { Chris@16: Chris@101: #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: Chris@16: //! A set is a kind of associative container that supports unique keys (contains at Chris@16: //! most one of each key value) and provides for fast retrieval of the keys themselves. Chris@16: //! Class set supports bidirectional iterators. Chris@16: //! Chris@16: //! A set satisfies all of the requirements of a container and of a reversible container Chris@16: //! , and of an associative container. A set also provides most operations described in Chris@16: //! for unique keys. Chris@101: //! Chris@101: //! \tparam Key is the type to be inserted in the set, which is also the key_type Chris@101: //! \tparam Compare is the comparison functor used to order keys Chris@101: //! \tparam Allocator is the allocator to be used to allocate memory for this container Chris@101: //! \tparam SetOptions is an packed option type generated using using boost::container::tree_assoc_options. Chris@101: template , class Allocator = new_allocator, class SetOptions = tree_assoc_defaults > Chris@16: #else Chris@101: template Chris@16: #endif Chris@16: class set Chris@101: ///@cond Chris@101: : public container_detail::tree Chris@101: < Key, Key, container_detail::identity, Compare, Allocator, SetOptions> Chris@101: ///@endcond Chris@16: { Chris@101: #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: private: Chris@16: BOOST_COPYABLE_AND_MOVABLE(set) Chris@101: typedef container_detail::tree Chris@101: < Key, Key, container_detail::identity, Compare, Allocator, SetOptions> base_t; Chris@101: #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: Chris@16: public: Chris@16: ////////////////////////////////////////////// Chris@16: // Chris@16: // types Chris@16: // Chris@16: ////////////////////////////////////////////// Chris@16: typedef Key key_type; Chris@16: typedef Key value_type; Chris@16: typedef Compare key_compare; Chris@16: typedef Compare value_compare; Chris@101: typedef ::boost::container::allocator_traits allocator_traits_type; Chris@16: typedef typename ::boost::container::allocator_traits::pointer pointer; Chris@16: typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; Chris@16: typedef typename ::boost::container::allocator_traits::reference reference; Chris@16: typedef typename ::boost::container::allocator_traits::const_reference const_reference; Chris@16: typedef typename ::boost::container::allocator_traits::size_type size_type; Chris@16: typedef typename ::boost::container::allocator_traits::difference_type difference_type; Chris@16: typedef Allocator allocator_type; Chris@101: typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type; Chris@101: typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator; Chris@101: typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator; Chris@101: typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator; Chris@101: typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator; Chris@16: Chris@16: ////////////////////////////////////////////// Chris@16: // Chris@16: // construct/copy/destroy Chris@16: // Chris@16: ////////////////////////////////////////////// Chris@16: Chris@16: //! Effects: Default constructs an empty set. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@16: set() Chris@101: : base_t() Chris@16: {} Chris@16: Chris@16: //! Effects: Constructs an empty set using the specified comparison object Chris@16: //! and allocator. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@16: explicit set(const Compare& comp, Chris@16: const allocator_type& a = allocator_type()) Chris@101: : base_t(comp, a) Chris@16: {} Chris@16: Chris@16: //! Effects: Constructs an empty set using the specified allocator object. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@16: explicit set(const allocator_type& a) Chris@101: : base_t(a) Chris@16: {} Chris@16: Chris@16: //! Effects: Constructs an empty set using the specified comparison object and Chris@16: //! allocator, and inserts elements from the range [first ,last ). Chris@16: //! Chris@16: //! Complexity: Linear in N if the range [first ,last ) is already sorted using Chris@16: //! comp and otherwise N logN, where N is last - first. Chris@16: template Chris@16: set(InputIterator first, InputIterator last, const Compare& comp = Compare(), Chris@16: const allocator_type& a = allocator_type()) Chris@101: : base_t(true, first, last, comp, a) Chris@101: {} Chris@101: Chris@101: //! Effects: Constructs an empty set using the specified Chris@101: //! allocator, and inserts elements from the range [first ,last ). Chris@101: //! Chris@101: //! Complexity: Linear in N if the range [first ,last ) is already sorted using Chris@101: //! comp and otherwise N logN, where N is last - first. Chris@101: template Chris@101: set(InputIterator first, InputIterator last, const allocator_type& a) Chris@101: : base_t(true, first, last, key_compare(), a) Chris@16: {} Chris@16: Chris@16: //! Effects: Constructs an empty set using the specified comparison object and Chris@16: //! allocator, and inserts elements from the ordered unique range [first ,last). This function Chris@16: //! is more efficient than the normal range creation for ordered ranges. Chris@16: //! Chris@16: //! Requires: [first ,last) must be ordered according to the predicate and must be Chris@16: //! unique values. Chris@16: //! Chris@16: //! Complexity: Linear in N. Chris@16: //! Chris@16: //! Note: Non-standard extension. Chris@16: template Chris@16: set( ordered_unique_range_t, InputIterator first, InputIterator last Chris@16: , const Compare& comp = Compare(), const allocator_type& a = allocator_type()) Chris@101: : base_t(ordered_range, first, last, comp, a) Chris@16: {} Chris@16: Chris@101: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@101: //! Effects: Constructs an empty set using the specified comparison object and Chris@101: //! allocator, and inserts elements from the range [il.begin(), il.end()). Chris@101: //! Chris@101: //! Complexity: Linear in N if the range [il.begin(), il.end()) is already sorted using Chris@101: //! comp and otherwise N logN, where N is il.begin() - il.end(). Chris@101: set(std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) Chris@101: : base_t(true, il.begin(), il.end(), comp, a) Chris@101: {} Chris@101: Chris@101: //! Effects: Constructs an empty set using the specified Chris@101: //! allocator, and inserts elements from the range [il.begin(), il.end()). Chris@101: //! Chris@101: //! Complexity: Linear in N if the range [il.begin(), il.end()) is already sorted using Chris@101: //! comp and otherwise N logN, where N is il.begin() - il.end(). Chris@101: set(std::initializer_list il, const allocator_type& a) Chris@101: : base_t(true, il.begin(), il.end(), Compare(), a) Chris@101: {} Chris@101: Chris@101: //! Effects: Constructs an empty set using the specified comparison object and Chris@101: //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function Chris@101: //! is more efficient than the normal range creation for ordered ranges. Chris@101: //! Chris@101: //! Requires: [il.begin(), il.end()) must be ordered according to the predicate and must be Chris@101: //! unique values. Chris@101: //! Chris@101: //! Complexity: Linear in N. Chris@101: //! Chris@101: //! Note: Non-standard extension. Chris@101: set( ordered_unique_range_t, std::initializer_list il, const Compare& comp = Compare() Chris@101: , const allocator_type& a = allocator_type()) Chris@101: : base_t(ordered_range, il.begin(), il.end(), comp, a) Chris@101: {} Chris@101: #endif Chris@101: Chris@16: //! Effects: Copy constructs a set. Chris@16: //! Chris@16: //! Complexity: Linear in x.size(). Chris@16: set(const set& x) Chris@101: : base_t(static_cast(x)) Chris@16: {} Chris@16: Chris@16: //! Effects: Move constructs a set. Constructs *this using x's resources. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@16: //! Chris@16: //! Postcondition: x is emptied. Chris@16: set(BOOST_RV_REF(set) x) Chris@101: : base_t(BOOST_MOVE_BASE(base_t, x)) Chris@16: {} Chris@16: Chris@16: //! Effects: Copy constructs a set using the specified allocator. Chris@16: //! Chris@16: //! Complexity: Linear in x.size(). Chris@16: set(const set& x, const allocator_type &a) Chris@101: : base_t(static_cast(x), a) Chris@16: {} Chris@16: Chris@16: //! Effects: Move constructs a set using the specified allocator. Chris@16: //! Constructs *this using x's resources. Chris@16: //! Chris@16: //! Complexity: Constant if a == x.get_allocator(), linear otherwise. Chris@16: set(BOOST_RV_REF(set) x, const allocator_type &a) Chris@101: : base_t(BOOST_MOVE_BASE(base_t, x), a) Chris@16: {} Chris@16: Chris@16: //! Effects: Makes *this a copy of x. Chris@16: //! Chris@16: //! Complexity: Linear in x.size(). Chris@16: set& operator=(BOOST_COPY_ASSIGN_REF(set) x) Chris@101: { return static_cast(this->base_t::operator=(static_cast(x))); } Chris@16: Chris@16: //! Effects: this->swap(x.get()). Chris@16: //! Chris@101: //! Throws: If allocator_traits_type::propagate_on_container_move_assignment Chris@101: //! is false and (allocation throws or value_type's move constructor throws) Chris@101: //! Chris@101: //! Complexity: Constant if allocator_traits_type:: Chris@101: //! propagate_on_container_move_assignment is true or Chris@101: //! this->get>allocator() == x.get_allocator(). Linear otherwise. Chris@16: set& operator=(BOOST_RV_REF(set) x) Chris@101: BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value Chris@101: && boost::container::container_detail::is_nothrow_move_assignable::value ) Chris@101: { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } Chris@16: Chris@101: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@101: set& operator=(std::initializer_list il) Chris@101: { Chris@101: this->clear(); Chris@101: insert(il.begin(), il.end()); Chris@101: return *this; Chris@101: } Chris@101: #endif Chris@101: Chris@101: #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@101: Chris@101: //! Effects: Returns a copy of the allocator that Chris@16: //! was passed to the object's constructor. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: allocator_type get_allocator() const; Chris@16: Chris@16: //! Effects: Returns a reference to the internal allocator. Chris@16: //! Chris@16: //! Throws: Nothing Chris@16: //! Chris@16: //! Complexity: Constant. Chris@16: //! Chris@16: //! Note: Non-standard extension. Chris@101: stored_allocator_type &get_stored_allocator(); Chris@16: Chris@16: //! Effects: Returns a reference to the internal allocator. Chris@16: //! Chris@16: //! Throws: Nothing Chris@16: //! Chris@16: //! Complexity: Constant. Chris@16: //! Chris@16: //! Note: Non-standard extension. Chris@101: const stored_allocator_type &get_stored_allocator() const; Chris@16: Chris@16: //! Effects: Returns an iterator to the first element contained in the container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant Chris@101: iterator begin(); Chris@16: Chris@16: //! Effects: Returns a const_iterator to the first element contained in the container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: const_iterator begin() const; Chris@101: Chris@101: //! Effects: Returns a const_iterator to the first element contained in the container. Chris@101: //! Chris@101: //! Throws: Nothing. Chris@101: //! Chris@101: //! Complexity: Constant. Chris@101: const_iterator cbegin() const; Chris@16: Chris@16: //! Effects: Returns an iterator to the end of the container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: iterator end(); Chris@16: Chris@16: //! Effects: Returns a const_iterator to the end of the container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: const_iterator end() const; Chris@101: Chris@101: //! Effects: Returns a const_iterator to the end of the container. Chris@101: //! Chris@101: //! Throws: Nothing. Chris@101: //! Chris@101: //! Complexity: Constant. Chris@101: const_iterator cend() const; Chris@16: Chris@16: //! Effects: Returns a reverse_iterator pointing to the beginning Chris@16: //! of the reversed container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: reverse_iterator rbegin(); Chris@16: Chris@16: //! Effects: Returns a const_reverse_iterator pointing to the beginning Chris@16: //! of the reversed container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: const_reverse_iterator rbegin() const; Chris@101: Chris@101: //! Effects: Returns a const_reverse_iterator pointing to the beginning Chris@101: //! of the reversed container. Chris@101: //! Chris@101: //! Throws: Nothing. Chris@101: //! Chris@101: //! Complexity: Constant. Chris@101: const_reverse_iterator crbegin() const; Chris@16: Chris@16: //! Effects: Returns a reverse_iterator pointing to the end Chris@16: //! of the reversed container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: reverse_iterator rend(); Chris@16: Chris@16: //! Effects: Returns a const_reverse_iterator pointing to the end Chris@16: //! of the reversed container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: const_reverse_iterator rend() const; Chris@16: Chris@16: //! Effects: Returns a const_reverse_iterator pointing to the end Chris@16: //! of the reversed container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: const_reverse_iterator crend() const; Chris@16: Chris@16: //! Effects: Returns true if the container contains no elements. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: bool empty() const; Chris@16: Chris@16: //! Effects: Returns the number of the elements contained in the container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: size_type size() const; Chris@16: Chris@16: //! Effects: Returns the largest possible size of the container. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: size_type max_size() const; Chris@101: #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@101: #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@16: //! Effects: Inserts an object x of type Key constructed with Chris@16: //! std::forward(args)... if and only if there is Chris@16: //! no element in the container with equivalent value. Chris@16: //! and returns the iterator pointing to the Chris@16: //! newly inserted element. Chris@16: //! Chris@16: //! Returns: The bool component of the returned pair is true if and only Chris@16: //! if the insertion takes place, and the iterator component of the pair Chris@16: //! points to the element with key equivalent to the key of x. Chris@16: //! Chris@16: //! Throws: If memory allocation throws or Chris@16: //! Key's in-place constructor throws. Chris@16: //! Chris@16: //! Complexity: Logarithmic. Chris@16: template Chris@101: std::pair emplace(BOOST_FWD_REF(Args)... args) Chris@101: { return this->base_t::emplace_unique(boost::forward(args)...); } Chris@16: Chris@16: //! Effects: Inserts an object of type Key constructed with Chris@16: //! std::forward(args)... if and only if there is Chris@16: //! no element in the container with equivalent value. Chris@16: //! p is a hint pointing to where the insert Chris@16: //! should start to search. Chris@16: //! Chris@16: //! Returns: An iterator pointing to the element with key equivalent to the key of x. Chris@16: //! Chris@16: //! Complexity: Logarithmic. Chris@16: template Chris@101: iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args) Chris@101: { return this->base_t::emplace_hint_unique(p, boost::forward(args)...); } Chris@16: Chris@101: #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) Chris@16: Chris@101: #define BOOST_CONTAINER_SET_EMPLACE_CODE(N) \ Chris@101: BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ Chris@101: std::pair emplace(BOOST_MOVE_UREF##N)\ Chris@101: { return this->base_t::emplace_unique(BOOST_MOVE_FWD##N); }\ Chris@101: \ Chris@101: BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ Chris@101: iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ Chris@101: { return this->base_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ Chris@101: // Chris@101: BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SET_EMPLACE_CODE) Chris@101: #undef BOOST_CONTAINER_SET_EMPLACE_CODE Chris@16: Chris@101: #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) Chris@16: Chris@16: #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: //! Effects: Inserts x if and only if there is no element in the container Chris@16: //! with key equivalent to the key of x. Chris@16: //! Chris@16: //! Returns: The bool component of the returned pair is true if and only Chris@16: //! if the insertion takes place, and the iterator component of the pair Chris@16: //! points to the element with key equivalent to the key of x. Chris@16: //! Chris@16: //! Complexity: Logarithmic. Chris@16: std::pair insert(const value_type &x); Chris@16: Chris@16: //! Effects: Move constructs a new value from x if and only if there is Chris@16: //! no element in the container with key equivalent to the key of x. Chris@16: //! Chris@16: //! Returns: The bool component of the returned pair is true if and only Chris@16: //! if the insertion takes place, and the iterator component of the pair Chris@16: //! points to the element with key equivalent to the key of x. Chris@16: //! Chris@16: //! Complexity: Logarithmic. Chris@16: std::pair insert(value_type &&x); Chris@16: #else Chris@16: private: Chris@16: typedef std::pair insert_return_pair; Chris@16: public: Chris@16: BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert) Chris@16: #endif Chris@16: Chris@16: #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: //! Effects: Inserts a copy of x in the container if and only if there is Chris@16: //! no element in the container with key equivalent to the key of x. Chris@16: //! p is a hint pointing to where the insert should start to search. Chris@16: //! Chris@16: //! Returns: An iterator pointing to the element with key equivalent Chris@16: //! to the key of x. Chris@16: //! Chris@16: //! Complexity: Logarithmic in general, but amortized constant if t Chris@16: //! is inserted right before p. Chris@16: iterator insert(const_iterator p, const value_type &x); Chris@16: Chris@16: //! Effects: Inserts an element move constructed from x in the container. Chris@16: //! p is a hint pointing to where the insert should start to search. Chris@16: //! Chris@16: //! Returns: An iterator pointing to the element with key equivalent to the key of x. Chris@16: //! Chris@16: //! Complexity: Logarithmic. Chris@101: iterator insert(const_iterator p, value_type &&x); Chris@16: #else Chris@16: BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator) Chris@16: #endif Chris@16: Chris@16: //! Requires: first, last are not iterators into *this. Chris@16: //! Chris@16: //! Effects: inserts each element from the range [first,last) if and only Chris@16: //! if there is no element with key equivalent to the key of that element. Chris@16: //! Chris@16: //! Complexity: At most N log(size()+N) (N is the distance from first to last) Chris@16: template Chris@16: void insert(InputIterator first, InputIterator last) Chris@101: { this->base_t::insert_unique(first, last); } Chris@101: Chris@101: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@101: //! Effects: inserts each element from the range [il.begin(),il.end()) if and only Chris@101: //! if there is no element with key equivalent to the key of that element. Chris@101: //! Chris@101: //! Complexity: At most N log(size()+N) (N is the distance from il.begin() to il.end()) Chris@101: void insert(std::initializer_list il) Chris@101: { this->base_t::insert_unique(il.begin(), il.end()); } Chris@101: #endif Chris@101: Chris@101: #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@16: //! Effects: Erases the element pointed to by p. Chris@16: //! Chris@16: //! Returns: Returns an iterator pointing to the element immediately Chris@16: //! following q prior to the element being erased. If no such element exists, Chris@16: //! returns end(). Chris@16: //! Chris@16: //! Complexity: Amortized constant time Chris@101: iterator erase(const_iterator p); Chris@16: Chris@16: //! Effects: Erases all elements in the container with key equivalent to x. Chris@16: //! Chris@16: //! Returns: Returns the number of erased elements. Chris@16: //! Chris@16: //! Complexity: log(size()) + count(k) Chris@101: size_type erase(const key_type& x); Chris@16: Chris@16: //! Effects: Erases all the elements in the range [first, last). Chris@16: //! Chris@16: //! Returns: Returns last. Chris@16: //! Chris@16: //! Complexity: log(size())+N where N is the distance from first to last. Chris@101: iterator erase(const_iterator first, const_iterator last); Chris@16: Chris@16: //! Effects: Swaps the contents of *this and x. Chris@16: //! Chris@16: //! Throws: Nothing. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@16: void swap(set& x) Chris@101: BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value Chris@101: && boost::container::container_detail::is_nothrow_swappable::value ); Chris@16: Chris@16: //! Effects: erase(a.begin(),a.end()). Chris@16: //! Chris@16: //! Postcondition: size() == 0. Chris@16: //! Chris@16: //! Complexity: linear in size(). Chris@101: void clear(); Chris@16: Chris@16: //! Effects: Returns the comparison object out Chris@16: //! of which a was constructed. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: key_compare key_comp() const; Chris@16: Chris@16: //! Effects: Returns an object of value_compare constructed out Chris@16: //! of the comparison object. Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: value_compare value_comp() const; Chris@16: Chris@16: //! Returns: An iterator pointing to an element with the key Chris@16: //! equivalent to x, or end() if such an element is not found. Chris@16: //! Chris@16: //! Complexity: Logarithmic. Chris@101: iterator find(const key_type& x); Chris@16: Chris@101: //! Returns: A const_iterator pointing to an element with the key Chris@16: //! equivalent to x, or end() if such an element is not found. Chris@16: //! Chris@16: //! Complexity: Logarithmic. Chris@101: const_iterator find(const key_type& x) const; Chris@101: Chris@101: #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@16: //! Returns: The number of elements with key equivalent to x. Chris@16: //! Chris@16: //! Complexity: log(size())+count(k) Chris@16: size_type count(const key_type& x) const Chris@101: { return static_cast(this->base_t::find(x) != this->base_t::cend()); } Chris@101: Chris@101: //! Returns: The number of elements with key equivalent to x. Chris@101: //! Chris@101: //! Complexity: log(size())+count(k) Chris@101: size_type count(const key_type& x) Chris@101: { return static_cast(this->base_t::find(x) != this->base_t::end()); } Chris@101: Chris@101: #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@16: //! Returns: An iterator pointing to the first element with key not less Chris@16: //! than k, or a.end() if such an element is not found. Chris@16: //! Chris@16: //! Complexity: Logarithmic Chris@101: iterator lower_bound(const key_type& x); Chris@16: Chris@101: //! Returns: A const iterator pointing to the first element with key not Chris@16: //! less than k, or a.end() if such an element is not found. Chris@16: //! Chris@16: //! Complexity: Logarithmic Chris@101: const_iterator lower_bound(const key_type& x) const; Chris@16: Chris@16: //! Returns: An iterator pointing to the first element with key not less Chris@16: //! than x, or end() if such an element is not found. Chris@16: //! Chris@16: //! Complexity: Logarithmic Chris@101: iterator upper_bound(const key_type& x); Chris@16: Chris@101: //! Returns: A const iterator pointing to the first element with key not Chris@16: //! less than x, or end() if such an element is not found. Chris@16: //! Chris@16: //! Complexity: Logarithmic Chris@101: const_iterator upper_bound(const key_type& x) const; Chris@101: Chris@101: #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@16: //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). Chris@16: //! Chris@16: //! Complexity: Logarithmic Chris@16: std::pair equal_range(const key_type& x) Chris@101: { return this->base_t::lower_bound_range(x); } Chris@16: Chris@16: //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). Chris@16: //! Chris@16: //! Complexity: Logarithmic Chris@16: std::pair equal_range(const key_type& x) const Chris@101: { return this->base_t::lower_bound_range(x); } Chris@16: Chris@101: #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@101: //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). Chris@101: //! Chris@101: //! Complexity: Logarithmic Chris@101: std::pair equal_range(const key_type& x); Chris@16: Chris@101: //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). Chris@101: //! Chris@101: //! Complexity: Logarithmic Chris@101: std::pair equal_range(const key_type& x) const; Chris@101: Chris@101: //! Effects: Rebalances the tree. It's a no-op for Red-Black and AVL trees. Chris@101: //! Chris@101: //! Complexity: Linear Chris@101: void rebalance(); Chris@101: Chris@101: //! Effects: Returns true if x and y are equal Chris@101: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator==(const set& x, const set& y); Chris@101: Chris@101: //! Effects: Returns true if x and y are unequal Chris@101: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator!=(const set& x, const set& y); Chris@101: Chris@101: //! Effects: Returns true if x is less than y Chris@101: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator<(const set& x, const set& y); Chris@101: Chris@101: //! Effects: Returns true if x is greater than y Chris@101: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator>(const set& x, const set& y); Chris@101: Chris@101: //! Effects: Returns true if x is equal or less than y Chris@101: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator<=(const set& x, const set& y); Chris@101: Chris@101: //! Effects: Returns true if x is equal or greater than y Chris@101: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator>=(const set& x, const set& y); Chris@101: Chris@101: //! Effects: x.swap(y) Chris@101: //! Chris@101: //! Complexity: Constant. Chris@101: friend void swap(set& x, set& y); Chris@101: Chris@101: #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@101: Chris@101: #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: private: Chris@16: template Chris@16: std::pair priv_insert(BOOST_FWD_REF(KeyType) x) Chris@101: { return this->base_t::insert_unique(::boost::forward(x)); } Chris@16: Chris@16: template Chris@16: iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) Chris@101: { return this->base_t::insert_unique(p, ::boost::forward(x)); } Chris@101: #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: }; Chris@16: Chris@101: #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: Chris@16: } //namespace container { Chris@16: Chris@16: //!has_trivial_destructor_after_move<> == true_type Chris@16: //!specialization for optimizations Chris@101: template Chris@101: struct has_trivial_destructor_after_move > Chris@16: { Chris@101: typedef typename ::boost::container::allocator_traits::pointer pointer; Chris@101: static const bool value = ::boost::has_trivial_destructor_after_move::value && Chris@101: ::boost::has_trivial_destructor_after_move::value && Chris@101: ::boost::has_trivial_destructor_after_move::value; Chris@16: }; Chris@16: Chris@16: namespace container { Chris@16: Chris@101: #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: Chris@101: #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: Chris@16: //! A multiset is a kind of associative container that supports equivalent keys Chris@16: //! (possibly contains multiple copies of the same key value) and provides for Chris@16: //! fast retrieval of the keys themselves. Class multiset supports bidirectional iterators. Chris@16: //! Chris@16: //! A multiset satisfies all of the requirements of a container and of a reversible Chris@16: //! container, and of an associative container). multiset also provides most operations Chris@16: //! described for duplicate keys. Chris@101: //! Chris@101: //! \tparam Key is the type to be inserted in the set, which is also the key_type Chris@101: //! \tparam Compare is the comparison functor used to order keys Chris@101: //! \tparam Allocator is the allocator to be used to allocate memory for this container Chris@101: //! \tparam MultiSetOptions is an packed option type generated using using boost::container::tree_assoc_options. Chris@101: template , class Allocator = new_allocator, class MultiSetOptions = tree_assoc_defaults > Chris@16: #else Chris@101: template Chris@16: #endif Chris@16: class multiset Chris@101: /// @cond Chris@101: : public container_detail::tree Chris@101: , Compare, Allocator, MultiSetOptions> Chris@101: /// @endcond Chris@16: { Chris@101: #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: private: Chris@16: BOOST_COPYABLE_AND_MOVABLE(multiset) Chris@101: typedef container_detail::tree Chris@101: , Compare, Allocator, MultiSetOptions> base_t; Chris@101: #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: Chris@16: public: Chris@16: Chris@16: ////////////////////////////////////////////// Chris@16: // Chris@16: // types Chris@16: // Chris@16: ////////////////////////////////////////////// Chris@16: typedef Key key_type; Chris@16: typedef Key value_type; Chris@16: typedef Compare key_compare; Chris@16: typedef Compare value_compare; Chris@101: typedef ::boost::container::allocator_traits allocator_traits_type; Chris@16: typedef typename ::boost::container::allocator_traits::pointer pointer; Chris@16: typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; Chris@16: typedef typename ::boost::container::allocator_traits::reference reference; Chris@16: typedef typename ::boost::container::allocator_traits::const_reference const_reference; Chris@16: typedef typename ::boost::container::allocator_traits::size_type size_type; Chris@16: typedef typename ::boost::container::allocator_traits::difference_type difference_type; Chris@16: typedef Allocator allocator_type; Chris@101: typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type; Chris@101: typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator; Chris@101: typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator; Chris@101: typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator; Chris@101: typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator; Chris@16: Chris@16: ////////////////////////////////////////////// Chris@16: // Chris@16: // construct/copy/destroy Chris@16: // Chris@16: ////////////////////////////////////////////// Chris@16: Chris@101: //! @copydoc ::boost::container::set::set() Chris@16: multiset() Chris@101: : base_t() Chris@16: {} Chris@16: Chris@101: //! @copydoc ::boost::container::set::set(const Compare&, const allocator_type&) Chris@16: explicit multiset(const Compare& comp, Chris@16: const allocator_type& a = allocator_type()) Chris@101: : base_t(comp, a) Chris@16: {} Chris@16: Chris@101: //! @copydoc ::boost::container::set::set(const allocator_type&) Chris@16: explicit multiset(const allocator_type& a) Chris@101: : base_t(a) Chris@16: {} Chris@16: Chris@101: //! @copydoc ::boost::container::set::set(InputIterator, InputIterator, const Compare& comp, const allocator_type&) Chris@16: template Chris@16: multiset(InputIterator first, InputIterator last, Chris@16: const Compare& comp = Compare(), Chris@16: const allocator_type& a = allocator_type()) Chris@101: : base_t(false, first, last, comp, a) Chris@101: {} Chris@101: Chris@101: //! @copydoc ::boost::container::set::set(InputIterator, InputIterator, const allocator_type&) Chris@101: template Chris@101: multiset(InputIterator first, InputIterator last, const allocator_type& a) Chris@101: : base_t(false, first, last, key_compare(), a) Chris@16: {} Chris@16: Chris@16: //! Effects: Constructs an empty multiset using the specified comparison object and Chris@16: //! allocator, and inserts elements from the ordered range [first ,last ). This function Chris@16: //! is more efficient than the normal range creation for ordered ranges. Chris@16: //! Chris@16: //! Requires: [first ,last) must be ordered according to the predicate. Chris@16: //! Chris@16: //! Complexity: Linear in N. Chris@16: //! Chris@16: //! Note: Non-standard extension. Chris@16: template Chris@16: multiset( ordered_range_t, InputIterator first, InputIterator last Chris@16: , const Compare& comp = Compare() Chris@16: , const allocator_type& a = allocator_type()) Chris@101: : base_t(ordered_range, first, last, comp, a) Chris@16: {} Chris@16: Chris@101: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@101: //! @copydoc ::boost::container::set::set(std::initializer_list, const Compare& comp, const allocator_type&) Chris@101: multiset(std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) Chris@101: : base_t(false, il.begin(), il.end(), comp, a) Chris@16: {} Chris@16: Chris@101: //! @copydoc ::boost::container::set::set(std::initializer_list, const allocator_type&) Chris@101: multiset(std::initializer_list il, const allocator_type& a) Chris@101: : base_t(false, il.begin(), il.end(), Compare(), a) Chris@16: {} Chris@16: Chris@101: //! @copydoc ::boost::container::set::set(ordered_unique_range_t, std::initializer_list, const Compare& comp, const allocator_type&) Chris@101: multiset(ordered_unique_range_t, std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) Chris@101: : base_t(ordered_range, il.begin(), il.end(), comp, a) Chris@101: {} Chris@101: #endif Chris@101: Chris@101: //! @copydoc ::boost::container::set::set(const set &) Chris@101: multiset(const multiset& x) Chris@101: : base_t(static_cast(x)) Chris@16: {} Chris@16: Chris@101: //! @copydoc ::boost::container::set(set &&) Chris@101: multiset(BOOST_RV_REF(multiset) x) Chris@101: : base_t(BOOST_MOVE_BASE(base_t, x)) Chris@16: {} Chris@16: Chris@101: //! @copydoc ::boost::container::set(const set &, const allocator_type &) Chris@101: multiset(const multiset& x, const allocator_type &a) Chris@101: : base_t(static_cast(x), a) Chris@101: {} Chris@101: Chris@101: //! @copydoc ::boost::container::set(set &&, const allocator_type &) Chris@101: multiset(BOOST_RV_REF(multiset) x, const allocator_type &a) Chris@101: : base_t(BOOST_MOVE_BASE(base_t, x), a) Chris@101: {} Chris@101: Chris@101: //! @copydoc ::boost::container::set::operator=(const set &) Chris@16: multiset& operator=(BOOST_COPY_ASSIGN_REF(multiset) x) Chris@101: { return static_cast(this->base_t::operator=(static_cast(x))); } Chris@16: Chris@101: //! @copydoc ::boost::container::set::operator=(set &&) Chris@16: multiset& operator=(BOOST_RV_REF(multiset) x) Chris@101: BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value Chris@101: && boost::container::container_detail::is_nothrow_move_assignable::value ) Chris@101: { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } Chris@16: Chris@101: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@101: //! @copydoc ::boost::container::set::operator=(std::initializer_list) Chris@101: multiset& operator=(std::initializer_list il) Chris@101: { Chris@101: this->clear(); Chris@101: insert(il.begin(), il.end()); Chris@101: return *this; Chris@101: } Chris@101: #endif Chris@101: #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@101: //! @copydoc ::boost::container::set::get_allocator() Chris@101: allocator_type get_allocator() const; Chris@16: Chris@101: //! @copydoc ::boost::container::set::get_stored_allocator() Chris@101: stored_allocator_type &get_stored_allocator(); Chris@16: Chris@101: //! @copydoc ::boost::container::set::get_stored_allocator() const Chris@101: const stored_allocator_type &get_stored_allocator() const; Chris@16: Chris@101: //! @copydoc ::boost::container::set::begin() Chris@101: iterator begin(); Chris@16: Chris@101: //! @copydoc ::boost::container::set::begin() const Chris@101: const_iterator begin() const; Chris@16: Chris@101: //! @copydoc ::boost::container::set::cbegin() const Chris@101: const_iterator cbegin() const; Chris@16: Chris@101: //! @copydoc ::boost::container::set::end() Chris@101: iterator end() BOOST_NOEXCEPT_OR_NOTHROW; Chris@16: Chris@101: //! @copydoc ::boost::container::set::end() const Chris@101: const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW; Chris@16: Chris@101: //! @copydoc ::boost::container::set::cend() const Chris@101: const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW; Chris@16: Chris@101: //! @copydoc ::boost::container::set::rbegin() Chris@101: reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW; Chris@16: Chris@101: //! @copydoc ::boost::container::set::rbegin() const Chris@101: const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW; Chris@16: Chris@101: //! @copydoc ::boost::container::set::crbegin() const Chris@101: const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW; Chris@16: Chris@101: //! @copydoc ::boost::container::set::rend() Chris@101: reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW; Chris@16: Chris@101: //! @copydoc ::boost::container::set::rend() const Chris@101: const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW; Chris@16: Chris@101: //! @copydoc ::boost::container::set::crend() const Chris@101: const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW; Chris@16: Chris@101: //! @copydoc ::boost::container::set::empty() const Chris@101: bool empty() const; Chris@16: Chris@101: //! @copydoc ::boost::container::set::size() const Chris@101: size_type size() const; Chris@16: Chris@101: //! @copydoc ::boost::container::set::max_size() const Chris@101: size_type max_size() const; Chris@16: Chris@101: #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@101: #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@16: //! Effects: Inserts an object of type Key constructed with Chris@16: //! std::forward(args)... and returns the iterator pointing to the Chris@16: //! newly inserted element. Chris@16: //! Chris@16: //! Complexity: Logarithmic. Chris@16: template Chris@101: iterator emplace(BOOST_FWD_REF(Args)... args) Chris@101: { return this->base_t::emplace_equal(boost::forward(args)...); } Chris@16: Chris@16: //! Effects: Inserts an object of type Key constructed with Chris@16: //! std::forward(args)... Chris@16: //! Chris@16: //! Returns: An iterator pointing to the element with key equivalent Chris@16: //! to the key of x. Chris@16: //! Chris@16: //! Complexity: Logarithmic in general, but amortized constant if t Chris@16: //! is inserted right before p. Chris@16: template Chris@101: iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args) Chris@101: { return this->base_t::emplace_hint_equal(p, boost::forward(args)...); } Chris@16: Chris@101: #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) Chris@16: Chris@101: #define BOOST_CONTAINER_MULTISET_EMPLACE_CODE(N) \ Chris@101: BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ Chris@101: iterator emplace(BOOST_MOVE_UREF##N)\ Chris@101: { return this->base_t::emplace_equal(BOOST_MOVE_FWD##N); }\ Chris@101: \ Chris@101: BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ Chris@101: iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ Chris@101: { return this->base_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ Chris@101: // Chris@101: BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_MULTISET_EMPLACE_CODE) Chris@101: #undef BOOST_CONTAINER_MULTISET_EMPLACE_CODE Chris@16: Chris@101: #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) Chris@16: Chris@16: #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: //! Effects: Inserts x and returns the iterator pointing to the Chris@16: //! newly inserted element. Chris@16: //! Chris@16: //! Complexity: Logarithmic. Chris@16: iterator insert(const value_type &x); Chris@16: Chris@16: //! Effects: Inserts a copy of x in the container. Chris@16: //! Chris@16: //! Returns: An iterator pointing to the element with key equivalent Chris@16: //! to the key of x. Chris@16: //! Chris@16: //! Complexity: Logarithmic in general, but amortized constant if t Chris@16: //! is inserted right before p. Chris@16: iterator insert(value_type &&x); Chris@16: #else Chris@16: BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert) Chris@16: #endif Chris@16: Chris@16: #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: //! Effects: Inserts a copy of x in the container. Chris@16: //! p is a hint pointing to where the insert should start to search. Chris@16: //! Chris@16: //! Returns: An iterator pointing to the element with key equivalent Chris@16: //! to the key of x. Chris@16: //! Chris@16: //! Complexity: Logarithmic in general, but amortized constant if t Chris@16: //! is inserted right before p. Chris@16: iterator insert(const_iterator p, const value_type &x); Chris@16: Chris@16: //! Effects: Inserts a value move constructed from x in the container. Chris@16: //! p is a hint pointing to where the insert should start to search. Chris@16: //! Chris@16: //! Returns: An iterator pointing to the element with key equivalent Chris@16: //! to the key of x. Chris@16: //! Chris@16: //! Complexity: Logarithmic in general, but amortized constant if t Chris@16: //! is inserted right before p. Chris@101: iterator insert(const_iterator p, value_type &&x); Chris@16: #else Chris@16: BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator) Chris@16: #endif Chris@16: Chris@16: //! Requires: first, last are not iterators into *this. Chris@16: //! Chris@16: //! Effects: inserts each element from the range [first,last) . Chris@16: //! Chris@16: //! Complexity: At most N log(size()+N) (N is the distance from first to last) Chris@16: template Chris@16: void insert(InputIterator first, InputIterator last) Chris@101: { this->base_t::insert_equal(first, last); } Chris@16: Chris@101: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@101: //! @copydoc ::boost::container::set::insert(std::initializer_list) Chris@101: void insert(std::initializer_list il) Chris@101: { this->base_t::insert_equal(il.begin(), il.end()); } Chris@101: #endif Chris@101: Chris@101: #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@101: Chris@101: //! @copydoc ::boost::container::set::erase(const_iterator) Chris@101: iterator erase(const_iterator p); Chris@101: Chris@101: //! @copydoc ::boost::container::set::erase(const key_type&) Chris@101: size_type erase(const key_type& x); Chris@101: Chris@101: //! @copydoc ::boost::container::set::erase(const_iterator,const_iterator) Chris@101: iterator erase(const_iterator first, const_iterator last); Chris@101: Chris@101: //! @copydoc ::boost::container::set::swap Chris@101: void swap(multiset& x) Chris@101: BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value Chris@101: && boost::container::container_detail::is_nothrow_swappable::value ); Chris@101: Chris@101: //! @copydoc ::boost::container::set::clear Chris@101: void clear() BOOST_NOEXCEPT_OR_NOTHROW; Chris@101: Chris@101: //! @copydoc ::boost::container::set::key_comp Chris@101: key_compare key_comp() const; Chris@101: Chris@101: //! @copydoc ::boost::container::set::value_comp Chris@101: value_compare value_comp() const; Chris@101: Chris@101: //! @copydoc ::boost::container::set::find(const key_type& ) Chris@101: iterator find(const key_type& x); Chris@101: Chris@101: //! @copydoc ::boost::container::set::find(const key_type& ) const Chris@101: const_iterator find(const key_type& x) const; Chris@101: Chris@101: //! @copydoc ::boost::container::set::count(const key_type& ) const Chris@101: size_type count(const key_type& x) const; Chris@101: Chris@101: //! @copydoc ::boost::container::set::lower_bound(const key_type& ) Chris@101: iterator lower_bound(const key_type& x); Chris@101: Chris@101: //! @copydoc ::boost::container::set::lower_bound(const key_type& ) const Chris@101: const_iterator lower_bound(const key_type& x) const; Chris@101: Chris@101: //! @copydoc ::boost::container::set::upper_bound(const key_type& ) Chris@101: iterator upper_bound(const key_type& x); Chris@101: Chris@101: //! @copydoc ::boost::container::set::upper_bound(const key_type& ) const Chris@101: const_iterator upper_bound(const key_type& x) const; Chris@101: Chris@101: //! @copydoc ::boost::container::set::equal_range(const key_type& ) const Chris@101: std::pair equal_range(const key_type& x) const; Chris@101: Chris@101: //! @copydoc ::boost::container::set::equal_range(const key_type& ) Chris@101: std::pair equal_range(const key_type& x); Chris@101: Chris@101: //! @copydoc ::boost::container::set::rebalance() Chris@101: void rebalance(); Chris@101: Chris@101: //! Effects: Returns true if x and y are equal Chris@16: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator==(const multiset& x, const multiset& y); Chris@101: Chris@101: //! Effects: Returns true if x and y are unequal Chris@16: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator!=(const multiset& x, const multiset& y); Chris@16: Chris@101: //! Effects: Returns true if x is less than y Chris@16: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator<(const multiset& x, const multiset& y); Chris@101: Chris@101: //! Effects: Returns true if x is greater than y Chris@16: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator>(const multiset& x, const multiset& y); Chris@16: Chris@101: //! Effects: Returns true if x is equal or less than y Chris@16: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator<=(const multiset& x, const multiset& y); Chris@101: Chris@101: //! Effects: Returns true if x is equal or greater than y Chris@16: //! Chris@101: //! Complexity: Linear to the number of elements in the container. Chris@101: friend bool operator>=(const multiset& x, const multiset& y); Chris@16: Chris@101: //! Effects: x.swap(y) Chris@16: //! Chris@16: //! Complexity: Constant. Chris@101: friend void swap(multiset& x, multiset& y); Chris@16: Chris@101: #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) Chris@16: Chris@101: #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: private: Chris@16: template Chris@16: iterator priv_insert(BOOST_FWD_REF(KeyType) x) Chris@101: { return this->base_t::insert_equal(::boost::forward(x)); } Chris@16: Chris@16: template Chris@16: iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) Chris@101: { return this->base_t::insert_equal(p, ::boost::forward(x)); } Chris@16: Chris@101: #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: }; Chris@16: Chris@101: #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: Chris@16: } //namespace container { Chris@16: Chris@16: //!has_trivial_destructor_after_move<> == true_type Chris@16: //!specialization for optimizations Chris@101: template Chris@101: struct has_trivial_destructor_after_move > Chris@16: { Chris@101: typedef typename ::boost::container::allocator_traits::pointer pointer; Chris@101: static const bool value = ::boost::has_trivial_destructor_after_move::value && Chris@101: ::boost::has_trivial_destructor_after_move::value && Chris@101: ::boost::has_trivial_destructor_after_move::value; Chris@16: }; Chris@16: Chris@16: namespace container { Chris@16: Chris@101: #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED Chris@16: Chris@16: }} Chris@16: Chris@16: #include Chris@16: Chris@101: #endif // BOOST_CONTAINER_SET_HPP