#include <boost/move/detail/fwd_macros.hpp>
#endif
#include <boost/move/detail/move_helpers.hpp>
+#include <boost/move/detail/force_ptr.hpp>
// intrusive
#include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
#include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal
template<class D, class S>
BOOST_CONTAINER_FORCEINLINE static D &force(S &s)
-{ return *reinterpret_cast<D*>(&s); }
+{ return *move_detail::force_ptr<D*>(&s); }
template<class D, class S>
BOOST_CONTAINER_FORCEINLINE static D force_copy(const S &s)
{
- const D *const vp = reinterpret_cast<const D *>(&s);
+ const D *const vp = move_detail::force_ptr<const D *>(&s);
D ret_val(*vp);
return ret_val;
}
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<allocator_type>(m_flat_tree.get_allocator()); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension.
- BOOST_CONTAINER_FORCEINLINE get_stored_allocator_noconst_return_t get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ get_stored_allocator_noconst_return_t get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW
{
impl_get_stored_allocator_noconst_return_t r = m_flat_tree.get_stored_allocator();
return dtl::force<stored_allocator_type>(r);
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension.
- BOOST_CONTAINER_FORCEINLINE get_stored_allocator_const_return_t get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ get_stored_allocator_const_return_t get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
{
impl_get_stored_allocator_const_return_t r = m_flat_tree.get_stored_allocator();
return dtl::force<const stored_allocator_type>(r);
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator begin() BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<iterator>(m_flat_tree.begin()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_iterator>(m_flat_tree.begin()); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator end() BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<iterator>(m_flat_tree.end()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_iterator>(m_flat_tree.end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<reverse_iterator>(m_flat_tree.rbegin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_reverse_iterator>(m_flat_tree.rbegin()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<reverse_iterator>(m_flat_tree.rend()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_reverse_iterator>(m_flat_tree.rend()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_iterator>(m_flat_tree.cbegin()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_iterator>(m_flat_tree.cend()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_reverse_iterator>(m_flat_tree.crbegin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_reverse_iterator>(m_flat_tree.crend()); }
//////////////////////////////////////////////
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE bool empty() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ bool empty() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ size_type size() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.max_size(); }
//! <b>Effects</b>: Number of elements for which memory has been allocated.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.capacity(); }
//! <b>Effects</b>: If n is less than or equal to capacity(), or the
}
//! @copydoc ::boost::container::flat_set::nth(size_type)
- BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<iterator>(m_flat_tree.nth(n)); }
//! @copydoc ::boost::container::flat_set::nth(size_type) const
- BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<iterator>(m_flat_tree.nth(n)); }
//! @copydoc ::boost::container::flat_set::index_of(iterator)
- BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.index_of(dtl::force_copy<impl_iterator>(p)); }
//! @copydoc ::boost::container::flat_set::index_of(const_iterator) const
- BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.index_of(dtl::force_copy<impl_const_iterator>(p)); }
//! Returns: A reference to the element whose key is equivalent to x.
//! Throws: An exception object of type out_of_range if no such element is present.
//!
//! Complexity: logarithmic.
- T& at(const key_type& k)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD T& at(const key_type& k)
{
iterator i = this->find(k);
if(i == this->end()){
//! Throws: An exception object of type out_of_range if no such element is present.
//!
//! Complexity: logarithmic.
- const T& at(const key_type& k) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD const T& at(const key_type& k) const
{
const_iterator i = this->find(k);
if(i == this->end()){
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
- { return dtl::force_copy<std::pair<iterator,bool> >(
- m_flat_tree.insert_unique(boost::move(dtl::force<impl_value_type>(x)))); }
+ {
+ return dtl::force_copy<std::pair<iterator,bool> >(
+ m_flat_tree.insert_unique(boost::move(dtl::force<impl_value_type>(x))));
+ }
- //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
+ //! <b>Effects</b>: Inserts a new value_type constructed from the pair if and
//! only if there is no element in the container with key equivalent to the key of x.
//!
//! <b>Returns</b>: The bool component of the returned pair is true if and only
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(BOOST_RV_REF(movable_value_type) x)
+ template <class Pair>
+ BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_DOC1ST
+ ( std::pair<iterator BOOST_MOVE_I bool>
+ , typename dtl::enable_if_c<dtl::is_convertible<Pair BOOST_MOVE_I impl_value_type>::value
+ BOOST_MOVE_I std::pair<iterator BOOST_MOVE_I bool> >::type)
+ insert(BOOST_FWD_REF(Pair) x)
{
return dtl::force_copy<std::pair<iterator,bool> >
- (m_flat_tree.insert_unique(boost::move(x)));
+ (m_flat_tree.emplace_unique(boost::forward<Pair>(x)));
}
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
, boost::move(dtl::force<impl_value_type>(x))));
}
- //! <b>Effects</b>: Inserts an element move constructed from x in the container.
+ //! <b>Effects</b>: Inserts an element constructed from x in the container.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x)
+ template <class Pair>
+ BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_DOC1ST
+ ( iterator
+ , typename dtl::enable_if_c<dtl::is_convertible<Pair BOOST_MOVE_I impl_value_type>::value
+ BOOST_MOVE_I iterator>::type)
+ insert(const_iterator p, BOOST_FWD_REF(Pair) x)
{
return dtl::force_copy<iterator>(
- m_flat_tree.insert_unique(dtl::force_copy<impl_const_iterator>(p), boost::move(x)));
+ m_flat_tree.emplace_hint_unique(dtl::force_copy<impl_const_iterator>(p), boost::forward<Pair>(x)));
}
//! <b>Requires</b>: first, last are not iterators into *this.
//! <b>Requires</b>: this->get_allocator() == source.get_allocator().
//!
- //! <b>Effects</b>: Attempts to extract each element in source and insert it into a using
+ //! <b>Effects</b>: Move-inserts each element from source into *this a using
//! the comparison object of *this. If there is an element in a with key equivalent to the
- //! key of an element from source, then that element is not extracted from source.
- //!
- //! <b>Postcondition</b>: Pointers and references to the transferred elements of source refer
- //! to those same elements but as members of *this. Iterators referring to the transferred
- //! elements will continue to refer to their elements, but they now behave as iterators into *this,
- //! not into source.
+ //! key of an element from source, then that element is not moved from source.
//!
- //! <b>Throws</b>: Nothing unless the comparison object throws.
+ //! <b>Complexity</b>: Linear in this->size() + source.size().
//!
- //! <b>Complexity</b>: N log(size() + N) (N has the value source.size())
+ //! <b>Note</b>: Invalidates all iterators and references.
template<class C2>
BOOST_CONTAINER_FORCEINLINE void merge(flat_map<Key, T, C2, AllocatorOrContainer>& source)
{ m_flat_tree.merge_unique(source.tree()); }
(m_flat_tree.erase(dtl::force_copy<impl_const_iterator>(p)));
}
- //! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
+ //! <b>Effects</b>: If present, erases the element in the container with key equivalent to x.
//!
- //! <b>Returns</b>: Returns the number of erased elements.
+ //! <b>Returns</b>: Returns the number of erased elements (0/1).
//!
//! <b>Complexity</b>: Logarithmic search time plus erasure time
//! linear to the elements with bigger keys.
BOOST_CONTAINER_FORCEINLINE size_type erase(const key_type& x)
- { return m_flat_tree.erase(x); }
+ { return m_flat_tree.erase_unique(x); }
//! <b>Effects</b>: Erases all the elements in the range [first, last).
//!
//! of which a was constructed.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ key_compare key_comp() const
{ return dtl::force_copy<key_compare>(m_flat_tree.key_comp()); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ value_compare value_comp() const
{ return value_compare(dtl::force_copy<key_compare>(m_flat_tree.key_comp())); }
//////////////////////////////////////////////
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- BOOST_CONTAINER_FORCEINLINE iterator find(const key_type& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator find(const key_type& x)
{ return dtl::force_copy<iterator>(m_flat_tree.find(x)); }
//! <b>Returns</b>: A const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator find(const key_type& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.find(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic.
template<class K>
- BOOST_CONTAINER_FORCEINLINE iterator find(const K& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator find(const K& x)
{ return dtl::force_copy<iterator>(m_flat_tree.find(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic.
template<class K>
- BOOST_CONTAINER_FORCEINLINE const_iterator find(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator find(const K& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.find(x)); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
//! <b>Complexity</b>: log(size())+count(k)
- BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ size_type count(const key_type& x) const
{ return static_cast<size_type>(m_flat_tree.find(x) != m_flat_tree.end()); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: log(size())+count(k)
template<class K>
- BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ size_type count(const K& x) const
//Don't use find() != end optimization here as transparent comparators with key K might
//return a different range than key_type (which can only return a single element range)
{ return m_flat_tree.count(x); }
//! equivalent to key in the container, otherwise false.
//!
//! <b>Complexity</b>: log(size()).
- bool contains(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ bool contains(const key_type& x) const
{ return m_flat_tree.find(x) != m_flat_tree.end(); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: log(size()).
template<typename K>
- bool contains(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ bool contains(const K& x) const
{ return m_flat_tree.find(x) != m_flat_tree.end(); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator lower_bound(const key_type& x)
{ return dtl::force_copy<iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator lower_bound(const key_type& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic.
template<class K>
- BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const K& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator lower_bound(const K& x)
{ return dtl::force_copy<iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic.
template<class K>
- BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator lower_bound(const K& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: An iterator pointing to the first element with key greater
//! than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator upper_bound(const key_type& x)
{ return dtl::force_copy<iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Returns</b>: A const iterator pointing to the first element with key
//! greater than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator upper_bound(const key_type& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic.
template<class K>
- BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const K& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator upper_bound(const K& x)
{ return dtl::force_copy<iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic.
template<class K>
- BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator upper_bound(const K& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic.
- BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const key_type& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ std::pair<iterator,iterator> equal_range(const key_type& x)
{ return dtl::force_copy<std::pair<iterator,iterator> >(m_flat_tree.lower_bound_range(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic.
- BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const
{ return dtl::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.lower_bound_range(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic.
template<class K>
- BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const K& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ std::pair<iterator,iterator> equal_range(const K& x)
//Don't use lower_bound_range optimization here as transparent comparators with key K might
//return a different range than key_type (which can only return a single element range)
{ return dtl::force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
//!
//! <b>Complexity</b>: Logarithmic.
template<class K>
- BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ std::pair<const_iterator, const_iterator> equal_range(const K& x) const
//Don't use lower_bound_range optimization here as transparent comparators with key K might
//return a different range than key_type (which can only return a single element range)
{ return dtl::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Postcondition</b>: this->empty()
//!
//! <b>Throws</b>: If secuence_type's move constructor throws
- BOOST_CONTAINER_FORCEINLINE sequence_type extract_sequence()
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE sequence_type extract_sequence()
{
return boost::move(dtl::force<sequence_type>(m_flat_tree.get_sequence_ref()));
}
//! <b>Effects</b>: Returns true if x and y are equal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator==(const flat_map& x, const flat_map& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator==(const flat_map& x, const flat_map& y)
{ return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); }
//! <b>Effects</b>: Returns true if x and y are unequal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const flat_map& x, const flat_map& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator!=(const flat_map& x, const flat_map& y)
{ return !(x == y); }
//! <b>Effects</b>: Returns true if x is less than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator<(const flat_map& x, const flat_map& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator<(const flat_map& x, const flat_map& y)
{ return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
//! <b>Effects</b>: Returns true if x is greater than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator>(const flat_map& x, const flat_map& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator>(const flat_map& x, const flat_map& y)
{ return y < x; }
//! <b>Effects</b>: Returns true if x is equal or less than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const flat_map& x, const flat_map& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator<=(const flat_map& x, const flat_map& y)
{ return !(y < x); }
//! <b>Effects</b>: Returns true if x is equal or greater than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const flat_map& x, const flat_map& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator>=(const flat_map& x, const flat_map& y)
{ return !(x < y); }
//! <b>Effects</b>: x.swap(y)
//!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE friend void swap(flat_map& x, flat_map& y)
+ BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
mapped_type &priv_subscript(const key_type& k)
{
- iterator i = lower_bound(k);
+ iterator i = this->lower_bound(k);
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first)){
dtl::value_init<mapped_type> m;
- i = insert(i, impl_value_type(k, ::boost::move(m.m_t)));
+ impl_value_type v(k, ::boost::move(m.m_t));
+ i = this->insert(i, ::boost::move(v));
}
return (*i).second;
}
mapped_type &priv_subscript(BOOST_RV_REF(key_type) mk)
{
key_type &k = mk;
- iterator i = lower_bound(k);
+ iterator i = this->lower_bound(k);
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first)){
dtl::value_init<mapped_type> m;
- i = insert(i, impl_value_type(boost::move(k), ::boost::move(m.m_t)));
+ impl_value_type v(::boost::move(k), ::boost::move(m.m_t));
+ i = this->insert(i, ::boost::move(v));
}
return (*i).second;
}
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<allocator_type>(m_flat_tree.get_allocator()); }
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force<const stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
iterator begin() BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<iterator>(m_flat_tree.begin()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_iterator>(m_flat_tree.begin()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
iterator end() BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<iterator>(m_flat_tree.end()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_iterator>(m_flat_tree.end()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<reverse_iterator>(m_flat_tree.rbegin()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_reverse_iterator>(m_flat_tree.rbegin()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<reverse_iterator>(m_flat_tree.rend()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_reverse_iterator>(m_flat_tree.rend()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_iterator>(m_flat_tree.cbegin()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_iterator>(m_flat_tree.cend()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_reverse_iterator>(m_flat_tree.crbegin()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<const_reverse_iterator>(m_flat_tree.crend()); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
bool empty() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.empty(); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
size_type size() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.size(); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.max_size(); }
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.capacity(); }
{ m_flat_tree.shrink_to_fit(); }
//! @copydoc ::boost::container::flat_set::nth(size_type)
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<iterator>(m_flat_tree.nth(n)); }
//! @copydoc ::boost::container::flat_set::nth(size_type) const
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW
{ return dtl::force_copy<iterator>(m_flat_tree.nth(n)); }
//! @copydoc ::boost::container::flat_set::index_of(iterator)
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.index_of(dtl::force_copy<impl_iterator>(p)); }
//! @copydoc ::boost::container::flat_set::index_of(const_iterator) const
- BOOST_CONTAINER_FORCEINLINE
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_flat_tree.index_of(dtl::force_copy<impl_const_iterator>(p)); }
m_flat_tree.insert_equal(dtl::force<const impl_value_type>(x)));
}
- //! <b>Effects</b>: Inserts a new value move-constructed from x and returns
- //! the iterator pointing to the newly inserted element.
- //!
- //! <b>Complexity</b>: Logarithmic search time plus linear insertion
- //! to the elements with bigger keys than x.
- //!
- //! <b>Note</b>: If an element is inserted it might invalidate elements.
- BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF(value_type) x)
- { return dtl::force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
-
- //! <b>Effects</b>: Inserts a new value move-constructed from x and returns
+ //! <b>Effects</b>: Inserts a new value constructed from x and returns
//! the iterator pointing to the newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF(impl_value_type) x)
- { return dtl::force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
+ template<class Pair>
+ BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_DOC1ST
+ ( iterator
+ , typename dtl::enable_if_c<dtl::is_convertible<Pair BOOST_MOVE_I impl_value_type>::value
+ BOOST_MOVE_I iterator >::type)
+ insert(BOOST_FWD_REF(Pair) x)
+ { return dtl::force_copy<iterator>(m_flat_tree.emplace_equal(boost::forward<Pair>(x))); }
//! <b>Effects</b>: Inserts a copy of x in the container.
//! p is a hint pointing to where the insert should start to search.
, dtl::force<const impl_value_type>(x)));
}
- //! <b>Effects</b>: Inserts a value move constructed from x in the container.
+ //! <b>Effects</b>: Inserts a value constructed from x in the container.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
- {
- return dtl::force_copy<iterator>
- (m_flat_tree.insert_equal(dtl::force_copy<impl_const_iterator>(p)
- , boost::move(x)));
- }
-
- //! <b>Effects</b>: Inserts a value move constructed from x in the container.
- //! p is a hint pointing to where the insert should start to search.
- //!
- //! <b>Returns</b>: An iterator pointing to the element with key equivalent
- //! to the key of x.
- //!
- //! <b>Complexity</b>: Logarithmic search time (constant time if the value
- //! is to be inserted before p) plus linear insertion
- //! to the elements with bigger keys than x.
- //!
- //! <b>Note</b>: If an element is inserted it might invalidate elements.
- BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(impl_value_type) x)
+ template<class Pair>
+ BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_DOC1ST
+ ( iterator
+ , typename dtl::enable_if_c<dtl::is_convertible<Pair BOOST_MOVE_I impl_value_type>::value
+ BOOST_MOVE_I iterator>::type)
+ insert(const_iterator p, BOOST_FWD_REF(Pair) x)
{
return dtl::force_copy<iterator>(
- m_flat_tree.insert_equal(dtl::force_copy<impl_const_iterator>(p), boost::move(x)));
+ m_flat_tree.emplace_hint_equal(dtl::force_copy<impl_const_iterator>(p), boost::forward<Pair>(x)));
}
//! <b>Requires</b>: first, last are not iterators into *this.
//! <b>Requires</b>: this->get_allocator() == source.get_allocator().
//!
- //! <b>Effects</b>: Extracts each element in source and insert it into a using
+ //! <b>Effects</b>: Move-inserts each element from source into *this a using
//! the comparison object of *this.
- //!
- //! <b>Postcondition</b>: Pointers and references to the transferred elements of source refer
- //! to those same elements but as members of *this. Iterators referring to the transferred
- //! elements will continue to refer to their elements, but they now behave as iterators into *this,
- //! not into source.
//!
- //! <b>Throws</b>: Nothing unless the comparison object throws.
+ //! <b>Complexity</b>: Linear in this->size() + source.size().
//!
- //! <b>Complexity</b>: N log(size() + N) (N has the value source.size())
+ //! <b>Note</b>: Invalidates all iterators and references.
template<class C2>
BOOST_CONTAINER_FORCEINLINE void merge(flat_multimap<Key, T, C2, AllocatorOrContainer>& source)
{ m_flat_tree.merge_equal(source.tree()); }
//! of which a was constructed.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ key_compare key_comp() const
{ return dtl::force_copy<key_compare>(m_flat_tree.key_comp()); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
//!
//! <b>Complexity</b>: Constant.
- BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ value_compare value_comp() const
{ return value_compare(dtl::force_copy<key_compare>(m_flat_tree.key_comp())); }
//////////////////////////////////////////////
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- BOOST_CONTAINER_FORCEINLINE iterator find(const key_type& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator find(const key_type& x)
{ return dtl::force_copy<iterator>(m_flat_tree.find(x)); }
//! <b>Returns</b>: An const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator find(const key_type& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.find(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic.
template<class K>
- BOOST_CONTAINER_FORCEINLINE iterator find(const K& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator find(const K& x)
{ return dtl::force_copy<iterator>(m_flat_tree.find(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic.
template<class K>
- BOOST_CONTAINER_FORCEINLINE const_iterator find(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator find(const K& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.find(x)); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
//! <b>Complexity</b>: log(size())+count(k)
- BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ size_type count(const key_type& x) const
{ return m_flat_tree.count(x); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: log(size())+count(k)
template<class K>
- BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ size_type count(const K& x) const
{ return m_flat_tree.count(x); }
//! <b>Returns</b>: Returns true if there is an element with key
//! equivalent to key in the container, otherwise false.
//!
//! <b>Complexity</b>: log(size()).
- bool contains(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ bool contains(const key_type& x) const
{ return m_flat_tree.find(x) != m_flat_tree.end(); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: log(size()).
template<typename K>
- bool contains(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ bool contains(const K& x) const
{ return m_flat_tree.find(x) != m_flat_tree.end(); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator lower_bound(const key_type& x)
{ return dtl::force_copy<iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator lower_bound(const key_type& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic
template<class K>
- BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const K& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator lower_bound(const K& x)
{ return dtl::force_copy<iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic
template<class K>
- BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator lower_bound(const K& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: An iterator pointing to the first element with key greater
//! than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator upper_bound(const key_type& x)
{return dtl::force_copy<iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Returns</b>: A const iterator pointing to the first element with key
//! greater than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator upper_bound(const key_type& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic
template<class K>
- BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const K& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ iterator upper_bound(const K& x)
{return dtl::force_copy<iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic
template<class K>
- BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ const_iterator upper_bound(const K& x) const
{ return dtl::force_copy<const_iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const key_type& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ std::pair<iterator,iterator> equal_range(const key_type& x)
{ return dtl::force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const
{ return dtl::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic
template<class K>
- BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const K& x)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ std::pair<iterator,iterator> equal_range(const K& x)
{ return dtl::force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Requires</b>: This overload is available only if
//!
//! <b>Complexity</b>: Logarithmic
template<class K>
- BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const K& x) const
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ std::pair<const_iterator, const_iterator> equal_range(const K& x) const
{ return dtl::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Effects</b>: Extracts the internal sequence container.
//! <b>Postcondition</b>: this->empty()
//!
//! <b>Throws</b>: If secuence_type's move constructor throws
- BOOST_CONTAINER_FORCEINLINE sequence_type extract_sequence()
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ sequence_type extract_sequence()
{
return boost::move(dtl::force<sequence_type>(m_flat_tree.get_sequence_ref()));
}
//! <b>Effects</b>: Returns true if x and y are equal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator==(const flat_multimap& x, const flat_multimap& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator==(const flat_multimap& x, const flat_multimap& y)
{ return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); }
//! <b>Effects</b>: Returns true if x and y are unequal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const flat_multimap& x, const flat_multimap& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator!=(const flat_multimap& x, const flat_multimap& y)
{ return !(x == y); }
//! <b>Effects</b>: Returns true if x is less than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator<(const flat_multimap& x, const flat_multimap& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator<(const flat_multimap& x, const flat_multimap& y)
{ return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
//! <b>Effects</b>: Returns true if x is greater than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator>(const flat_multimap& x, const flat_multimap& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator>(const flat_multimap& x, const flat_multimap& y)
{ return y < x; }
//! <b>Effects</b>: Returns true if x is equal or less than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const flat_multimap& x, const flat_multimap& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator<=(const flat_multimap& x, const flat_multimap& y)
{ return !(y < x); }
//! <b>Effects</b>: Returns true if x is equal or greater than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const flat_multimap& x, const flat_multimap& y)
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE
+ friend bool operator>=(const flat_multimap& x, const flat_multimap& y)
{ return !(x < y); }
//! <b>Effects</b>: x.swap(y)
//!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE friend void swap(flat_multimap& x, flat_multimap& y)
+ BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); }
};