forked from boostorg/container
Modify flat associative containers to be adaptors if the allocator argument is a container. This allows using stable_vector, small_vector, static_vector as underlying containers.
This commit is contained in:
@@ -48,45 +48,51 @@ namespace boost {
|
||||
namespace container {
|
||||
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
template <class Key, class T, class Compare, class Allocator>
|
||||
class flat_multimap;
|
||||
template <class Key, class Compare, class AllocatorOrContainer>
|
||||
class flat_multiset;
|
||||
#endif
|
||||
|
||||
//! flat_set is a Sorted Associative Container that stores objects of type Key.
|
||||
//! It is also a Unique Associative Container, meaning that no two elements are the same.
|
||||
//!
|
||||
//! flat_set is similar to std::set but it's implemented like an ordered vector.
|
||||
//! This means that inserting a new element into a flat_set invalidates
|
||||
//! previous iterators and references
|
||||
//! flat_set is similar to std::set but it's implemented by as an ordered sequence container.
|
||||
//! The underlying sequence container is by default <i>vector</i> but it can also work
|
||||
//! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>).
|
||||
//!
|
||||
//! Erasing an element of a flat_set invalidates iterators and references
|
||||
//! pointing to elements that come after (their keys are bigger) the erased element.
|
||||
//! Using vector-like sequence containers means that inserting a new element into a flat_set might invalidate
|
||||
//! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar
|
||||
//! container that offers stable pointers and references). Similarly, erasing an element might invalidate
|
||||
//! iterators and references pointing to elements that come after (their keys are bigger) the erased element.
|
||||
//!
|
||||
//! This container provides random-access iterators.
|
||||
//!
|
||||
//! \tparam Key is the type to be inserted in the set, which is also the key_type
|
||||
//! \tparam Compare is the comparison functor used to order keys
|
||||
//! \tparam Allocator is the allocator to be used to allocate memory for this container
|
||||
//! \tparam AllocatorOrContainer is either:
|
||||
//! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>).
|
||||
//! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>)
|
||||
//! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like
|
||||
//! sequence container with random-access iterators.
|
||||
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
template <class Key, class Compare = std::less<Key>, class Allocator = new_allocator<Key> >
|
||||
template <class Key, class Compare = std::less<Key>, class AllocatorOrContainer = new_allocator<Key> >
|
||||
#else
|
||||
template <class Key, class Compare, class Allocator>
|
||||
template <class Key, class Compare, class AllocatorOrContainer>
|
||||
#endif
|
||||
class flat_set
|
||||
///@cond
|
||||
: public container_detail::flat_tree<Key, container_detail::identity<Key>, Compare, Allocator>
|
||||
: public container_detail::flat_tree<Key, container_detail::identity<Key>, Compare, AllocatorOrContainer>
|
||||
///@endcond
|
||||
{
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
BOOST_COPYABLE_AND_MOVABLE(flat_set)
|
||||
typedef container_detail::flat_tree<Key, container_detail::identity<Key>, Compare, Allocator> base_t;
|
||||
typedef container_detail::flat_tree<Key, container_detail::identity<Key>, Compare, AllocatorOrContainer> tree_t;
|
||||
|
||||
public:
|
||||
base_t &tree()
|
||||
tree_t &tree()
|
||||
{ return *this; }
|
||||
|
||||
const base_t &tree() const
|
||||
const tree_t &tree() const
|
||||
{ return *this; }
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
@@ -97,24 +103,25 @@ class flat_set
|
||||
// types
|
||||
//
|
||||
//////////////////////////////////////////////
|
||||
typedef Key key_type;
|
||||
typedef Key value_type;
|
||||
typedef Compare key_compare;
|
||||
typedef Compare value_compare;
|
||||
typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
|
||||
typedef Allocator allocator_type;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::sequence_type) sequence_type;
|
||||
typedef Key key_type;
|
||||
typedef Compare key_compare;
|
||||
typedef Key value_type;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(tree_t::sequence_type) sequence_type;
|
||||
typedef typename sequence_type::allocator_type allocator_type;
|
||||
typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type;
|
||||
typedef typename sequence_type::pointer pointer;
|
||||
typedef typename sequence_type::const_pointer const_pointer;
|
||||
typedef typename sequence_type::reference reference;
|
||||
typedef typename sequence_type::const_reference const_reference;
|
||||
typedef typename sequence_type::size_type size_type;
|
||||
typedef typename sequence_type::difference_type difference_type;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type) stored_allocator_type;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(tree_t::value_compare) value_compare;
|
||||
|
||||
typedef typename sequence_type::iterator iterator;
|
||||
typedef typename sequence_type::const_iterator const_iterator;
|
||||
typedef typename sequence_type::reverse_iterator reverse_iterator;
|
||||
typedef typename sequence_type::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////
|
||||
@@ -127,9 +134,9 @@ class flat_set
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
flat_set() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
|
||||
flat_set() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<AllocatorOrContainer>::value &&
|
||||
container_detail::is_nothrow_default_constructible<Compare>::value)
|
||||
: base_t()
|
||||
: tree_t()
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified
|
||||
@@ -138,7 +145,7 @@ class flat_set
|
||||
//! <b>Complexity</b>: Constant.
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
explicit flat_set(const Compare& comp)
|
||||
: base_t(comp)
|
||||
: tree_t(comp)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified allocator.
|
||||
@@ -146,7 +153,7 @@ class flat_set
|
||||
//! <b>Complexity</b>: Constant.
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
explicit flat_set(const allocator_type& a)
|
||||
: base_t(a)
|
||||
: tree_t(a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified
|
||||
@@ -155,7 +162,7 @@ class flat_set
|
||||
//! <b>Complexity</b>: Constant.
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
flat_set(const Compare& comp, const allocator_type& a)
|
||||
: base_t(comp, a)
|
||||
: tree_t(comp, a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container and
|
||||
@@ -166,7 +173,7 @@ class flat_set
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
flat_set(InputIterator first, InputIterator last)
|
||||
: base_t(true, first, last)
|
||||
: tree_t(true, first, last)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified
|
||||
@@ -177,7 +184,7 @@ class flat_set
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
flat_set(InputIterator first, InputIterator last, const allocator_type& a)
|
||||
: base_t(true, first, last, a)
|
||||
: tree_t(true, first, last, a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -188,7 +195,7 @@ class flat_set
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
flat_set(InputIterator first, InputIterator last, const Compare& comp)
|
||||
: base_t(true, first, last, comp)
|
||||
: tree_t(true, first, last, comp)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -199,7 +206,7 @@ class flat_set
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
flat_set(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
|
||||
: base_t(true, first, last, comp, a)
|
||||
: tree_t(true, first, last, comp, a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container and
|
||||
@@ -215,7 +222,7 @@ class flat_set
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
flat_set(ordered_unique_range_t, InputIterator first, InputIterator last)
|
||||
: base_t(ordered_unique_range, first, last)
|
||||
: tree_t(ordered_unique_range, first, last)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -231,7 +238,7 @@ class flat_set
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp)
|
||||
: base_t(ordered_unique_range, first, last, comp)
|
||||
: tree_t(ordered_unique_range, first, last, comp)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -247,7 +254,7 @@ class flat_set
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
|
||||
: base_t(ordered_unique_range, first, last, comp, a)
|
||||
: tree_t(ordered_unique_range, first, last, comp, a)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@@ -257,7 +264,7 @@ class flat_set
|
||||
//! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
|
||||
//! comp and otherwise N logN, where N is il.begin() - il.end().
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il)
|
||||
: base_t(true, il.begin(), il.end())
|
||||
: tree_t(true, il.begin(), il.end())
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified
|
||||
@@ -266,7 +273,7 @@ class flat_set
|
||||
//! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
|
||||
//! comp and otherwise N logN, where N is il.begin() - il.end().
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const allocator_type& a)
|
||||
: base_t(true, il.begin(), il.end(), a)
|
||||
: tree_t(true, il.begin(), il.end(), a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -275,7 +282,7 @@ class flat_set
|
||||
//! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
|
||||
//! comp and otherwise N logN, where N is il.begin() - il.end().
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const Compare& comp)
|
||||
: base_t(true, il.begin(), il.end(), comp)
|
||||
: tree_t(true, il.begin(), il.end(), comp)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -284,7 +291,7 @@ class flat_set
|
||||
//! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
|
||||
//! comp and otherwise N logN, where N is il.begin() - il.end().
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
|
||||
: base_t(true, il.begin(), il.end(), comp, a)
|
||||
: tree_t(true, il.begin(), il.end(), comp, a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -298,7 +305,7 @@ class flat_set
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il)
|
||||
: base_t(ordered_unique_range, il.begin(), il.end())
|
||||
: tree_t(ordered_unique_range, il.begin(), il.end())
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -312,7 +319,7 @@ class flat_set
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp)
|
||||
: base_t(ordered_unique_range, il.begin(), il.end(), comp)
|
||||
: tree_t(ordered_unique_range, il.begin(), il.end(), comp)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -326,7 +333,7 @@ class flat_set
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
|
||||
: base_t(ordered_unique_range, il.begin(), il.end(), comp, a)
|
||||
: tree_t(ordered_unique_range, il.begin(), il.end(), comp, a)
|
||||
{}
|
||||
#endif
|
||||
|
||||
@@ -334,7 +341,7 @@ class flat_set
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear in x.size().
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(const flat_set& x)
|
||||
: base_t(static_cast<const base_t&>(x))
|
||||
: tree_t(static_cast<const tree_t&>(x))
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Move constructs thecontainer. Constructs *this using x's resources.
|
||||
@@ -344,14 +351,14 @@ class flat_set
|
||||
//! <b>Postcondition</b>: x is emptied.
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x)
|
||||
BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
|
||||
: base_t(BOOST_MOVE_BASE(base_t, x))
|
||||
: tree_t(BOOST_MOVE_BASE(tree_t, x))
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Copy constructs a container using the specified allocator.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear in x.size().
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(const flat_set& x, const allocator_type &a)
|
||||
: base_t(static_cast<const base_t&>(x), a)
|
||||
: tree_t(static_cast<const tree_t&>(x), a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Move constructs a container using the specified allocator.
|
||||
@@ -359,14 +366,14 @@ class flat_set
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x, const allocator_type &a)
|
||||
: base_t(BOOST_MOVE_BASE(base_t, x), a)
|
||||
: tree_t(BOOST_MOVE_BASE(tree_t, x), a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Makes *this a copy of x.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear in x.size().
|
||||
BOOST_CONTAINER_FORCEINLINE flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
|
||||
{ return static_cast<flat_set&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
|
||||
{ return static_cast<flat_set&>(this->tree_t::operator=(static_cast<const tree_t&>(x))); }
|
||||
|
||||
//! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment
|
||||
//! is false and (allocation throws or value_type's move constructor throws)
|
||||
@@ -378,7 +385,7 @@ class flat_set
|
||||
BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
|
||||
allocator_traits_type::is_always_equal::value) &&
|
||||
boost::container::container_detail::is_nothrow_move_assignable<Compare>::value)
|
||||
{ return static_cast<flat_set&>(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); }
|
||||
{ return static_cast<flat_set&>(this->tree_t::operator=(BOOST_MOVE_BASE(tree_t, x))); }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
//! <b>Effects</b>: Copy all elements from il to *this.
|
||||
@@ -579,7 +586,7 @@ class flat_set
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
template <class... Args>
|
||||
BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... args)
|
||||
{ return this->base_t::emplace_unique(boost::forward<Args>(args)...); }
|
||||
{ return this->tree_t::emplace_unique(boost::forward<Args>(args)...); }
|
||||
|
||||
//! <b>Effects</b>: Inserts an object of type Key constructed with
|
||||
//! std::forward<Args>(args)... in the container if and only if there is
|
||||
@@ -595,18 +602,18 @@ class flat_set
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
template <class... Args>
|
||||
BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
|
||||
{ return this->base_t::emplace_hint_unique(p, boost::forward<Args>(args)...); }
|
||||
{ return this->tree_t::emplace_hint_unique(p, boost::forward<Args>(args)...); }
|
||||
|
||||
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
#define BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE(N) \
|
||||
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
|
||||
BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##N)\
|
||||
{ return this->base_t::emplace_unique(BOOST_MOVE_FWD##N); }\
|
||||
{ return this->tree_t::emplace_unique(BOOST_MOVE_FWD##N); }\
|
||||
\
|
||||
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
|
||||
BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||
{ return this->base_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
|
||||
{ return this->tree_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
|
||||
//
|
||||
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE)
|
||||
#undef BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE
|
||||
@@ -685,7 +692,7 @@ class flat_set
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
|
||||
{ this->base_t::insert_unique(first, last); }
|
||||
{ this->tree_t::insert_unique(first, last); }
|
||||
|
||||
//! <b>Requires</b>: first, last are not iterators into *this and
|
||||
//! must be ordered according to the predicate and must be
|
||||
@@ -700,7 +707,7 @@ class flat_set
|
||||
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
|
||||
{ this->base_t::insert_unique(ordered_unique_range, first, last); }
|
||||
{ this->tree_t::insert_unique(ordered_unique_range, first, last); }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
//! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only
|
||||
@@ -711,7 +718,7 @@ class flat_set
|
||||
//!
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
|
||||
{ this->base_t::insert_unique(il.begin(), il.end()); }
|
||||
{ this->tree_t::insert_unique(il.begin(), il.end()); }
|
||||
|
||||
//! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate
|
||||
//! and must be unique values.
|
||||
@@ -724,28 +731,28 @@ class flat_set
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
|
||||
BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, std::initializer_list<value_type> il)
|
||||
{ this->base_t::insert_unique(ordered_unique_range, il.begin(), il.end()); }
|
||||
{ this->tree_t::insert_unique(ordered_unique_range, il.begin(), il.end()); }
|
||||
#endif
|
||||
|
||||
//! @copydoc ::boost::container::flat_map::merge(flat_map<Key, T, C2, Allocator>&)
|
||||
//! @copydoc ::boost::container::flat_map::merge(flat_map<Key, T, C2, AllocatorOrContainer>&)
|
||||
template<class C2>
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, Allocator>& source)
|
||||
{ this->base_t::merge_unique(source.tree()); }
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, AllocatorOrContainer>& source)
|
||||
{ this->tree_t::merge_unique(source.tree()); }
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::merge(flat_set<Key, C2, Allocator>&)
|
||||
//! @copydoc ::boost::container::flat_set::merge(flat_set<Key, C2, AllocatorOrContainer>&)
|
||||
template<class C2>
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set<Key, C2, Allocator> BOOST_RV_REF_END source)
|
||||
{ return this->merge(static_cast<flat_set<Key, C2, Allocator>&>(source)); }
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source)
|
||||
{ return this->merge(static_cast<flat_set<Key, C2, AllocatorOrContainer>&>(source)); }
|
||||
|
||||
//! @copydoc ::boost::container::flat_map::merge(flat_multimap<Key, T, C2, Allocator>&)
|
||||
//! @copydoc ::boost::container::flat_map::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&)
|
||||
template<class C2>
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, Allocator>& source)
|
||||
{ this->base_t::merge_unique(source.tree()); }
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, AllocatorOrContainer>& source)
|
||||
{ this->tree_t::merge_unique(source.tree()); }
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::merge(flat_multiset<Key, C2, Allocator>&)
|
||||
//! @copydoc ::boost::container::flat_set::merge(flat_multiset<Key, C2, AllocatorOrContainer>&)
|
||||
template<class C2>
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset<Key, C2, Allocator> BOOST_RV_REF_END source)
|
||||
{ return this->merge(static_cast<flat_multiset<Key, C2, Allocator>&>(source)); }
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source)
|
||||
{ return this->merge(static_cast<flat_multiset<Key, C2, AllocatorOrContainer>&>(source)); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
@@ -875,7 +882,7 @@ class flat_set
|
||||
//!
|
||||
//! <b>Complexity</b>: log(size())+count(k)
|
||||
BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const
|
||||
{ return static_cast<size_type>(this->base_t::find(x) != this->base_t::cend()); }
|
||||
{ return static_cast<size_type>(this->tree_t::find(x) != this->tree_t::cend()); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
//! <b>Returns</b>: An iterator pointing to the first element with key not less
|
||||
@@ -908,13 +915,13 @@ class flat_set
|
||||
//!
|
||||
//! <b>Complexity</b>: Logarithmic
|
||||
BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const
|
||||
{ return this->base_t::lower_bound_range(x); }
|
||||
{ return this->tree_t::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<iterator,iterator> equal_range(const key_type& x)
|
||||
{ return this->base_t::lower_bound_range(x); }
|
||||
{ return this->tree_t::lower_bound_range(x); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
@@ -971,7 +978,7 @@ class flat_set
|
||||
//!
|
||||
//! <b>Throws</b>: If the comparison or the move constructor throws
|
||||
BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq)
|
||||
{ this->base_t::adopt_sequence_unique(boost::move(seq)); }
|
||||
{ this->tree_t::adopt_sequence_unique(boost::move(seq)); }
|
||||
|
||||
//! <b>Requires</b>: seq shall be ordered according to this->compare()
|
||||
//! and shall contain unique elements.
|
||||
@@ -983,17 +990,17 @@ class flat_set
|
||||
//!
|
||||
//! <b>Throws</b>: If the move assignment throws
|
||||
BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_unique_range_t, BOOST_RV_REF(sequence_type) seq)
|
||||
{ this->base_t::adopt_sequence_unique(ordered_unique_range_t(), boost::move(seq)); }
|
||||
{ this->tree_t::adopt_sequence_unique(ordered_unique_range_t(), boost::move(seq)); }
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
template<class KeyType>
|
||||
BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> priv_insert(BOOST_FWD_REF(KeyType) x)
|
||||
{ return this->base_t::insert_unique(::boost::forward<KeyType>(x)); }
|
||||
{ return this->tree_t::insert_unique(::boost::forward<KeyType>(x)); }
|
||||
|
||||
template<class KeyType>
|
||||
BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
|
||||
{ return this->base_t::insert_unique(p, ::boost::forward<KeyType>(x)); }
|
||||
{ return this->tree_t::insert_unique(p, ::boost::forward<KeyType>(x)); }
|
||||
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
};
|
||||
|
||||
@@ -1003,11 +1010,11 @@ class flat_set
|
||||
|
||||
//!has_trivial_destructor_after_move<> == true_type
|
||||
//!specialization for optimizations
|
||||
template <class Key, class Compare, class Allocator>
|
||||
struct has_trivial_destructor_after_move<boost::container::flat_set<Key, Compare, Allocator> >
|
||||
template <class Key, class Compare, class AllocatorOrContainer>
|
||||
struct has_trivial_destructor_after_move<boost::container::flat_set<Key, Compare, AllocatorOrContainer> >
|
||||
{
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
|
||||
static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
|
||||
typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer;
|
||||
static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value &&
|
||||
::boost::has_trivial_destructor_after_move<pointer>::value &&
|
||||
::boost::has_trivial_destructor_after_move<Compare>::value;
|
||||
};
|
||||
@@ -1016,42 +1023,47 @@ namespace container {
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
|
||||
//! flat_multiset is a Sorted Associative Container that stores objects of type Key.
|
||||
//! flat_multiset is a Sorted Associative Container that stores objects of type Key and
|
||||
//! can store multiple copies of the same key value.
|
||||
//!
|
||||
//! flat_multiset can store multiple copies of the same key value.
|
||||
//! flat_multiset is similar to std::multiset but it's implemented by as an ordered sequence container.
|
||||
//! The underlying sequence container is by default <i>vector</i> but it can also work
|
||||
//! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>).
|
||||
//!
|
||||
//! flat_multiset is similar to std::multiset but it's implemented like an ordered vector.
|
||||
//! This means that inserting a new element into a flat_multiset invalidates
|
||||
//! previous iterators and references
|
||||
//!
|
||||
//! Erasing an element invalidates iterators and references
|
||||
//! pointing to elements that come after (their keys are bigger) the erased element.
|
||||
//! Using vector-like sequence containers means that inserting a new element into a flat_multiset might invalidate
|
||||
//! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar
|
||||
//! container that offers stable pointers and references). Similarly, erasing an element might invalidate
|
||||
//! iterators and references pointing to elements that come after (their keys are bigger) the erased element.
|
||||
//!
|
||||
//! This container provides random-access iterators.
|
||||
//!
|
||||
//! \tparam Key is the type to be inserted in the multiset, which is also the key_type
|
||||
//! \tparam Compare is the comparison functor used to order keys
|
||||
//! \tparam Allocator is the allocator to be used to allocate memory for this container
|
||||
//! \tparam AllocatorOrContainer is either:
|
||||
//! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>).
|
||||
//! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>)
|
||||
//! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like
|
||||
//! sequence container with random-access iterators.
|
||||
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
template <class Key, class Compare = std::less<Key>, class Allocator = new_allocator<Key> >
|
||||
template <class Key, class Compare = std::less<Key>, class AllocatorOrContainer = new_allocator<Key> >
|
||||
#else
|
||||
template <class Key, class Compare, class Allocator>
|
||||
template <class Key, class Compare, class AllocatorOrContainer>
|
||||
#endif
|
||||
class flat_multiset
|
||||
///@cond
|
||||
: public container_detail::flat_tree<Key, container_detail::identity<Key>, Compare, Allocator>
|
||||
: public container_detail::flat_tree<Key, container_detail::identity<Key>, Compare, AllocatorOrContainer>
|
||||
///@endcond
|
||||
{
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
|
||||
typedef container_detail::flat_tree<Key, container_detail::identity<Key>, Compare, Allocator> base_t;
|
||||
typedef container_detail::flat_tree<Key, container_detail::identity<Key>, Compare, AllocatorOrContainer> tree_t;
|
||||
|
||||
public:
|
||||
base_t &tree()
|
||||
tree_t &tree()
|
||||
{ return *this; }
|
||||
|
||||
const base_t &tree() const
|
||||
const tree_t &tree() const
|
||||
{ return *this; }
|
||||
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
|
||||
@@ -1061,68 +1073,69 @@ class flat_multiset
|
||||
// types
|
||||
//
|
||||
//////////////////////////////////////////////
|
||||
typedef Key key_type;
|
||||
typedef Key value_type;
|
||||
typedef Compare key_compare;
|
||||
typedef Compare value_compare;
|
||||
typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
|
||||
typedef Allocator allocator_type;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(base_t::sequence_type) sequence_type;
|
||||
typedef Key key_type;
|
||||
typedef Compare key_compare;
|
||||
typedef Key value_type;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(tree_t::sequence_type) sequence_type;
|
||||
typedef typename sequence_type::allocator_type allocator_type;
|
||||
typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type;
|
||||
typedef typename sequence_type::pointer pointer;
|
||||
typedef typename sequence_type::const_pointer const_pointer;
|
||||
typedef typename sequence_type::reference reference;
|
||||
typedef typename sequence_type::const_reference const_reference;
|
||||
typedef typename sequence_type::size_type size_type;
|
||||
typedef typename sequence_type::difference_type difference_type;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type) stored_allocator_type;
|
||||
typedef typename BOOST_CONTAINER_IMPDEF(tree_t::value_compare) value_compare;
|
||||
|
||||
typedef typename sequence_type::iterator iterator;
|
||||
typedef typename sequence_type::const_iterator const_iterator;
|
||||
typedef typename sequence_type::reverse_iterator reverse_iterator;
|
||||
typedef typename sequence_type::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set()
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<AllocatorOrContainer>::value &&
|
||||
container_detail::is_nothrow_default_constructible<Compare>::value)
|
||||
: base_t()
|
||||
: tree_t()
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(const Compare&)
|
||||
BOOST_CONTAINER_FORCEINLINE explicit flat_multiset(const Compare& comp)
|
||||
: base_t(comp)
|
||||
: tree_t(comp)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(const allocator_type&)
|
||||
BOOST_CONTAINER_FORCEINLINE explicit flat_multiset(const allocator_type& a)
|
||||
: base_t(a)
|
||||
: tree_t(a)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(const Compare&, const allocator_type&)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(const Compare& comp, const allocator_type& a)
|
||||
: base_t(comp, a)
|
||||
: tree_t(comp, a)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator)
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last)
|
||||
: base_t(false, first, last)
|
||||
: tree_t(false, first, last)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const allocator_type&)
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const allocator_type& a)
|
||||
: base_t(false, first, last, a)
|
||||
: tree_t(false, first, last, a)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp)
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const Compare& comp)
|
||||
: base_t(false, first, last, comp)
|
||||
: tree_t(false, first, last, comp)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp, const allocator_type&)
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
|
||||
: base_t(false, first, last, comp, a)
|
||||
: tree_t(false, first, last, comp, a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty flat_multiset and
|
||||
@@ -1136,7 +1149,7 @@ class flat_multiset
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last)
|
||||
: base_t(ordered_range, first, last)
|
||||
: tree_t(ordered_range, first, last)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and
|
||||
@@ -1150,7 +1163,7 @@ class flat_multiset
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp)
|
||||
: base_t(ordered_range, first, last, comp)
|
||||
: tree_t(ordered_range, first, last, comp)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and
|
||||
@@ -1164,28 +1177,28 @@ class flat_multiset
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
|
||||
: base_t(ordered_range, first, last, comp, a)
|
||||
: tree_t(ordered_range, first, last, comp, a)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il)
|
||||
: base_t(false, il.begin(), il.end())
|
||||
: tree_t(false, il.begin(), il.end())
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const allocator_type&)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const allocator_type& a)
|
||||
: base_t(false, il.begin(), il.end(), a)
|
||||
: tree_t(false, il.begin(), il.end(), a)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const Compare& comp)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const Compare& comp)
|
||||
: base_t(false, il.begin(), il.end(), comp)
|
||||
: tree_t(false, il.begin(), il.end(), comp)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const Compare& comp, const allocator_type&)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
|
||||
: base_t(false, il.begin(), il.end(), comp, a)
|
||||
: tree_t(false, il.begin(), il.end(), comp, a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty containerand
|
||||
@@ -1198,7 +1211,7 @@ class flat_multiset
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il)
|
||||
: base_t(ordered_range, il.begin(), il.end())
|
||||
: tree_t(ordered_range, il.begin(), il.end())
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -1211,7 +1224,7 @@ class flat_multiset
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp)
|
||||
: base_t(ordered_range, il.begin(), il.end(), comp)
|
||||
: tree_t(ordered_range, il.begin(), il.end(), comp)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
@@ -1224,41 +1237,41 @@ class flat_multiset
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
|
||||
: base_t(ordered_range, il.begin(), il.end(), comp, a)
|
||||
: tree_t(ordered_range, il.begin(), il.end(), comp, a)
|
||||
{}
|
||||
#endif
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(const flat_set &)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(const flat_multiset& x)
|
||||
: base_t(static_cast<const base_t&>(x))
|
||||
: tree_t(static_cast<const tree_t&>(x))
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(flat_set &&)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x)
|
||||
BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
|
||||
: base_t(boost::move(static_cast<base_t&>(x)))
|
||||
: tree_t(boost::move(static_cast<tree_t&>(x)))
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(const flat_set &, const allocator_type &)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(const flat_multiset& x, const allocator_type &a)
|
||||
: base_t(static_cast<const base_t&>(x), a)
|
||||
: tree_t(static_cast<const tree_t&>(x), a)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(flat_set &&, const allocator_type &)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x, const allocator_type &a)
|
||||
: base_t(BOOST_MOVE_BASE(base_t, x), a)
|
||||
: tree_t(BOOST_MOVE_BASE(tree_t, x), a)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::operator=(const flat_set &)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x)
|
||||
{ return static_cast<flat_multiset&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
|
||||
{ return static_cast<flat_multiset&>(this->tree_t::operator=(static_cast<const tree_t&>(x))); }
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::operator=(flat_set &&)
|
||||
BOOST_CONTAINER_FORCEINLINE flat_multiset& operator=(BOOST_RV_REF(flat_multiset) x)
|
||||
BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
|
||||
allocator_traits_type::is_always_equal::value) &&
|
||||
boost::container::container_detail::is_nothrow_move_assignable<Compare>::value)
|
||||
{ return static_cast<flat_multiset&>(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); }
|
||||
{ return static_cast<flat_multiset&>(this->tree_t::operator=(BOOST_MOVE_BASE(tree_t, x))); }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
//! @copydoc ::boost::container::flat_set::operator=(std::initializer_list<value_type>)
|
||||
@@ -1355,7 +1368,7 @@ class flat_multiset
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
template <class... Args>
|
||||
BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_FWD_REF(Args)... args)
|
||||
{ return this->base_t::emplace_equal(boost::forward<Args>(args)...); }
|
||||
{ return this->tree_t::emplace_equal(boost::forward<Args>(args)...); }
|
||||
|
||||
//! <b>Effects</b>: Inserts an object of type Key constructed with
|
||||
//! std::forward<Args>(args)... in the container.
|
||||
@@ -1370,18 +1383,18 @@ class flat_multiset
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
template <class... Args>
|
||||
BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
|
||||
{ return this->base_t::emplace_hint_equal(p, boost::forward<Args>(args)...); }
|
||||
{ return this->tree_t::emplace_hint_equal(p, boost::forward<Args>(args)...); }
|
||||
|
||||
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
#define BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE(N) \
|
||||
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
|
||||
BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\
|
||||
{ return this->base_t::emplace_equal(BOOST_MOVE_FWD##N); }\
|
||||
{ return this->tree_t::emplace_equal(BOOST_MOVE_FWD##N); }\
|
||||
\
|
||||
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
|
||||
BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||
{ return this->base_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
|
||||
{ return this->tree_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
|
||||
//
|
||||
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE)
|
||||
#undef BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE
|
||||
@@ -1448,7 +1461,7 @@ class flat_multiset
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
|
||||
{ this->base_t::insert_equal(first, last); }
|
||||
{ this->tree_t::insert_equal(first, last); }
|
||||
|
||||
//! <b>Requires</b>: first, last are not iterators into *this and
|
||||
//! must be ordered according to the predicate.
|
||||
@@ -1462,7 +1475,7 @@ class flat_multiset
|
||||
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
|
||||
template <class InputIterator>
|
||||
BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, InputIterator first, InputIterator last)
|
||||
{ this->base_t::insert_equal(ordered_range, first, last); }
|
||||
{ this->tree_t::insert_equal(ordered_range, first, last); }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
//! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()).
|
||||
@@ -1472,7 +1485,7 @@ class flat_multiset
|
||||
//!
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
|
||||
{ this->base_t::insert_equal(il.begin(), il.end()); }
|
||||
{ this->tree_t::insert_equal(il.begin(), il.end()); }
|
||||
|
||||
//! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate.
|
||||
//!
|
||||
@@ -1484,28 +1497,28 @@ class flat_multiset
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
|
||||
BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, std::initializer_list<value_type> il)
|
||||
{ this->base_t::insert_equal(ordered_range, il.begin(), il.end()); }
|
||||
{ this->tree_t::insert_equal(ordered_range, il.begin(), il.end()); }
|
||||
#endif
|
||||
|
||||
//! @copydoc ::boost::container::flat_multimap::merge(flat_multimap<Key, T, C2, Allocator>&)
|
||||
//! @copydoc ::boost::container::flat_multimap::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&)
|
||||
template<class C2>
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, Allocator>& source)
|
||||
{ this->base_t::merge_equal(source.tree()); }
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, AllocatorOrContainer>& source)
|
||||
{ this->tree_t::merge_equal(source.tree()); }
|
||||
|
||||
//! @copydoc ::boost::container::flat_multiset::merge(flat_multiset<Key, C2, Allocator>&)
|
||||
//! @copydoc ::boost::container::flat_multiset::merge(flat_multiset<Key, C2, AllocatorOrContainer>&)
|
||||
template<class C2>
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset<Key, C2, Allocator> BOOST_RV_REF_END source)
|
||||
{ return this->merge(static_cast<flat_multiset<Key, C2, Allocator>&>(source)); }
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source)
|
||||
{ return this->merge(static_cast<flat_multiset<Key, C2, AllocatorOrContainer>&>(source)); }
|
||||
|
||||
//! @copydoc ::boost::container::flat_multimap::merge(flat_map<Key, T, C2, Allocator>&)
|
||||
//! @copydoc ::boost::container::flat_multimap::merge(flat_map<Key, T, C2, AllocatorOrContainer>&)
|
||||
template<class C2>
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, Allocator>& source)
|
||||
{ this->base_t::merge_equal(source.tree()); }
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, AllocatorOrContainer>& source)
|
||||
{ this->tree_t::merge_equal(source.tree()); }
|
||||
|
||||
//! @copydoc ::boost::container::flat_multiset::merge(flat_set<Key, C2, Allocator>&)
|
||||
//! @copydoc ::boost::container::flat_multiset::merge(flat_set<Key, C2, AllocatorOrContainer>&)
|
||||
template<class C2>
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set<Key, C2, Allocator> BOOST_RV_REF_END source)
|
||||
{ return this->merge(static_cast<flat_set<Key, C2, Allocator>&>(source)); }
|
||||
BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source)
|
||||
{ return this->merge(static_cast<flat_set<Key, C2, AllocatorOrContainer>&>(source)); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
@@ -1624,7 +1637,7 @@ class flat_multiset
|
||||
//!
|
||||
//! <b>Throws</b>: If the comparison or the move constructor throws
|
||||
BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq)
|
||||
{ this->base_t::adopt_sequence_equal(boost::move(seq)); }
|
||||
{ this->tree_t::adopt_sequence_equal(boost::move(seq)); }
|
||||
|
||||
//! <b>Requires</b>: seq shall be ordered according to this->compare()
|
||||
//!
|
||||
@@ -1635,17 +1648,17 @@ class flat_multiset
|
||||
//!
|
||||
//! <b>Throws</b>: If the move assignment throws
|
||||
BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_range_t, BOOST_RV_REF(sequence_type) seq)
|
||||
{ this->base_t::adopt_sequence_equal(ordered_range_t(), boost::move(seq)); }
|
||||
{ this->tree_t::adopt_sequence_equal(ordered_range_t(), boost::move(seq)); }
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
template <class KeyType>
|
||||
BOOST_CONTAINER_FORCEINLINE iterator priv_insert(BOOST_FWD_REF(KeyType) x)
|
||||
{ return this->base_t::insert_equal(::boost::forward<KeyType>(x)); }
|
||||
{ return this->tree_t::insert_equal(::boost::forward<KeyType>(x)); }
|
||||
|
||||
template <class KeyType>
|
||||
BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
|
||||
{ return this->base_t::insert_equal(p, ::boost::forward<KeyType>(x)); }
|
||||
{ return this->tree_t::insert_equal(p, ::boost::forward<KeyType>(x)); }
|
||||
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
};
|
||||
|
||||
@@ -1655,11 +1668,11 @@ class flat_multiset
|
||||
|
||||
//!has_trivial_destructor_after_move<> == true_type
|
||||
//!specialization for optimizations
|
||||
template <class Key, class Compare, class Allocator>
|
||||
struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, Compare, Allocator> >
|
||||
template <class Key, class Compare, class AllocatorOrContainer>
|
||||
struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, Compare, AllocatorOrContainer> >
|
||||
{
|
||||
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
|
||||
static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
|
||||
typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer;
|
||||
static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value &&
|
||||
::boost::has_trivial_destructor_after_move<pointer>::value &&
|
||||
::boost::has_trivial_destructor_after_move<Compare>::value;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user