Merge branch 'joker-eph-remove_useless_allocator_copy_in_map' into develop

This commit is contained in:
Ion Gaztañaga
2017-05-16 16:30:31 +02:00
14 changed files with 1722 additions and 807 deletions

View File

@ -132,6 +132,18 @@ class flat_tree
: value_compare(), m_seq() : value_compare(), m_seq()
{} {}
explicit Data(const allocator_t &alloc)
: value_compare(), m_seq(alloc)
{}
explicit Data(const Compare &comp)
: value_compare(comp), m_seq()
{}
Data(const Compare &comp, const allocator_t &alloc)
: value_compare(comp), m_seq(alloc)
{}
explicit Data(const Data &d) explicit Data(const Data &d)
: value_compare(static_cast<const value_compare&>(d)), m_seq(d.m_seq) : value_compare(static_cast<const value_compare&>(d)), m_seq(d.m_seq)
{} {}
@ -148,18 +160,6 @@ class flat_tree
: value_compare(boost::move(static_cast<value_compare&>(d))), m_seq(boost::move(d.m_seq), a) : value_compare(boost::move(static_cast<value_compare&>(d))), m_seq(boost::move(d.m_seq), a)
{} {}
explicit Data(const Compare &comp)
: value_compare(comp), m_seq()
{}
Data(const Compare &comp, const allocator_t &alloc)
: value_compare(comp), m_seq(alloc)
{}
explicit Data(const allocator_t &alloc)
: value_compare(), m_seq(alloc)
{}
Data& operator=(BOOST_COPY_ASSIGN_REF(Data) d) Data& operator=(BOOST_COPY_ASSIGN_REF(Data) d)
{ {
this->value_compare::operator=(d); this->value_compare::operator=(d);
@ -219,14 +219,14 @@ class flat_tree
: m_data(comp) : m_data(comp)
{ } { }
BOOST_CONTAINER_FORCEINLINE flat_tree(const Compare& comp, const allocator_type& a)
: m_data(comp, a)
{ }
BOOST_CONTAINER_FORCEINLINE explicit flat_tree(const allocator_type& a) BOOST_CONTAINER_FORCEINLINE explicit flat_tree(const allocator_type& a)
: m_data(a) : m_data(a)
{ } { }
BOOST_CONTAINER_FORCEINLINE flat_tree(const Compare& comp, const allocator_type& a)
: m_data(comp, a)
{ }
BOOST_CONTAINER_FORCEINLINE flat_tree(const flat_tree& x) BOOST_CONTAINER_FORCEINLINE flat_tree(const flat_tree& x)
: m_data(x.m_data) : m_data(x.m_data)
{ } { }
@ -245,9 +245,26 @@ class flat_tree
{ } { }
template <class InputIterator> template <class InputIterator>
flat_tree( ordered_range_t, InputIterator first, InputIterator last BOOST_CONTAINER_FORCEINLINE
, const Compare& comp = Compare() flat_tree( ordered_range_t, InputIterator first, InputIterator last)
, const allocator_type& a = allocator_type()) : m_data()
{
this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last);
BOOST_ASSERT((is_sorted)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp()));
}
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_tree( ordered_range_t, InputIterator first, InputIterator last, const Compare& comp)
: m_data(comp)
{
this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last);
BOOST_ASSERT((is_sorted)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp()));
}
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_tree( ordered_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
: m_data(comp, a) : m_data(comp, a)
{ {
this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last); this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last);
@ -255,9 +272,26 @@ class flat_tree
} }
template <class InputIterator> template <class InputIterator>
flat_tree( ordered_unique_range_t, InputIterator first, InputIterator last BOOST_CONTAINER_FORCEINLINE
, const Compare& comp = Compare() flat_tree( ordered_unique_range_t, InputIterator first, InputIterator last)
, const allocator_type& a = allocator_type()) : m_data()
{
this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last);
BOOST_ASSERT((is_sorted_and_unique)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp()));
}
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_tree( ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp)
: m_data(comp)
{
this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last);
BOOST_ASSERT((is_sorted_and_unique)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp()));
}
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_tree( ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
: m_data(comp, a) : m_data(comp, a)
{ {
this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last); this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last);
@ -265,26 +299,38 @@ class flat_tree
} }
template <class InputIterator> template <class InputIterator>
flat_tree( bool unique_insertion BOOST_CONTAINER_FORCEINLINE
, InputIterator first, InputIterator last flat_tree( bool unique_insertion, InputIterator first, InputIterator last)
, const Compare& comp = Compare() : m_data()
, const allocator_type& a = allocator_type()) {
this->priv_range_insertion_construct(unique_insertion, first, last);
}
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_tree( bool unique_insertion, InputIterator first, InputIterator last
, const Compare& comp)
: m_data(comp)
{
this->priv_range_insertion_construct(unique_insertion, first, last);
}
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_tree( bool unique_insertion, InputIterator first, InputIterator last
, const allocator_type& a)
: m_data(a)
{
this->priv_range_insertion_construct(unique_insertion, first, last);
}
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_tree( bool unique_insertion, InputIterator first, InputIterator last
, const Compare& comp, const allocator_type& a)
: m_data(comp, a) : m_data(comp, a)
{ {
//Use cend() as hint to achieve linear time for this->priv_range_insertion_construct(unique_insertion, first, last);
//ordered ranges as required by the standard
//for the constructor
//Call end() every iteration as reallocation might have invalidated iterators
if(unique_insertion){
for ( ; first != last; ++first){
this->insert_unique(this->cend(), *first);
}
}
else{
for ( ; first != last; ++first){
this->insert_equal(this->cend(), *first);
}
}
} }
BOOST_CONTAINER_FORCEINLINE ~flat_tree() BOOST_CONTAINER_FORCEINLINE ~flat_tree()
@ -923,6 +969,25 @@ class flat_tree
private: private:
template <class InputIterator>
void priv_range_insertion_construct( bool unique_insertion, InputIterator first, InputIterator last)
{
//Use cend() as hint to achieve linear time for
//ordered ranges as required by the standard
//for the constructor
//Call end() every iteration as reallocation might have invalidated iterators
if(unique_insertion){
for ( ; first != last; ++first){
this->insert_unique(this->cend(), *first);
}
}
else{
for ( ; first != last; ++first){
this->insert_equal(this->cend(), *first);
}
}
}
BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const
{ {
return (this->begin() <= pos) && (pos <= this->end()); return (this->begin() <= pos) && (pos <= this->end());

View File

@ -106,23 +106,23 @@ struct node_alloc_holder
: members_(a) : members_(a)
{} {}
//Constructors for associative containers
node_alloc_holder(const value_compare &c, const ValAlloc &a)
: members_(a, c)
{}
explicit node_alloc_holder(const node_alloc_holder &x) explicit node_alloc_holder(const node_alloc_holder &x)
: members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc())) : members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()))
{} {}
node_alloc_holder(const node_alloc_holder &x, const value_compare &c)
: members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()), c)
{}
explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x) explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x)
: members_(boost::move(x.node_alloc())) : members_(boost::move(x.node_alloc()))
{ this->icont().swap(x.icont()); } { this->icont().swap(x.icont()); }
//Constructors for associative containers
explicit node_alloc_holder(const value_compare &c, const ValAlloc &a)
: members_(a, c)
{}
explicit node_alloc_holder(const value_compare &c, const node_alloc_holder &x)
: members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()), c)
{}
explicit node_alloc_holder(const value_compare &c) explicit node_alloc_holder(const value_compare &c)
: members_(c) : members_(c)
{} {}

View File

@ -509,7 +509,11 @@ class tree
: AllocHolder() : AllocHolder()
{} {}
BOOST_CONTAINER_FORCEINLINE explicit tree(const key_compare& comp, const allocator_type& a = allocator_type()) BOOST_CONTAINER_FORCEINLINE explicit tree(const key_compare& comp)
: AllocHolder(ValComp(comp))
{}
BOOST_CONTAINER_FORCEINLINE explicit tree(const key_compare& comp, const allocator_type& a)
: AllocHolder(ValComp(comp), a) : AllocHolder(ValComp(comp), a)
{} {}
@ -518,85 +522,110 @@ class tree
{} {}
template <class InputIterator> template <class InputIterator>
tree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp, tree(bool unique_insertion, InputIterator first, InputIterator last)
const allocator_type& a : AllocHolder(value_compare(key_compare()))
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) {
, typename container_detail::enable_if_or this->tree_construct(unique_insertion, first, last);
< void //AllocHolder clears in case of exception
, container_detail::is_same<alloc_version, version_1> }
, container_detail::is_input_iterator<InputIterator>
>::type * = 0 template <class InputIterator>
#endif tree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp)
) : AllocHolder(value_compare(comp))
{
this->tree_construct(unique_insertion, first, last);
//AllocHolder clears in case of exception
}
template <class InputIterator>
tree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp, const allocator_type& a)
: AllocHolder(value_compare(comp), a) : AllocHolder(value_compare(comp), a)
{
this->tree_construct(unique_insertion, first, last);
//AllocHolder clears in case of exception
}
//construct with ordered range
template <class InputIterator>
tree( ordered_range_t, InputIterator first, InputIterator last)
: AllocHolder(value_compare(key_compare()))
{
this->tree_construct(ordered_range_t(), first, last);
}
template <class InputIterator>
tree( ordered_range_t, InputIterator first, InputIterator last, const key_compare& comp)
: AllocHolder(value_compare(comp))
{
this->tree_construct(ordered_range_t(), first, last);
}
template <class InputIterator>
tree( ordered_range_t, InputIterator first, InputIterator last
, const key_compare& comp, const allocator_type& a)
: AllocHolder(value_compare(comp), a)
{
this->tree_construct(ordered_range_t(), first, last);
}
private:
template <class InputIterator>
void tree_construct(bool unique_insertion, InputIterator first, InputIterator last)
{ {
//Use cend() as hint to achieve linear time for //Use cend() as hint to achieve linear time for
//ordered ranges as required by the standard //ordered ranges as required by the standard
//for the constructor //for the constructor
const const_iterator end_it(this->cend());
if(unique_insertion){ if(unique_insertion){
for ( ; first != last; ++first){
this->insert_unique_convertible(end_it, *first);
}
}
else{
for ( ; first != last; ++first){
this->insert_equal_convertible(end_it, *first);
}
}
}
template <class InputIterator>
tree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp,
const allocator_type& a
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename container_detail::disable_if_or
< void
, container_detail::is_same<alloc_version, version_1>
, container_detail::is_input_iterator<InputIterator>
>::type * = 0
#endif
)
: AllocHolder(value_compare(comp), a)
{
if(unique_insertion){
//Use cend() as hint to achieve linear time for
//ordered ranges as required by the standard
//for the constructor
const const_iterator end_it(this->cend()); const const_iterator end_it(this->cend());
for ( ; first != last; ++first){ for ( ; first != last; ++first){
this->insert_unique_convertible(end_it, *first); this->insert_unique_convertible(end_it, *first);
} }
} }
else{ else{
//Optimized allocation and construction this->tree_construct_non_unique(first, last);
this->allocate_many_and_construct
( first, boost::container::iterator_distance(first, last)
, insert_equal_end_hint_functor<Node, Icont>(this->icont()));
} }
} }
template <class InputIterator> template <class InputIterator>
tree( ordered_range_t, InputIterator first, InputIterator last void tree_construct_non_unique(InputIterator first, InputIterator last
, const key_compare& comp = key_compare(), const allocator_type& a = allocator_type() #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename container_detail::enable_if_or , typename container_detail::enable_if_or
< void < void
, container_detail::is_same<alloc_version, version_1> , container_detail::is_same<alloc_version, version_1>
, container_detail::is_input_iterator<InputIterator> , container_detail::is_input_iterator<InputIterator>
>::type * = 0 >::type * = 0
#endif #endif
) )
: AllocHolder(value_compare(comp), a)
{ {
//Use cend() as hint to achieve linear time for
//ordered ranges as required by the standard
//for the constructor
const const_iterator end_it(this->cend());
for ( ; first != last; ++first){ for ( ; first != last; ++first){
this->push_back_impl(*first); this->insert_equal_convertible(end_it, *first);
} }
} }
template <class InputIterator> template <class InputIterator>
tree( ordered_range_t, InputIterator first, InputIterator last void tree_construct_non_unique(InputIterator first, InputIterator last
, const key_compare& comp = key_compare(), const allocator_type& a = allocator_type() #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename container_detail::disable_if_or
< void
, container_detail::is_same<alloc_version, version_1>
, container_detail::is_input_iterator<InputIterator>
>::type * = 0
#endif
)
{
//Optimized allocation and construction
this->allocate_many_and_construct
( first, boost::container::iterator_distance(first, last)
, insert_equal_end_hint_functor<Node, Icont>(this->icont()));
}
template <class InputIterator>
void tree_construct( ordered_range_t, InputIterator first, InputIterator last
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename container_detail::disable_if_or , typename container_detail::disable_if_or
< void < void
@ -605,16 +634,34 @@ class tree
>::type * = 0 >::type * = 0
#endif #endif
) )
: AllocHolder(value_compare(comp), a)
{ {
//Optimized allocation and construction //Optimized allocation and construction
this->allocate_many_and_construct this->allocate_many_and_construct
( first, boost::container::iterator_distance(first, last) ( first, boost::container::iterator_distance(first, last)
, container_detail::push_back_functor<Node, Icont>(this->icont())); , container_detail::push_back_functor<Node, Icont>(this->icont()));
//AllocHolder clears in case of exception
} }
template <class InputIterator>
void tree_construct( ordered_range_t, InputIterator first, InputIterator last
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename container_detail::enable_if_or
< void
, container_detail::is_same<alloc_version, version_1>
, container_detail::is_input_iterator<InputIterator>
>::type * = 0
#endif
)
{
for ( ; first != last; ++first){
this->push_back_impl(*first);
}
}
public:
BOOST_CONTAINER_FORCEINLINE tree(const tree& x) BOOST_CONTAINER_FORCEINLINE tree(const tree& x)
: AllocHolder(x.value_comp(), x) : AllocHolder(x, x.value_comp())
{ {
this->icont().clone_from this->icont().clone_from
(x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc())); (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
@ -630,6 +677,7 @@ class tree
{ {
this->icont().clone_from this->icont().clone_from
(x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc())); (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
//AllocHolder clears in case of exception
} }
tree(BOOST_RV_REF(tree) x, const allocator_type &a) tree(BOOST_RV_REF(tree) x, const allocator_type &a)
@ -642,6 +690,7 @@ class tree
this->icont().clone_from this->icont().clone_from
(boost::move(x.icont()), typename AllocHolder::move_cloner(*this), Destroyer(this->node_alloc())); (boost::move(x.icont()), typename AllocHolder::move_cloner(*this), Destroyer(this->node_alloc()));
} }
//AllocHolder clears in case of exception
} }
BOOST_CONTAINER_FORCEINLINE ~tree() BOOST_CONTAINER_FORCEINLINE ~tree()

File diff suppressed because it is too large Load Diff

View File

@ -126,47 +126,112 @@ class flat_set
//! <b>Effects</b>: Default constructs an empty container. //! <b>Effects</b>: Default constructs an empty container.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE
explicit flat_set() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value && explicit flat_set() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
container_detail::is_nothrow_default_constructible<Compare>::value) container_detail::is_nothrow_default_constructible<Compare>::value)
: base_t() : base_t()
{} {}
//! <b>Effects</b>: Constructs an empty container using the specified //! <b>Effects</b>: Constructs an empty container using the specified
//! comparison object and allocator. //! comparison object.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
explicit flat_set(const Compare& comp, BOOST_CONTAINER_FORCEINLINE
const allocator_type& a = allocator_type()) explicit flat_set(const Compare& comp)
: base_t(comp, a) : base_t(comp)
{} {}
//! <b>Effects</b>: Constructs an empty container using the specified allocator. //! <b>Effects</b>: Constructs an empty container using the specified allocator.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE
explicit flat_set(const allocator_type& a) explicit flat_set(const allocator_type& a)
: base_t(a) : base_t(a)
{} {}
//! <b>Effects</b>: Constructs an empty container using the specified
//! comparison object and allocator.
//!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE
flat_set(const Compare& comp, const allocator_type& a)
: base_t(comp, a)
{}
//! <b>Effects</b>: Constructs an empty container and
//! inserts elements from the range [first ,last ).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_set(InputIterator first, InputIterator last)
: base_t(true, first, last)
{}
//! <b>Effects</b>: Constructs an empty container using the specified
//! allocator, and inserts elements from the range [first ,last ).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_set(InputIterator first, InputIterator last, const allocator_type& a)
: base_t(true, first, last, a)
{}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
//! inserts elements from the range [first ,last ).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_set(InputIterator first, InputIterator last, const Compare& comp)
: base_t(true, first, last, comp)
{}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
//! allocator, and inserts elements from the range [first ,last ). //! allocator, and inserts elements from the range [first ,last ).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first. //! comp and otherwise N logN, where N is last - first.
template <class InputIterator> template <class InputIterator>
flat_set(InputIterator first, InputIterator last, BOOST_CONTAINER_FORCEINLINE
const Compare& comp = Compare(), flat_set(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
const allocator_type& a = allocator_type())
: base_t(true, first, last, comp, a) : base_t(true, first, last, comp, a)
{} {}
//! <b>Effects</b>: Constructs an empty container using the specified //! <b>Effects</b>: Constructs an empty container and
//! allocator, and inserts elements from the range [first ,last ). //! inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! comp and otherwise N logN, where N is last - first. //! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator> template <class InputIterator>
flat_set(InputIterator first, InputIterator last, const allocator_type& a) BOOST_CONTAINER_FORCEINLINE
: base_t(true, first, last, Compare(), a) flat_set(ordered_unique_range_t, InputIterator first, InputIterator last)
: base_t(ordered_unique_range, first, last)
{}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
//! inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
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)
{} {}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
@ -180,21 +245,19 @@ class flat_set
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
template <class InputIterator> template <class InputIterator>
flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, BOOST_CONTAINER_FORCEINLINE
const Compare& comp = Compare(), flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
const allocator_type& a = allocator_type())
: base_t(ordered_unique_range, first, last, comp, a) : base_t(ordered_unique_range, first, last, comp, a)
{} {}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and //! <b>Effects</b>: Constructs an empty container and
//! allocator, and inserts elements from the range [il.begin(), il.end()). //! inserts elements from the range [il.begin(), il.end()).
//! //!
//! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using //! <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(). //! comp and otherwise N logN, where N is il.begin() - il.end().
flat_set(std::initializer_list<value_type> il, const Compare& comp = Compare(), BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il)
const allocator_type& a = allocator_type()) : base_t(true, il.begin(), il.end())
: base_t(true, il.begin(), il.end(), comp, a)
{} {}
//! <b>Effects</b>: Constructs an empty container using the specified //! <b>Effects</b>: Constructs an empty container using the specified
@ -202,8 +265,54 @@ class flat_set
//! //!
//! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using //! <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(). //! comp and otherwise N logN, where N is il.begin() - il.end().
flat_set(std::initializer_list<value_type> il, const allocator_type& a) BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const allocator_type& a)
: base_t(true, il.begin(), il.end(), Compare(), a) : base_t(true, il.begin(), il.end(), a)
{}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
//! inserts elements from the range [il.begin(), il.end()).
//!
//! <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)
{}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
//! allocator, and inserts elements from the range [il.begin(), il.end()).
//!
//! <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)
{}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
//! inserts elements from the ordered unique range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <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())
{}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
//! inserts elements from the ordered unique range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <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)
{} {}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
@ -216,8 +325,7 @@ class flat_set
//! <b>Complexity</b>: Linear in N. //! <b>Complexity</b>: Linear in N.
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
flat_set(ordered_unique_range_t, std::initializer_list<value_type> il, BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
const Compare& comp = Compare(), const allocator_type& a = allocator_type())
: base_t(ordered_unique_range, il.begin(), il.end(), comp, a) : base_t(ordered_unique_range, il.begin(), il.end(), comp, a)
{} {}
#endif #endif
@ -225,7 +333,7 @@ class flat_set
//! <b>Effects</b>: Copy constructs the container. //! <b>Effects</b>: Copy constructs the container.
//! //!
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
flat_set(const flat_set& x) BOOST_CONTAINER_FORCEINLINE flat_set(const flat_set& x)
: base_t(static_cast<const base_t&>(x)) : base_t(static_cast<const base_t&>(x))
{} {}
@ -234,7 +342,7 @@ class flat_set
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
//! //!
//! <b>Postcondition</b>: x is emptied. //! <b>Postcondition</b>: x is emptied.
flat_set(BOOST_RV_REF(flat_set) x) BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x)
BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value) BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
: base_t(BOOST_MOVE_BASE(base_t, x)) : base_t(BOOST_MOVE_BASE(base_t, x))
{} {}
@ -242,7 +350,7 @@ class flat_set
//! <b>Effects</b>: Copy constructs a container using the specified allocator. //! <b>Effects</b>: Copy constructs a container using the specified allocator.
//! //!
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
flat_set(const flat_set& x, const allocator_type &a) BOOST_CONTAINER_FORCEINLINE flat_set(const flat_set& x, const allocator_type &a)
: base_t(static_cast<const base_t&>(x), a) : base_t(static_cast<const base_t&>(x), a)
{} {}
@ -250,14 +358,14 @@ class flat_set
//! Constructs *this using x's resources. //! Constructs *this using x's resources.
//! //!
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise
flat_set(BOOST_RV_REF(flat_set) x, const allocator_type &a) BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x, const allocator_type &a)
: base_t(BOOST_MOVE_BASE(base_t, x), a) : base_t(BOOST_MOVE_BASE(base_t, x), a)
{} {}
//! <b>Effects</b>: Makes *this a copy of x. //! <b>Effects</b>: Makes *this a copy of x.
//! //!
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x) 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->base_t::operator=(static_cast<const base_t&>(x))); }
//! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment
@ -266,7 +374,7 @@ class flat_set
//! <b>Complexity</b>: Constant if allocator_traits_type:: //! <b>Complexity</b>: Constant if allocator_traits_type::
//! propagate_on_container_move_assignment is true or //! propagate_on_container_move_assignment is true or
//! this->get>allocator() == x.get_allocator(). Linear otherwise. //! this->get>allocator() == x.get_allocator(). Linear otherwise.
flat_set& operator=(BOOST_RV_REF(flat_set) x) BOOST_CONTAINER_FORCEINLINE flat_set& operator=(BOOST_RV_REF(flat_set) x)
BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
allocator_traits_type::is_always_equal::value) && allocator_traits_type::is_always_equal::value) &&
boost::container::container_detail::is_nothrow_move_assignable<Compare>::value) boost::container::container_detail::is_nothrow_move_assignable<Compare>::value)
@ -470,7 +578,7 @@ class flat_set
//! //!
//! <b>Note</b>: If an element is inserted it might invalidate elements. //! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args> template <class... Args>
std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... 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->base_t::emplace_unique(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type Key constructed with //! <b>Effects</b>: Inserts an object of type Key constructed with
@ -486,18 +594,18 @@ class flat_set
//! //!
//! <b>Note</b>: If an element is inserted it might invalidate elements. //! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args> template <class... Args>
iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... 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->base_t::emplace_hint_unique(p, boost::forward<Args>(args)...); }
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE(N) \ #define BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##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->base_t::emplace_unique(BOOST_MOVE_FWD##N); }\
\ \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##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->base_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
// //
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE) BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE)
@ -576,7 +684,7 @@ class flat_set
//! //!
//! <b>Note</b>: If an element is inserted it might invalidate elements. //! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class InputIterator> template <class InputIterator>
void insert(InputIterator first, InputIterator last) BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
{ this->base_t::insert_unique(first, last); } { this->base_t::insert_unique(first, last); }
//! <b>Requires</b>: first, last are not iterators into *this and //! <b>Requires</b>: first, last are not iterators into *this and
@ -591,7 +699,7 @@ class flat_set
//! //!
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
template <class InputIterator> template <class InputIterator>
void insert(ordered_unique_range_t, InputIterator first, InputIterator last) BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
{ this->base_t::insert_unique(ordered_unique_range, first, last); } { this->base_t::insert_unique(ordered_unique_range, first, last); }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
@ -602,7 +710,7 @@ class flat_set
//! search time plus N*size() insertion time. //! search time plus N*size() insertion time.
//! //!
//! <b>Note</b>: If an element is inserted it might invalidate elements. //! <b>Note</b>: If an element is inserted it might invalidate elements.
void insert(std::initializer_list<value_type> il) BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
{ this->base_t::insert_unique(il.begin(), il.end()); } { this->base_t::insert_unique(il.begin(), il.end()); }
//! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate //! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate
@ -615,7 +723,7 @@ class flat_set
//! search time plus N*size() insertion time. //! search time plus N*size() insertion time.
//! //!
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
void insert(ordered_unique_range_t, std::initializer_list<value_type> il) 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->base_t::insert_unique(ordered_unique_range, il.begin(), il.end()); }
#endif #endif
@ -766,7 +874,7 @@ class flat_set
//! <b>Returns</b>: The number of elements with key equivalent to x. //! <b>Returns</b>: The number of elements with key equivalent to x.
//! //!
//! <b>Complexity</b>: log(size())+count(k) //! <b>Complexity</b>: log(size())+count(k)
size_type count(const key_type& x) const 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->base_t::find(x) != this->base_t::cend()); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@ -799,13 +907,13 @@ class flat_set
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//! //!
//! <b>Complexity</b>: Logarithmic //! <b>Complexity</b>: Logarithmic
std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const 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->base_t::lower_bound_range(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//! //!
//! <b>Complexity</b>: Logarithmic //! <b>Complexity</b>: Logarithmic
std::pair<iterator,iterator> equal_range(const key_type& x) BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const key_type& x)
{ return this->base_t::lower_bound_range(x); } { return this->base_t::lower_bound_range(x); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@ -862,7 +970,7 @@ class flat_set
//! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size() //! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size()
//! //!
//! <b>Throws</b>: If the comparison or the move constructor throws //! <b>Throws</b>: If the comparison or the move constructor throws
void adopt_sequence(BOOST_RV_REF(sequence_type) seq) BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq)
{ this->base_t::adopt_sequence_unique(boost::move(seq)); } { this->base_t::adopt_sequence_unique(boost::move(seq)); }
//! <b>Requires</b>: seq shall be ordered according to this->compare() //! <b>Requires</b>: seq shall be ordered according to this->compare()
@ -874,17 +982,17 @@ class flat_set
//! <b>Complexity</b>: Assuming O(1) move assignment, O(1) //! <b>Complexity</b>: Assuming O(1) move assignment, O(1)
//! //!
//! <b>Throws</b>: If the move assignment throws //! <b>Throws</b>: If the move assignment throws
void adopt_sequence(ordered_unique_range_t, BOOST_RV_REF(sequence_type) seq) 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->base_t::adopt_sequence_unique(ordered_unique_range_t(), boost::move(seq)); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
template<class KeyType> template<class KeyType>
std::pair<iterator, bool> priv_insert(BOOST_FWD_REF(KeyType) x) 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->base_t::insert_unique(::boost::forward<KeyType>(x)); }
template<class KeyType> template<class KeyType>
iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) 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->base_t::insert_unique(p, ::boost::forward<KeyType>(x)); }
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
@ -973,38 +1081,52 @@ class flat_multiset
typedef typename BOOST_CONTAINER_IMPDEF(base_t::sequence_type) sequence_type; typedef typename BOOST_CONTAINER_IMPDEF(base_t::sequence_type) sequence_type;
//! @copydoc ::boost::container::flat_set::flat_set() //! @copydoc ::boost::container::flat_set::flat_set()
explicit flat_multiset() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value && BOOST_CONTAINER_FORCEINLINE explicit flat_multiset() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
container_detail::is_nothrow_default_constructible<Compare>::value) container_detail::is_nothrow_default_constructible<Compare>::value)
: base_t() : base_t()
{} {}
//! @copydoc ::boost::container::flat_set::flat_set(const Compare&, const allocator_type&) //! @copydoc ::boost::container::flat_set::flat_set(const Compare&)
explicit flat_multiset(const Compare& comp, BOOST_CONTAINER_FORCEINLINE explicit flat_multiset(const Compare& comp)
const allocator_type& a = allocator_type()) : base_t(comp)
: base_t(comp, a)
{} {}
//! @copydoc ::boost::container::flat_set::flat_set(const allocator_type&) //! @copydoc ::boost::container::flat_set::flat_set(const allocator_type&)
explicit flat_multiset(const allocator_type& a) BOOST_CONTAINER_FORCEINLINE explicit flat_multiset(const allocator_type& a)
: base_t(a) : base_t(a)
{} {}
//! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp, const allocator_type&) //! @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)
{}
//! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator)
template <class InputIterator> template <class InputIterator>
flat_multiset(InputIterator first, InputIterator last, BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last)
const Compare& comp = Compare(), : base_t(false, first, last)
const allocator_type& a = allocator_type())
: base_t(false, first, last, comp, a)
{} {}
//! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const allocator_type&) //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const allocator_type&)
template <class InputIterator> template <class InputIterator>
flat_multiset(InputIterator first, InputIterator last, const allocator_type& a) BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const allocator_type& a)
: base_t(false, first, last, Compare(), a) : base_t(false, first, last, a)
{} {}
//! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp)
//! allocator, and inserts elements from the ordered range [first ,last ). This function template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const Compare& comp)
: base_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)
{}
//! <b>Effects</b>: Constructs an empty flat_multiset and
//! inserts elements from the ordered range [first ,last ). This function
//! is more efficient than the normal range creation for ordered ranges. //! is more efficient than the normal range creation for ordered ranges.
//! //!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate. //! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
@ -1013,22 +1135,83 @@ class flat_multiset
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
template <class InputIterator> template <class InputIterator>
flat_multiset(ordered_range_t, InputIterator first, InputIterator last, BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last)
const Compare& comp = Compare(), : base_t(ordered_range, first, last)
const allocator_type& a = allocator_type()) {}
//! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and
//! inserts elements from the ordered range [first ,last ). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <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)
{}
//! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and
//! allocator, and inserts elements from the ordered range [first, last ). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <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) : base_t(ordered_range, first, last, comp, a)
{} {}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const Compare& comp, const allocator_type&) //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type)
flat_multiset(std::initializer_list<value_type> il, const Compare& comp = Compare(), BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il)
const allocator_type& a = allocator_type()) : base_t(false, il.begin(), il.end())
: base_t(false, il.begin(), il.end(), comp, a)
{} {}
//! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const allocator_type&) //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const allocator_type&)
flat_multiset(std::initializer_list<value_type> il, const allocator_type& a) BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const allocator_type& a)
: base_t(false, il.begin(), il.end(), Compare(), a) : base_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)
{}
//! @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)
{}
//! <b>Effects</b>: Constructs an empty containerand
//! inserts elements from the ordered unique range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <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())
{}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
//! inserts elements from the ordered unique range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <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)
{} {}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
@ -1040,39 +1223,38 @@ class flat_multiset
//! <b>Complexity</b>: Linear in N. //! <b>Complexity</b>: Linear in N.
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
flat_multiset(ordered_range_t, std::initializer_list<value_type> il, BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
const Compare& comp = Compare(), const allocator_type& a = allocator_type())
: base_t(ordered_range, il.begin(), il.end(), comp, a) : base_t(ordered_range, il.begin(), il.end(), comp, a)
{} {}
#endif #endif
//! @copydoc ::boost::container::flat_set::flat_set(const flat_set &) //! @copydoc ::boost::container::flat_set::flat_set(const flat_set &)
flat_multiset(const flat_multiset& x) BOOST_CONTAINER_FORCEINLINE flat_multiset(const flat_multiset& x)
: base_t(static_cast<const base_t&>(x)) : base_t(static_cast<const base_t&>(x))
{} {}
//! @copydoc ::boost::container::flat_set::flat_set(flat_set &&) //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&)
flat_multiset(BOOST_RV_REF(flat_multiset) x) BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x)
BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value) BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
: base_t(boost::move(static_cast<base_t&>(x))) : base_t(boost::move(static_cast<base_t&>(x)))
{} {}
//! @copydoc ::boost::container::flat_set::flat_set(const flat_set &, const allocator_type &) //! @copydoc ::boost::container::flat_set::flat_set(const flat_set &, const allocator_type &)
flat_multiset(const flat_multiset& x, const allocator_type &a) BOOST_CONTAINER_FORCEINLINE flat_multiset(const flat_multiset& x, const allocator_type &a)
: base_t(static_cast<const base_t&>(x), a) : base_t(static_cast<const base_t&>(x), a)
{} {}
//! @copydoc ::boost::container::flat_set::flat_set(flat_set &&, const allocator_type &) //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&, const allocator_type &)
flat_multiset(BOOST_RV_REF(flat_multiset) x, const allocator_type &a) BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x, const allocator_type &a)
: base_t(BOOST_MOVE_BASE(base_t, x), a) : base_t(BOOST_MOVE_BASE(base_t, x), a)
{} {}
//! @copydoc ::boost::container::flat_set::operator=(const flat_set &) //! @copydoc ::boost::container::flat_set::operator=(const flat_set &)
flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x) 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->base_t::operator=(static_cast<const base_t&>(x))); }
//! @copydoc ::boost::container::flat_set::operator=(flat_set &&) //! @copydoc ::boost::container::flat_set::operator=(flat_set &&)
flat_multiset& operator=(BOOST_RV_REF(flat_multiset) x) BOOST_CONTAINER_FORCEINLINE flat_multiset& operator=(BOOST_RV_REF(flat_multiset) x)
BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
allocator_traits_type::is_always_equal::value) && allocator_traits_type::is_always_equal::value) &&
boost::container::container_detail::is_nothrow_move_assignable<Compare>::value) boost::container::container_detail::is_nothrow_move_assignable<Compare>::value)
@ -1172,7 +1354,7 @@ class flat_multiset
//! //!
//! <b>Note</b>: If an element is inserted it might invalidate elements. //! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args> template <class... Args>
iterator emplace(BOOST_FWD_REF(Args)... args) BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_FWD_REF(Args)... args)
{ return this->base_t::emplace_equal(boost::forward<Args>(args)...); } { return this->base_t::emplace_equal(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type Key constructed with //! <b>Effects</b>: Inserts an object of type Key constructed with
@ -1187,18 +1369,18 @@ class flat_multiset
//! //!
//! <b>Note</b>: If an element is inserted it might invalidate elements. //! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args> template <class... Args>
iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... 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->base_t::emplace_hint_equal(p, boost::forward<Args>(args)...); }
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE(N) \ #define BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
iterator emplace(BOOST_MOVE_UREF##N)\ BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\
{ return this->base_t::emplace_equal(BOOST_MOVE_FWD##N); }\ { return this->base_t::emplace_equal(BOOST_MOVE_FWD##N); }\
\ \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##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->base_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
// //
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE) BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE)
@ -1265,7 +1447,7 @@ class flat_multiset
//! //!
//! <b>Note</b>: If an element is inserted it might invalidate elements. //! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class InputIterator> template <class InputIterator>
void insert(InputIterator first, InputIterator last) BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
{ this->base_t::insert_equal(first, last); } { this->base_t::insert_equal(first, last); }
//! <b>Requires</b>: first, last are not iterators into *this and //! <b>Requires</b>: first, last are not iterators into *this and
@ -1279,7 +1461,7 @@ class flat_multiset
//! //!
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
template <class InputIterator> template <class InputIterator>
void insert(ordered_range_t, InputIterator first, InputIterator last) BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, InputIterator first, InputIterator last)
{ this->base_t::insert_equal(ordered_range, first, last); } { this->base_t::insert_equal(ordered_range, first, last); }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
@ -1289,7 +1471,7 @@ class flat_multiset
//! search time plus N*size() insertion time. //! search time plus N*size() insertion time.
//! //!
//! <b>Note</b>: If an element is inserted it might invalidate elements. //! <b>Note</b>: If an element is inserted it might invalidate elements.
void insert(std::initializer_list<value_type> il) BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
{ this->base_t::insert_equal(il.begin(), il.end()); } { this->base_t::insert_equal(il.begin(), il.end()); }
//! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate. //! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate.
@ -1301,7 +1483,7 @@ class flat_multiset
//! search time plus N*size() insertion time. //! search time plus N*size() insertion time.
//! //!
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
void insert(ordered_range_t, std::initializer_list<value_type> il) 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->base_t::insert_equal(ordered_range, il.begin(), il.end()); }
#endif #endif
@ -1441,7 +1623,7 @@ class flat_multiset
//! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size() //! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size()
//! //!
//! <b>Throws</b>: If the comparison or the move constructor throws //! <b>Throws</b>: If the comparison or the move constructor throws
void adopt_sequence(BOOST_RV_REF(sequence_type) seq) BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq)
{ this->base_t::adopt_sequence_equal(boost::move(seq)); } { this->base_t::adopt_sequence_equal(boost::move(seq)); }
//! <b>Requires</b>: seq shall be ordered according to this->compare() //! <b>Requires</b>: seq shall be ordered according to this->compare()
@ -1452,17 +1634,17 @@ class flat_multiset
//! <b>Complexity</b>: Assuming O(1) move assignment, O(1) //! <b>Complexity</b>: Assuming O(1) move assignment, O(1)
//! //!
//! <b>Throws</b>: If the move assignment throws //! <b>Throws</b>: If the move assignment throws
void adopt_sequence(ordered_range_t, BOOST_RV_REF(sequence_type) seq) 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->base_t::adopt_sequence_equal(ordered_range_t(), boost::move(seq)); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
template <class KeyType> template <class KeyType>
iterator priv_insert(BOOST_FWD_REF(KeyType) x) BOOST_CONTAINER_FORCEINLINE iterator priv_insert(BOOST_FWD_REF(KeyType) x)
{ return this->base_t::insert_equal(::boost::forward<KeyType>(x)); } { return this->base_t::insert_equal(::boost::forward<KeyType>(x)); }
template <class KeyType> template <class KeyType>
iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) 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->base_t::insert_equal(p, ::boost::forward<KeyType>(x)); }
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };

View File

@ -106,7 +106,7 @@ class map
typedef Key key_type; typedef Key key_type;
typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type; typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef T mapped_type; typedef T mapped_type;
typedef std::pair<const Key, T> value_type; typedef typename boost::container::allocator_traits<Allocator>::value_type value_type;
typedef typename boost::container::allocator_traits<Allocator>::pointer pointer; 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>::const_pointer const_pointer;
typedef typename boost::container::allocator_traits<Allocator>::reference reference; typedef typename boost::container::allocator_traits<Allocator>::reference reference;
@ -130,6 +130,9 @@ class map
typedef BOOST_CONTAINER_IMPDEF typedef BOOST_CONTAINER_IMPDEF
(insert_return_type_base<iterator BOOST_MOVE_I node_type>) insert_return_type; (insert_return_type_base<iterator BOOST_MOVE_I node_type>) insert_return_type;
//allocator_type::value_type type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<typename allocator_type::value_type, std::pair<const Key, T> >::value));
////////////////////////////////////////////// //////////////////////////////////////////////
// //
// construct/copy/destroy // construct/copy/destroy
@ -143,62 +146,99 @@ class map
map() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value && map() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
container_detail::is_nothrow_default_constructible<Compare>::value) container_detail::is_nothrow_default_constructible<Compare>::value)
: base_t() : base_t()
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object //! <b>Effects</b>: Constructs an empty map using the specified comparison object
//! and allocator. //! and allocator.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map(const Compare& comp, const allocator_type& a)
explicit map(const Compare& comp, const allocator_type& a = allocator_type())
: base_t(comp, a) : base_t(comp, a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value)); //! <b>Effects</b>: Constructs an empty map using the specified comparison object.
} //!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE explicit map(const Compare& comp)
: base_t(comp)
{}
//! <b>Effects</b>: Constructs an empty map using the specified allocator. //! <b>Effects</b>: Constructs an empty map using the specified allocator.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE explicit map(const allocator_type& a)
explicit map(const allocator_type& a)
: base_t(a) : base_t(a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and //! <b>Effects</b>: Constructs an empty map and
//! allocator, and inserts elements from the range [first ,last ). //! inserts elements from the range [first ,last ).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first. //! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator> template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map(InputIterator first, InputIterator last)
map(InputIterator first, InputIterator last, const Compare& comp = Compare(), : base_t(true, first, last)
const allocator_type& a = allocator_type()) {}
: base_t(true, first, last, comp, a)
{
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty map using the specified //! <b>Effects</b>: Constructs an empty map using the specified
//! allocator, and inserts elements from the range [first ,last ). //! allocator, and inserts elements from the range [first ,last ).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first. //! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator> template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map(InputIterator first, InputIterator last, const allocator_type& a)
map(InputIterator first, InputIterator last, const allocator_type& a)
: base_t(true, first, last, Compare(), a) : base_t(true, first, last, Compare(), a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value)); //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
} //! inserts elements from the range [first ,last ).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE map(InputIterator first, InputIterator last, const Compare& comp)
: base_t(true, first, last, comp)
{}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and
//! allocator, and inserts elements from the range [first ,last ).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE map(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
: base_t(true, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty map and
//! inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE map( ordered_unique_range_t, InputIterator first, InputIterator last)
: base_t(ordered_range, first, last)
{}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and
//! inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE map( ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp)
: base_t(ordered_range, first, last, comp)
{}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
//! allocator, and inserts elements from the ordered unique range [first ,last). This function //! allocator, and inserts elements from the ordered unique range [first ,last). This function
@ -211,43 +251,76 @@ class map
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
template <class InputIterator> template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map( ordered_unique_range_t, InputIterator first, InputIterator last
map( ordered_unique_range_t, InputIterator first, InputIterator last , const Compare& comp, const allocator_type& a)
, const Compare& comp = Compare(), const allocator_type& a = allocator_type())
: base_t(ordered_range, first, last, comp, a) : base_t(ordered_range, first, last, comp, a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs an empty map and
//! inserts elements from the range [il.begin(), il.end()).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted according
//! to the predicate and otherwise N logN, where N is il.first() - il.end().
BOOST_CONTAINER_FORCEINLINE map(std::initializer_list<value_type> il)
: base_t(true, il.begin(), il.end())
{}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
//! allocator, and inserts elements from the range [il.begin(), il.end()). //! inserts elements from the range [il.begin(), il.end()).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is il.first() - il.end(). //! the predicate and otherwise N logN, where N is il.first() - il.end().
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map(std::initializer_list<value_type> il, const Compare& comp)
map(std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : base_t(true, il.begin(), il.end(), comp)
: base_t(true, il.begin(), il.end(), comp, a) {}
{
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty map using the specified //! <b>Effects</b>: Constructs an empty map using the specified
//! allocator, and inserts elements from the range [il.begin(), il.end()). //! allocator, and inserts elements from the range [il.begin(), il.end()).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is il.first() - il.end(). //! the predicate and otherwise N logN, where N is il.first() - il.end().
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map(std::initializer_list<value_type> il, const allocator_type& a)
map(std::initializer_list<value_type> il, const allocator_type& a)
: base_t(true, il.begin(), il.end(), Compare(), a) : base_t(true, il.begin(), il.end(), Compare(), a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
//! allocator, and inserts elements from the range [il.begin(), il.end()).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! the predicate and otherwise N logN, where N is il.first() - il.end().
BOOST_CONTAINER_FORCEINLINE map(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
: base_t(true, il.begin(), il.end(), comp, a)
{}
//! <b>Effects</b>: Constructs an empty map and inserts elements from the ordered unique range [il.begin(), il.end()).
//! This function is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
BOOST_CONTAINER_FORCEINLINE map(ordered_unique_range_t, std::initializer_list<value_type> il)
: base_t(ordered_range, il.begin(), il.end())
{}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object,
//! and inserts elements from the ordered unique range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
BOOST_CONTAINER_FORCEINLINE map(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp)
: base_t(ordered_range, il.begin(), il.end(), comp)
{}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and
//! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges. //! is more efficient than the normal range creation for ordered ranges.
//! //!
@ -257,51 +330,36 @@ class map
//! <b>Complexity</b>: Linear in N. //! <b>Complexity</b>: Linear in N.
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map( ordered_unique_range_t, std::initializer_list<value_type> il
map(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(), , const Compare& comp, const allocator_type& a)
const allocator_type& a = allocator_type())
: base_t(ordered_range, il.begin(), il.end(), comp, a) : base_t(ordered_range, il.begin(), il.end(), comp, a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
#endif #endif
//! <b>Effects</b>: Copy constructs a map. //! <b>Effects</b>: Copy constructs a map.
//! //!
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map(const map& x)
map(const map& x)
: base_t(static_cast<const base_t&>(x)) : base_t(static_cast<const base_t&>(x))
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Move constructs a map. Constructs *this using x's resources. //! <b>Effects</b>: Move constructs a map. Constructs *this using x's resources.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
//! //!
//! <b>Postcondition</b>: x is emptied. //! <b>Postcondition</b>: x is emptied.
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map(BOOST_RV_REF(map) x)
map(BOOST_RV_REF(map) x)
BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value) BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
: base_t(BOOST_MOVE_BASE(base_t, x)) : base_t(BOOST_MOVE_BASE(base_t, x))
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Copy constructs a map using the specified allocator. //! <b>Effects</b>: Copy constructs a map using the specified allocator.
//! //!
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map(const map& x, const allocator_type &a)
map(const map& x, const allocator_type &a)
: base_t(static_cast<const base_t&>(x), a) : base_t(static_cast<const base_t&>(x), a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Move constructs a map using the specified allocator. //! <b>Effects</b>: Move constructs a map using the specified allocator.
//! Constructs *this using x's resources. //! Constructs *this using x's resources.
@ -309,19 +367,14 @@ class map
//! <b>Complexity</b>: Constant if x == x.get_allocator(), linear otherwise. //! <b>Complexity</b>: Constant if x == x.get_allocator(), linear otherwise.
//! //!
//! <b>Postcondition</b>: x is emptied. //! <b>Postcondition</b>: x is emptied.
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map(BOOST_RV_REF(map) x, const allocator_type &a)
map(BOOST_RV_REF(map) x, const allocator_type &a)
: base_t(BOOST_MOVE_BASE(base_t, x), a) : base_t(BOOST_MOVE_BASE(base_t, x), a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Makes *this a copy of x. //! <b>Effects</b>: Makes *this a copy of x.
//! //!
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map& operator=(BOOST_COPY_ASSIGN_REF(map) x)
map& operator=(BOOST_COPY_ASSIGN_REF(map) x)
{ return static_cast<map&>(this->base_t::operator=(static_cast<const base_t&>(x))); } { return static_cast<map&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
//! <b>Effects</b>: this->swap(x.get()). //! <b>Effects</b>: this->swap(x.get()).
@ -332,8 +385,7 @@ class map
//! <b>Complexity</b>: Constant if allocator_traits_type:: //! <b>Complexity</b>: Constant if allocator_traits_type::
//! propagate_on_container_move_assignment is true or //! propagate_on_container_move_assignment is true or
//! this->get>allocator() == x.get_allocator(). Linear otherwise. //! this->get>allocator() == x.get_allocator(). Linear otherwise.
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map& operator=(BOOST_RV_REF(map) x)
map& operator=(BOOST_RV_REF(map) x)
BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
allocator_traits_type::is_always_equal::value) && allocator_traits_type::is_always_equal::value) &&
boost::container::container_detail::is_nothrow_move_assignable<Compare>::value) boost::container::container_detail::is_nothrow_move_assignable<Compare>::value)
@ -342,8 +394,7 @@ class map
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Assign content of il to *this. //! <b>Effects</b>: Assign content of il to *this.
//! //!
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE map& operator=(std::initializer_list<value_type> il)
map& operator=(std::initializer_list<value_type> il)
{ {
this->clear(); this->clear();
insert(il.begin(), il.end()); insert(il.begin(), il.end());
@ -688,7 +739,7 @@ class map
//! //!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p. //! is inserted right before p.
iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x) BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x)
{ return this->try_emplace(p, boost::move(x.first), boost::move(x.second)); } { return this->try_emplace(p, boost::move(x.first), boost::move(x.second)); }
//! <b>Effects</b>: Move constructs a new value from x if and only if there is //! <b>Effects</b>: Move constructs a new value from x if and only if there is
@ -700,7 +751,7 @@ class map
//! //!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p. //! is inserted right before p.
iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x) BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x)
{ return this->try_emplace(p, boost::move(x.first), boost::move(x.second)); } { return this->try_emplace(p, boost::move(x.first), boost::move(x.second)); }
//! <b>Effects</b>: Inserts a copy of x in the container. //! <b>Effects</b>: Inserts a copy of x in the container.
@ -718,7 +769,7 @@ class map
//! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x. //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
//! //!
//! <b>Complexity</b>: Logarithmic. //! <b>Complexity</b>: Logarithmic.
iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
{ return this->base_t::insert_unique(p, boost::move(x)); } { return this->base_t::insert_unique(p, boost::move(x)); }
//! <b>Requires</b>: first, last are not iterators into *this. //! <b>Requires</b>: first, last are not iterators into *this.
@ -1197,7 +1248,7 @@ class multimap
typedef Key key_type; typedef Key key_type;
typedef T mapped_type; typedef T mapped_type;
typedef std::pair<const Key, T> value_type; typedef typename boost::container::allocator_traits<Allocator>::value_type value_type;
typedef typename boost::container::allocator_traits<Allocator>::pointer pointer; 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>::const_pointer const_pointer;
typedef typename boost::container::allocator_traits<Allocator>::reference reference; typedef typename boost::container::allocator_traits<Allocator>::reference reference;
@ -1219,6 +1270,9 @@ class multimap
BOOST_MOVE_I pair_key_mapped_of_value BOOST_MOVE_I pair_key_mapped_of_value
<key_type BOOST_MOVE_I mapped_type> >) node_type; <key_type BOOST_MOVE_I mapped_type> >) node_type;
//allocator_type::value_type type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<typename allocator_type::value_type, std::pair<const Key, T> >::value));
////////////////////////////////////////////// //////////////////////////////////////////////
// //
// construct/copy/destroy // construct/copy/destroy
@ -1228,66 +1282,102 @@ class multimap
//! <b>Effects</b>: Default constructs an empty multimap. //! <b>Effects</b>: Default constructs an empty multimap.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE multimap()
multimap() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value && BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
container_detail::is_nothrow_default_constructible<Compare>::value) container_detail::is_nothrow_default_constructible<Compare>::value)
: base_t() : base_t()
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty multimap using the specified allocator. //! <b>Effects</b>: Constructs an empty multimap using the specified allocator
//!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE
explicit multimap(const Compare& comp, const allocator_type& a = allocator_type())
: base_t(comp, a)
{
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison
//! object and allocator. //! object and allocator.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE explicit multimap(const allocator_type& a)
explicit multimap(const allocator_type& a)
: base_t(a) : base_t(a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object //! <b>Effects</b>: Constructs an empty multimap using the specified comparison.
//! and allocator, and inserts elements from the range [first ,last ). //!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE explicit multimap(const Compare& comp)
: base_t(comp)
{}
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison and allocator.
//!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE multimap(const Compare& comp, const allocator_type& a)
: base_t(comp, a)
{}
//! <b>Effects</b>: Constructs an empty multimap and
//! inserts elements from the range [first ,last ).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first. //! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator> template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last)
multimap(InputIterator first, InputIterator last, : base_t(false, first, last)
const Compare& comp = Compare(), {}
const allocator_type& a = allocator_type())
: base_t(false, first, last, comp, a)
{
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty multimap using the specified //! <b>Effects</b>: Constructs an empty multimap using the specified
//! allocator, and inserts elements from the range [first ,last ). //! allocator, and inserts elements from the range [first ,last ).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first. //! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator> template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last, const allocator_type& a) BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last, const allocator_type& a)
: base_t(false, first, last, Compare(), a) : base_t(false, first, last, Compare(), a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value)); //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
} //! inserts elements from the range [first ,last ).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last, const Compare& comp)
: base_t(false, first, last, comp)
{}
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object
//! and allocator, and inserts elements from the range [first ,last ).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last,
const Compare& comp, const allocator_type& a)
: base_t(false, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty multimap and
//! inserts elements from the ordered range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, InputIterator first, InputIterator last)
: base_t(ordered_range, first, last)
{}
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
//! inserts elements from the ordered range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp)
: base_t(ordered_range, first, last, comp)
{}
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
//! allocator, and inserts elements from the ordered range [first ,last). This function //! allocator, and inserts elements from the ordered range [first ,last). This function
@ -1299,41 +1389,51 @@ class multimap
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
template <class InputIterator> template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp = Compare(), BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp,
const allocator_type& a = allocator_type()) const allocator_type& a)
: base_t(ordered_range, first, last, comp, a) : base_t(ordered_range, first, last, comp, a)
{} {}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and //! <b>Effects</b>: Constructs an empty multimap and
//! allocator, and inserts elements from the range [il.begin(), il.end()). //! and inserts elements from the range [il.begin(), il.end()).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is il.first() - il.end(). //! the predicate and otherwise N logN, where N is il.first() - il.end().
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE multimap(std::initializer_list<value_type> il)
multimap(std::initializer_list<value_type> il, const Compare& comp = Compare(), : base_t(false, il.begin(), il.end())
const allocator_type& a = allocator_type()) {}
: base_t(false, il.begin(), il.end(), comp, a)
{
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty multimap using the specified //! <b>Effects</b>: Constructs an empty multimap using the specified
//! allocator, and inserts elements from the range [il.begin(), il.end()). //! allocator, and inserts elements from the range [il.begin(), il.end()).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is il.first() - il.end(). //! the predicate and otherwise N logN, where N is il.first() - il.end().
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE multimap(std::initializer_list<value_type> il, const allocator_type& a)
multimap(std::initializer_list<value_type> il, const allocator_type& a)
: base_t(false, il.begin(), il.end(), Compare(), a) : base_t(false, il.begin(), il.end(), Compare(), a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
//! allocator, and inserts elements from the ordered range [il.begin(), il.end()). This function //! inserts elements from the range [il.begin(), il.end()).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! the predicate and otherwise N logN, where N is il.first() - il.end().
BOOST_CONTAINER_FORCEINLINE multimap(std::initializer_list<value_type> il, const Compare& comp)
: base_t(false, il.begin(), il.end(), comp)
{}
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
//! allocator, and inserts elements from the range [il.begin(), il.end()).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! the predicate and otherwise N logN, where N is il.first() - il.end().
BOOST_CONTAINER_FORCEINLINE multimap(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
: base_t(false, il.begin(), il.end(), comp, a)
{}
//! <b>Effects</b>: Constructs an empty map and
//! inserts elements from the ordered range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges. //! is more efficient than the normal range creation for ordered ranges.
//! //!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
@ -1341,14 +1441,36 @@ class multimap
//! <b>Complexity</b>: Linear in N. //! <b>Complexity</b>: Linear in N.
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
BOOST_CONTAINER_FORCEINLINE BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, std::initializer_list<value_type> il)
multimap(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(), : base_t(ordered_range, il.begin(), il.end())
const allocator_type& a = allocator_type()) {}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and
//! inserts elements from the ordered range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp)
: base_t(ordered_range, il.begin(), il.end(), comp)
{}
//! <b>Effects</b>: Constructs an empty map and
//! inserts elements from the ordered range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
BOOST_CONTAINER_FORCEINLINE multimap(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) : base_t(ordered_range, il.begin(), il.end(), comp, a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
#endif #endif
//! <b>Effects</b>: Copy constructs a multimap. //! <b>Effects</b>: Copy constructs a multimap.
@ -1356,10 +1478,7 @@ class multimap
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
BOOST_CONTAINER_FORCEINLINE multimap(const multimap& x) BOOST_CONTAINER_FORCEINLINE multimap(const multimap& x)
: base_t(static_cast<const base_t&>(x)) : base_t(static_cast<const base_t&>(x))
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Move constructs a multimap. Constructs *this using x's resources. //! <b>Effects</b>: Move constructs a multimap. Constructs *this using x's resources.
//! //!
@ -1369,20 +1488,14 @@ class multimap
BOOST_CONTAINER_FORCEINLINE multimap(BOOST_RV_REF(multimap) x) BOOST_CONTAINER_FORCEINLINE multimap(BOOST_RV_REF(multimap) x)
BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value) BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
: base_t(BOOST_MOVE_BASE(base_t, x)) : base_t(BOOST_MOVE_BASE(base_t, x))
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Copy constructs a multimap. //! <b>Effects</b>: Copy constructs a multimap.
//! //!
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
BOOST_CONTAINER_FORCEINLINE multimap(const multimap& x, const allocator_type &a) BOOST_CONTAINER_FORCEINLINE multimap(const multimap& x, const allocator_type &a)
: base_t(static_cast<const base_t&>(x), a) : base_t(static_cast<const base_t&>(x), a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Move constructs a multimap using the specified allocator. //! <b>Effects</b>: Move constructs a multimap using the specified allocator.
//! Constructs *this using x's resources. //! Constructs *this using x's resources.
@ -1391,10 +1504,7 @@ class multimap
//! <b>Postcondition</b>: x is emptied. //! <b>Postcondition</b>: x is emptied.
BOOST_CONTAINER_FORCEINLINE multimap(BOOST_RV_REF(multimap) x, const allocator_type &a) BOOST_CONTAINER_FORCEINLINE multimap(BOOST_RV_REF(multimap) x, const allocator_type &a)
: base_t(BOOST_MOVE_BASE(base_t, x), a) : base_t(BOOST_MOVE_BASE(base_t, x), a)
{ {}
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
}
//! <b>Effects</b>: Makes *this a copy of x. //! <b>Effects</b>: Makes *this a copy of x.
//! //!
@ -1678,7 +1788,7 @@ class multimap
//! //!
//! <b>Complexity</b>: N log(a.size() + N) (N has the value source.size()) //! <b>Complexity</b>: N log(a.size() + N) (N has the value source.size())
template<class C2> template<class C2>
void merge(multimap<Key, T, C2, Allocator, Options>& source) BOOST_CONTAINER_FORCEINLINE void merge(multimap<Key, T, C2, Allocator, Options>& source)
{ {
typedef container_detail::tree typedef container_detail::tree
<value_type_impl, select_1st_t, C2, Allocator, Options> base2_t; <value_type_impl, select_1st_t, C2, Allocator, Options> base2_t;
@ -1687,12 +1797,12 @@ class multimap
//! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&) //! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&)
template<class C2> template<class C2>
void merge(BOOST_RV_REF_BEG multimap<Key, T, C2, Allocator, Options> BOOST_RV_REF_END source) BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG multimap<Key, T, C2, Allocator, Options> BOOST_RV_REF_END source)
{ return this->merge(static_cast<multimap<Key, T, C2, Allocator, Options>&>(source)); } { return this->merge(static_cast<multimap<Key, T, C2, Allocator, Options>&>(source)); }
//! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&) //! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&)
template<class C2> template<class C2>
void merge(map<Key, T, C2, Allocator, Options>& source) BOOST_CONTAINER_FORCEINLINE void merge(map<Key, T, C2, Allocator, Options>& source)
{ {
typedef container_detail::tree typedef container_detail::tree
<value_type_impl, select_1st_t, C2, Allocator, Options> base2_t; <value_type_impl, select_1st_t, C2, Allocator, Options> base2_t;
@ -1701,7 +1811,7 @@ class multimap
//! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&) //! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&)
template<class C2> template<class C2>
void merge(BOOST_RV_REF_BEG map<Key, T, C2, Allocator, Options> BOOST_RV_REF_END source) BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG map<Key, T, C2, Allocator, Options> BOOST_RV_REF_END source)
{ return this->merge(static_cast<map<Key, T, C2, Allocator, Options>&>(source)); } { return this->merge(static_cast<map<Key, T, C2, Allocator, Options>&>(source)); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)

View File

@ -112,48 +112,105 @@ class set
//! <b>Effects</b>: Default constructs an empty set. //! <b>Effects</b>: Default constructs an empty set.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
set() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
container_detail::is_nothrow_default_constructible<Compare>::value) BOOST_CONTAINER_FORCEINLINE set()
BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
container_detail::is_nothrow_default_constructible<Compare>::value)
: base_t() : base_t()
{} {}
//! <b>Effects</b>: Constructs an empty set using the specified allocator object.
//!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE explicit set(const allocator_type& a)
: base_t(a)
{}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object.
//!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE explicit set(const Compare& comp)
: base_t(comp)
{}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object //! <b>Effects</b>: Constructs an empty set using the specified comparison object
//! and allocator. //! and allocator.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
explicit set(const Compare& comp, BOOST_CONTAINER_FORCEINLINE set(const Compare& comp, const allocator_type& a)
const allocator_type& a = allocator_type())
: base_t(comp, a) : base_t(comp, a)
{} {}
//! <b>Effects</b>: Constructs an empty set using the specified allocator object. //! <b>Effects</b>: Constructs an empty set using and
//! //! inserts elements from the range [first ,last ).
//! <b>Complexity</b>: Constant.
explicit set(const allocator_type& a)
: base_t(a)
{}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! allocator, and inserts elements from the range [first ,last ).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first. //! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator> template <class InputIterator>
set(InputIterator first, InputIterator last, const Compare& comp = Compare(), BOOST_CONTAINER_FORCEINLINE set(InputIterator first, InputIterator last)
const allocator_type& a = allocator_type()) : base_t(true, first, last)
: base_t(true, first, last, comp, a)
{} {}
//! <b>Effects</b>: Constructs an empty set using the specified //! <b>Effects</b>: Constructs an empty set using the specified
//! allocator, and inserts elements from the range [first ,last ). //! allocator, and inserts elements from the range [first ,last ).
//! //!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first. //! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator> template <class InputIterator>
set(InputIterator first, InputIterator last, const allocator_type& a) BOOST_CONTAINER_FORCEINLINE set(InputIterator first, InputIterator last, const allocator_type& a)
: base_t(true, first, last, key_compare(), a) : base_t(true, first, last, key_compare(), a)
{} {}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! inserts elements from the range [first ,last ).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE set(InputIterator first, InputIterator last, const Compare& comp)
: base_t(true, first, last, comp)
{}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! allocator, and inserts elements from the range [first ,last ).
//!
//! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! the predicate and otherwise N logN, where N is last - first.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE set(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
: base_t(true, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty set and
//! inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE set( ordered_unique_range_t, InputIterator first, InputIterator last)
: base_t(ordered_range, first, last)
{}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE set( ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp )
: base_t(ordered_range, first, last, comp)
{}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! allocator, and inserts elements from the ordered unique range [first ,last). This function //! allocator, and inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges. //! is more efficient than the normal range creation for ordered ranges.
@ -165,30 +222,76 @@ class set
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
template <class InputIterator> template <class InputIterator>
set( ordered_unique_range_t, InputIterator first, InputIterator last BOOST_CONTAINER_FORCEINLINE set( ordered_unique_range_t, InputIterator first, InputIterator last
, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) , const Compare& comp, const allocator_type& a)
: base_t(ordered_range, first, last, comp, a) : base_t(ordered_range, first, last, comp, a)
{} {}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and //! <b>Effects</b>: Constructs an empty set and
//! allocator, and inserts elements from the range [il.begin(), il.end()). //! inserts elements from the range [il.begin(), il.end()).
//! //!
//! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using //! <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(). //! the predicate and otherwise N logN, where N is il.begin() - il.end().
set(std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) BOOST_CONTAINER_FORCEINLINE set(std::initializer_list<value_type> il)
: base_t(true, il.begin(), il.end(), comp, a) : base_t(true, il.begin(), il.end())
{} {}
//! <b>Effects</b>: Constructs an empty set using the specified //! <b>Effects</b>: Constructs an empty set using the specified
//! allocator, and inserts elements from the range [il.begin(), il.end()). //! allocator, and inserts elements from the range [il.begin(), il.end()).
//! //!
//! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using //! <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(). //! the predicate and otherwise N logN, where N is il.begin() - il.end().
set(std::initializer_list<value_type> il, const allocator_type& a) BOOST_CONTAINER_FORCEINLINE set(std::initializer_list<value_type> il, const allocator_type& a)
: base_t(true, il.begin(), il.end(), Compare(), a) : base_t(true, il.begin(), il.end(), Compare(), a)
{} {}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! inserts elements from the range [il.begin(), il.end()).
//!
//! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
//! the predicate and otherwise N logN, where N is il.begin() - il.end().
BOOST_CONTAINER_FORCEINLINE set(std::initializer_list<value_type> il, const Compare& comp )
: base_t(true, il.begin(), il.end(), comp)
{}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! allocator, and inserts elements from the range [il.begin(), il.end()).
//!
//! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
//! the predicate and otherwise N logN, where N is il.begin() - il.end().
BOOST_CONTAINER_FORCEINLINE set(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
: base_t(true, il.begin(), il.end(), comp, a)
{}
//! <b>Effects</b>: Constructs an empty set and
//! inserts elements from the ordered unique range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
BOOST_CONTAINER_FORCEINLINE set( ordered_unique_range_t, std::initializer_list<value_type> il)
: base_t(ordered_range, il.begin(), il.end())
{}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! inserts elements from the ordered unique range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
BOOST_CONTAINER_FORCEINLINE set( ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp)
: base_t(ordered_range, il.begin(), il.end(), comp)
{}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object and //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges. //! is more efficient than the normal range creation for ordered ranges.
@ -199,8 +302,7 @@ class set
//! <b>Complexity</b>: Linear in N. //! <b>Complexity</b>: Linear in N.
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
set( ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare() BOOST_CONTAINER_FORCEINLINE set( ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
, const allocator_type& a = allocator_type())
: base_t(ordered_range, il.begin(), il.end(), comp, a) : base_t(ordered_range, il.begin(), il.end(), comp, a)
{} {}
#endif #endif
@ -208,7 +310,7 @@ class set
//! <b>Effects</b>: Copy constructs a set. //! <b>Effects</b>: Copy constructs a set.
//! //!
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
set(const set& x) BOOST_CONTAINER_FORCEINLINE set(const set& x)
: base_t(static_cast<const base_t&>(x)) : base_t(static_cast<const base_t&>(x))
{} {}
@ -217,7 +319,7 @@ class set
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
//! //!
//! <b>Postcondition</b>: x is emptied. //! <b>Postcondition</b>: x is emptied.
set(BOOST_RV_REF(set) x) BOOST_CONTAINER_FORCEINLINE set(BOOST_RV_REF(set) x)
BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value) BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
: base_t(BOOST_MOVE_BASE(base_t, x)) : base_t(BOOST_MOVE_BASE(base_t, x))
{} {}
@ -225,7 +327,7 @@ class set
//! <b>Effects</b>: Copy constructs a set using the specified allocator. //! <b>Effects</b>: Copy constructs a set using the specified allocator.
//! //!
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
set(const set& x, const allocator_type &a) BOOST_CONTAINER_FORCEINLINE set(const set& x, const allocator_type &a)
: base_t(static_cast<const base_t&>(x), a) : base_t(static_cast<const base_t&>(x), a)
{} {}
@ -233,14 +335,14 @@ class set
//! Constructs *this using x's resources. //! Constructs *this using x's resources.
//! //!
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise. //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
set(BOOST_RV_REF(set) x, const allocator_type &a) BOOST_CONTAINER_FORCEINLINE set(BOOST_RV_REF(set) x, const allocator_type &a)
: base_t(BOOST_MOVE_BASE(base_t, x), a) : base_t(BOOST_MOVE_BASE(base_t, x), a)
{} {}
//! <b>Effects</b>: Makes *this a copy of x. //! <b>Effects</b>: Makes *this a copy of x.
//! //!
//! <b>Complexity</b>: Linear in x.size(). //! <b>Complexity</b>: Linear in x.size().
set& operator=(BOOST_COPY_ASSIGN_REF(set) x) BOOST_CONTAINER_FORCEINLINE set& operator=(BOOST_COPY_ASSIGN_REF(set) x)
{ return static_cast<set&>(this->base_t::operator=(static_cast<const base_t&>(x))); } { return static_cast<set&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
//! <b>Effects</b>: this->swap(x.get()). //! <b>Effects</b>: this->swap(x.get()).
@ -251,7 +353,7 @@ class set
//! <b>Complexity</b>: Constant if allocator_traits_type:: //! <b>Complexity</b>: Constant if allocator_traits_type::
//! propagate_on_container_move_assignment is true or //! propagate_on_container_move_assignment is true or
//! this->get>allocator() == x.get_allocator(). Linear otherwise. //! this->get>allocator() == x.get_allocator(). Linear otherwise.
set& operator=(BOOST_RV_REF(set) x) BOOST_CONTAINER_FORCEINLINE set& operator=(BOOST_RV_REF(set) x)
BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
allocator_traits_type::is_always_equal::value) && allocator_traits_type::is_always_equal::value) &&
boost::container::container_detail::is_nothrow_move_assignable<Compare>::value) boost::container::container_detail::is_nothrow_move_assignable<Compare>::value)
@ -424,7 +526,7 @@ class set
//! //!
//! <b>Complexity</b>: Logarithmic. //! <b>Complexity</b>: Logarithmic.
template <class... Args> template <class... Args>
std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... 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->base_t::emplace_unique(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type Key constructed with //! <b>Effects</b>: Inserts an object of type Key constructed with
@ -437,18 +539,18 @@ class set
//! //!
//! <b>Complexity</b>: Logarithmic. //! <b>Complexity</b>: Logarithmic.
template <class... Args> template <class... Args>
iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... 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->base_t::emplace_hint_unique(p, boost::forward<Args>(args)...); }
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_CONTAINER_SET_EMPLACE_CODE(N) \ #define BOOST_CONTAINER_SET_EMPLACE_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##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->base_t::emplace_unique(BOOST_MOVE_FWD##N); }\
\ \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##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->base_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
// //
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SET_EMPLACE_CODE) BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SET_EMPLACE_CODE)
@ -513,7 +615,7 @@ class set
//! //!
//! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last) //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
template <class InputIterator> template <class InputIterator>
void insert(InputIterator first, InputIterator last) BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
{ this->base_t::insert_unique(first, last); } { this->base_t::insert_unique(first, last); }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
@ -521,16 +623,16 @@ class set
//! if there is no element with key equivalent to the key of that element. //! if there is no element with key equivalent to the key of that element.
//! //!
//! <b>Complexity</b>: At most N log(size()+N) (N is the distance from il.begin() to il.end()) //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from il.begin() to il.end())
void insert(std::initializer_list<value_type> il) BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
{ this->base_t::insert_unique(il.begin(), il.end()); } { this->base_t::insert_unique(il.begin(), il.end()); }
#endif #endif
//! @copydoc ::boost::container::map::insert(node_type&&) //! @copydoc ::boost::container::map::insert(node_type&&)
insert_return_type insert(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) BOOST_CONTAINER_FORCEINLINE insert_return_type insert(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh)
{ return this->base_t::insert_unique_node(boost::move(nh)); } { return this->base_t::insert_unique_node(boost::move(nh)); }
//! @copydoc ::boost::container::map::insert(const_iterator, node_type&&) //! @copydoc ::boost::container::map::insert(const_iterator, node_type&&)
insert_return_type insert(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) BOOST_CONTAINER_FORCEINLINE insert_return_type insert(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh)
{ return this->base_t::insert_unique_node(hint, boost::move(nh)); } { return this->base_t::insert_unique_node(hint, boost::move(nh)); }
//! @copydoc ::boost::container::map::merge(map<Key, T, C2, Allocator, Options>&) //! @copydoc ::boost::container::map::merge(map<Key, T, C2, Allocator, Options>&)
@ -631,13 +733,13 @@ class set
//! <b>Returns</b>: The number of elements with key equivalent to x. //! <b>Returns</b>: The number of elements with key equivalent to x.
//! //!
//! <b>Complexity</b>: log(size())+count(k) //! <b>Complexity</b>: log(size())+count(k)
size_type count(const key_type& x) const 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->base_t::find(x) != this->base_t::cend()); }
//! <b>Returns</b>: The number of elements with key equivalent to x. //! <b>Returns</b>: The number of elements with key equivalent to x.
//! //!
//! <b>Complexity</b>: log(size())+count(k) //! <b>Complexity</b>: log(size())+count(k)
size_type count(const key_type& x) BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x)
{ return static_cast<size_type>(this->base_t::find(x) != this->base_t::end()); } { return static_cast<size_type>(this->base_t::find(x) != this->base_t::end()); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@ -671,13 +773,13 @@ class set
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//! //!
//! <b>Complexity</b>: Logarithmic //! <b>Complexity</b>: Logarithmic
std::pair<iterator,iterator> equal_range(const key_type& x) BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const key_type& x)
{ return this->base_t::lower_bound_range(x); } { return this->base_t::lower_bound_range(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//! //!
//! <b>Complexity</b>: Logarithmic //! <b>Complexity</b>: Logarithmic
std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const 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->base_t::lower_bound_range(x); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@ -737,11 +839,11 @@ class set
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
template <class KeyType> template <class KeyType>
std::pair<iterator, bool> priv_insert(BOOST_FWD_REF(KeyType) x) 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->base_t::insert_unique(::boost::forward<KeyType>(x)); }
template <class KeyType> template <class KeyType>
iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) 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->base_t::insert_unique(p, ::boost::forward<KeyType>(x)); }
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
@ -829,36 +931,79 @@ class multiset
////////////////////////////////////////////// //////////////////////////////////////////////
//! @copydoc ::boost::container::set::set() //! @copydoc ::boost::container::set::set()
multiset() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value && BOOST_CONTAINER_FORCEINLINE multiset()
container_detail::is_nothrow_default_constructible<Compare>::value) BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value &&
container_detail::is_nothrow_default_constructible<Compare>::value)
: base_t() : base_t()
{} {}
//! @copydoc ::boost::container::set::set(const Compare&, const allocator_type&)
explicit multiset(const Compare& comp,
const allocator_type& a = allocator_type())
: base_t(comp, a)
{}
//! @copydoc ::boost::container::set::set(const allocator_type&) //! @copydoc ::boost::container::set::set(const allocator_type&)
explicit multiset(const allocator_type& a) BOOST_CONTAINER_FORCEINLINE explicit multiset(const allocator_type& a)
: base_t(a) : base_t(a)
{} {}
//! @copydoc ::boost::container::set::set(InputIterator, InputIterator, const Compare& comp, const allocator_type&) //! @copydoc ::boost::container::set::set(const Compare&)
BOOST_CONTAINER_FORCEINLINE explicit multiset(const Compare& comp)
: base_t(comp)
{}
//! @copydoc ::boost::container::set::set(const Compare&, const allocator_type&)
BOOST_CONTAINER_FORCEINLINE multiset(const Compare& comp, const allocator_type& a)
: base_t(comp, a)
{}
//! @copydoc ::boost::container::set::set(InputIterator, InputIterator)
template <class InputIterator> template <class InputIterator>
multiset(InputIterator first, InputIterator last, BOOST_CONTAINER_FORCEINLINE multiset(InputIterator first, InputIterator last)
const Compare& comp = Compare(), : base_t(false, first, last)
const allocator_type& a = allocator_type())
: base_t(false, first, last, comp, a)
{} {}
//! @copydoc ::boost::container::set::set(InputIterator, InputIterator, const allocator_type&) //! @copydoc ::boost::container::set::set(InputIterator, InputIterator, const allocator_type&)
template <class InputIterator> template <class InputIterator>
multiset(InputIterator first, InputIterator last, const allocator_type& a) BOOST_CONTAINER_FORCEINLINE multiset(InputIterator first, InputIterator last, const allocator_type& a)
: base_t(false, first, last, key_compare(), a) : base_t(false, first, last, key_compare(), a)
{} {}
//! @copydoc ::boost::container::set::set(InputIterator, InputIterator, const Compare&)
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multiset(InputIterator first, InputIterator last, const Compare& comp)
: base_t(false, first, last, comp)
{}
//! @copydoc ::boost::container::set::set(InputIterator, InputIterator, const Compare&, const allocator_type&)
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multiset(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
: base_t(false, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty multiset and
//! and inserts elements from the ordered range [first ,last ). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multiset( ordered_range_t, InputIterator first, InputIterator last )
: base_t(ordered_range, first, last)
{}
//! <b>Effects</b>: Constructs an empty multiset using the specified comparison object and
//! inserts elements from the ordered range [first ,last ). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multiset( ordered_range_t, InputIterator first, InputIterator last, const Compare& comp)
: base_t(ordered_range, first, last, comp)
{}
//! <b>Effects</b>: Constructs an empty multiset using the specified comparison object and //! <b>Effects</b>: Constructs an empty multiset using the specified comparison object and
//! allocator, and inserts elements from the ordered range [first ,last ). This function //! allocator, and inserts elements from the ordered range [first ,last ). This function
//! is more efficient than the normal range creation for ordered ranges. //! is more efficient than the normal range creation for ordered ranges.
@ -869,56 +1014,74 @@ class multiset
//! //!
//! <b>Note</b>: Non-standard extension. //! <b>Note</b>: Non-standard extension.
template <class InputIterator> template <class InputIterator>
multiset( ordered_range_t, InputIterator first, InputIterator last BOOST_CONTAINER_FORCEINLINE multiset( ordered_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
, const Compare& comp = Compare()
, const allocator_type& a = allocator_type())
: base_t(ordered_range, first, last, comp, a) : base_t(ordered_range, first, last, comp, a)
{} {}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! @copydoc ::boost::container::set::set(std::initializer_list<value_type>, const Compare& comp, const allocator_type&) //! @copydoc ::boost::container::set::set(std::initializer_list<value_type>)
multiset(std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) BOOST_CONTAINER_FORCEINLINE multiset(std::initializer_list<value_type> il)
: base_t(false, il.begin(), il.end(), comp, a) : base_t(false, il.begin(), il.end())
{} {}
//! @copydoc ::boost::container::set::set(std::initializer_list<value_type>, const allocator_type&) //! @copydoc ::boost::container::set::set(std::initializer_list<value_type>, const allocator_type&)
multiset(std::initializer_list<value_type> il, const allocator_type& a) BOOST_CONTAINER_FORCEINLINE multiset(std::initializer_list<value_type> il, const allocator_type& a)
: base_t(false, il.begin(), il.end(), Compare(), a) : base_t(false, il.begin(), il.end(), Compare(), a)
{} {}
//! @copydoc ::boost::container::set::set(ordered_unique_range_t, std::initializer_list<value_type>, const Compare& comp, const allocator_type&) //! @copydoc ::boost::container::set::set(std::initializer_list<value_type>, const Compare&)
multiset(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) BOOST_CONTAINER_FORCEINLINE multiset(std::initializer_list<value_type> il, const Compare& comp)
: base_t(false, il.begin(), il.end(), comp)
{}
//! @copydoc ::boost::container::set::set(std::initializer_list<value_type>, const Compare&, const allocator_type&)
BOOST_CONTAINER_FORCEINLINE multiset(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
: base_t(false, il.begin(), il.end(), comp, a)
{}
//! @copydoc ::boost::container::set::set(ordered_unique_range_t, std::initializer_list<value_type>)
BOOST_CONTAINER_FORCEINLINE multiset(ordered_range_t, std::initializer_list<value_type> il)
: base_t(ordered_range, il.begin(), il.end())
{}
//! @copydoc ::boost::container::set::set(ordered_unique_range_t, std::initializer_list<value_type>, const Compare&)
BOOST_CONTAINER_FORCEINLINE multiset(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp)
: base_t(ordered_range, il.begin(), il.end(), comp)
{}
//! @copydoc ::boost::container::set::set(ordered_unique_range_t, std::initializer_list<value_type>, const Compare&, const allocator_type&)
BOOST_CONTAINER_FORCEINLINE 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) : base_t(ordered_range, il.begin(), il.end(), comp, a)
{} {}
#endif #endif
//! @copydoc ::boost::container::set::set(const set &) //! @copydoc ::boost::container::set::set(const set &)
multiset(const multiset& x) BOOST_CONTAINER_FORCEINLINE multiset(const multiset& x)
: base_t(static_cast<const base_t&>(x)) : base_t(static_cast<const base_t&>(x))
{} {}
//! @copydoc ::boost::container::set::set(set &&) //! @copydoc ::boost::container::set::set(set &&)
multiset(BOOST_RV_REF(multiset) x) BOOST_CONTAINER_FORCEINLINE multiset(BOOST_RV_REF(multiset) x)
BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value) BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
: base_t(BOOST_MOVE_BASE(base_t, x)) : base_t(BOOST_MOVE_BASE(base_t, x))
{} {}
//! @copydoc ::boost::container::set::set(const set &, const allocator_type &) //! @copydoc ::boost::container::set::set(const set &, const allocator_type &)
multiset(const multiset& x, const allocator_type &a) BOOST_CONTAINER_FORCEINLINE multiset(const multiset& x, const allocator_type &a)
: base_t(static_cast<const base_t&>(x), a) : base_t(static_cast<const base_t&>(x), a)
{} {}
//! @copydoc ::boost::container::set::set(set &&, const allocator_type &) //! @copydoc ::boost::container::set::set(set &&, const allocator_type &)
multiset(BOOST_RV_REF(multiset) x, const allocator_type &a) BOOST_CONTAINER_FORCEINLINE multiset(BOOST_RV_REF(multiset) x, const allocator_type &a)
: base_t(BOOST_MOVE_BASE(base_t, x), a) : base_t(BOOST_MOVE_BASE(base_t, x), a)
{} {}
//! @copydoc ::boost::container::set::operator=(const set &) //! @copydoc ::boost::container::set::operator=(const set &)
multiset& operator=(BOOST_COPY_ASSIGN_REF(multiset) x) BOOST_CONTAINER_FORCEINLINE multiset& operator=(BOOST_COPY_ASSIGN_REF(multiset) x)
{ return static_cast<multiset&>(this->base_t::operator=(static_cast<const base_t&>(x))); } { return static_cast<multiset&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
//! @copydoc ::boost::container::set::operator=(set &&) //! @copydoc ::boost::container::set::operator=(set &&)
multiset& operator=(BOOST_RV_REF(multiset) x) BOOST_CONTAINER_FORCEINLINE multiset& operator=(BOOST_RV_REF(multiset) x)
BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
allocator_traits_type::is_always_equal::value) && allocator_traits_type::is_always_equal::value) &&
boost::container::container_detail::is_nothrow_move_assignable<Compare>::value) boost::container::container_detail::is_nothrow_move_assignable<Compare>::value)
@ -999,7 +1162,7 @@ class multiset
//! //!
//! <b>Complexity</b>: Logarithmic. //! <b>Complexity</b>: Logarithmic.
template <class... Args> template <class... Args>
iterator emplace(BOOST_FWD_REF(Args)... args) BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_FWD_REF(Args)... args)
{ return this->base_t::emplace_equal(boost::forward<Args>(args)...); } { return this->base_t::emplace_equal(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type Key constructed with //! <b>Effects</b>: Inserts an object of type Key constructed with
@ -1011,18 +1174,18 @@ class multiset
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p. //! is inserted right before p.
template <class... Args> template <class... Args>
iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... 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->base_t::emplace_hint_equal(p, boost::forward<Args>(args)...); }
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_CONTAINER_MULTISET_EMPLACE_CODE(N) \ #define BOOST_CONTAINER_MULTISET_EMPLACE_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
iterator emplace(BOOST_MOVE_UREF##N)\ BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\
{ return this->base_t::emplace_equal(BOOST_MOVE_FWD##N); }\ { return this->base_t::emplace_equal(BOOST_MOVE_FWD##N); }\
\ \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##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->base_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
// //
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_MULTISET_EMPLACE_CODE) BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_MULTISET_EMPLACE_CODE)
@ -1079,21 +1242,21 @@ class multiset
//! //!
//! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last) //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
template <class InputIterator> template <class InputIterator>
void insert(InputIterator first, InputIterator last) BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
{ this->base_t::insert_equal(first, last); } { this->base_t::insert_equal(first, last); }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! @copydoc ::boost::container::set::insert(std::initializer_list<value_type>) //! @copydoc ::boost::container::set::insert(std::initializer_list<value_type>)
void insert(std::initializer_list<value_type> il) BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
{ this->base_t::insert_equal(il.begin(), il.end()); } { this->base_t::insert_equal(il.begin(), il.end()); }
#endif #endif
//! @copydoc ::boost::container::multimap::insert(node_type&&) //! @copydoc ::boost::container::multimap::insert(node_type&&)
iterator insert(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh)
{ return this->base_t::insert_equal_node(boost::move(nh)); } { return this->base_t::insert_equal_node(boost::move(nh)); }
//! @copydoc ::boost::container::multimap::insert(const_iterator, node_type&&) //! @copydoc ::boost::container::multimap::insert(const_iterator, node_type&&)
iterator insert(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh)
{ return this->base_t::insert_equal_node(hint, boost::move(nh)); } { return this->base_t::insert_equal_node(hint, boost::move(nh)); }
//! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&) //! @copydoc ::boost::container::multimap::merge(multimap<Key, T, C2, Allocator, Options>&)
@ -1219,11 +1382,11 @@ class multiset
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
template <class KeyType> template <class KeyType>
iterator priv_insert(BOOST_FWD_REF(KeyType) x) BOOST_CONTAINER_FORCEINLINE iterator priv_insert(BOOST_FWD_REF(KeyType) x)
{ return this->base_t::insert_equal(::boost::forward<KeyType>(x)); } { return this->base_t::insert_equal(::boost::forward<KeyType>(x)); }
template <class KeyType> template <class KeyType>
iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) 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->base_t::insert_equal(p, ::boost::forward<KeyType>(x)); }
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@ -143,8 +143,6 @@ bool test_expected_container(const Container &ec, const std::pair<EmplaceInt, Em
return true; return true;
} }
static EmplaceInt expected [10];
typedef std::pair<EmplaceInt, EmplaceInt> EmplaceIntPair; typedef std::pair<EmplaceInt, EmplaceInt> EmplaceIntPair;
static boost::container::container_detail::aligned_storage<sizeof(EmplaceIntPair)*10>::type pair_storage; static boost::container::container_detail::aligned_storage<sizeof(EmplaceIntPair)*10>::type pair_storage;
@ -166,6 +164,7 @@ bool test_emplace_back(container_detail::true_)
{ {
std::cout << "Starting test_emplace_back." << std::endl << " Class: " std::cout << "Starting test_emplace_back." << std::endl << " Class: "
<< typeid(Container).name() << std::endl; << typeid(Container).name() << std::endl;
static EmplaceInt expected [10];
{ {
new(&expected [0]) EmplaceInt(); new(&expected [0]) EmplaceInt();
@ -218,7 +217,7 @@ bool test_emplace_front(container_detail::true_)
{ {
std::cout << "Starting test_emplace_front." << std::endl << " Class: " std::cout << "Starting test_emplace_front." << std::endl << " Class: "
<< typeid(Container).name() << std::endl; << typeid(Container).name() << std::endl;
static EmplaceInt expected [10];
{ {
new(&expected [0]) EmplaceInt(1, 2, 3, 4, 5); new(&expected [0]) EmplaceInt(1, 2, 3, 4, 5);
new(&expected [1]) EmplaceInt(1, 2, 3, 4); new(&expected [1]) EmplaceInt(1, 2, 3, 4);
@ -270,7 +269,7 @@ bool test_emplace_before(container_detail::true_)
{ {
std::cout << "Starting test_emplace_before." << std::endl << " Class: " std::cout << "Starting test_emplace_before." << std::endl << " Class: "
<< typeid(Container).name() << std::endl; << typeid(Container).name() << std::endl;
static EmplaceInt expected [10];
{ {
new(&expected [0]) EmplaceInt(); new(&expected [0]) EmplaceInt();
new(&expected [1]) EmplaceInt(1); new(&expected [1]) EmplaceInt(1);
@ -382,6 +381,7 @@ bool test_emplace_after(container_detail::true_)
{ {
std::cout << "Starting test_emplace_after." << std::endl << " Class: " std::cout << "Starting test_emplace_after." << std::endl << " Class: "
<< typeid(Container).name() << std::endl; << typeid(Container).name() << std::endl;
static EmplaceInt expected [10];
{ {
new(&expected [0]) EmplaceInt(); new(&expected [0]) EmplaceInt();
new(&expected [1]) EmplaceInt(1); new(&expected [1]) EmplaceInt(1);
@ -467,7 +467,7 @@ bool test_emplace_assoc(container_detail::true_)
{ {
std::cout << "Starting test_emplace_assoc." << std::endl << " Class: " std::cout << "Starting test_emplace_assoc." << std::endl << " Class: "
<< typeid(Container).name() << std::endl; << typeid(Container).name() << std::endl;
static EmplaceInt expected [10];
new(&expected [0]) EmplaceInt(); new(&expected [0]) EmplaceInt();
new(&expected [1]) EmplaceInt(1); new(&expected [1]) EmplaceInt(1);
new(&expected [2]) EmplaceInt(1, 2); new(&expected [2]) EmplaceInt(1, 2);
@ -514,7 +514,7 @@ bool test_emplace_hint(container_detail::true_)
{ {
std::cout << "Starting test_emplace_hint." << std::endl << " Class: " std::cout << "Starting test_emplace_hint." << std::endl << " Class: "
<< typeid(Container).name() << std::endl; << typeid(Container).name() << std::endl;
static EmplaceInt expected [10];
new(&expected [0]) EmplaceInt(); new(&expected [0]) EmplaceInt();
new(&expected [1]) EmplaceInt(1); new(&expected [1]) EmplaceInt(1);
new(&expected [2]) EmplaceInt(1, 2); new(&expected [2]) EmplaceInt(1, 2);
@ -565,11 +565,11 @@ bool test_emplace_assoc_pair(container_detail::true_)
std::cout << "Starting test_emplace_assoc_pair." << std::endl << " Class: " std::cout << "Starting test_emplace_assoc_pair." << std::endl << " Class: "
<< typeid(Container).name() << std::endl; << typeid(Container).name() << std::endl;
new(&expected_pair[0].first) EmplaceInt(); new(&expected_pair[0].first) EmplaceInt();
new(&expected_pair[0].second) EmplaceInt(); new(&expected_pair[0].second) EmplaceInt();
new(&expected_pair[1].first) EmplaceInt(1); new(&expected_pair[1].first) EmplaceInt(1);
new(&expected_pair[1].second) EmplaceInt(1); new(&expected_pair[1].second) EmplaceInt(1);
new(&expected_pair[2].first) EmplaceInt(2); new(&expected_pair[2].first) EmplaceInt(2);
new(&expected_pair[2].second) EmplaceInt(2); new(&expected_pair[2].second) EmplaceInt(2);
{ {
Container c; Container c;
@ -603,11 +603,11 @@ bool test_emplace_hint_pair(container_detail::true_)
std::cout << "Starting test_emplace_hint_pair." << std::endl << " Class: " std::cout << "Starting test_emplace_hint_pair." << std::endl << " Class: "
<< typeid(Container).name() << std::endl; << typeid(Container).name() << std::endl;
new(&expected_pair[0].first) EmplaceInt(); new(&expected_pair[0].first) EmplaceInt();
new(&expected_pair[0].second) EmplaceInt(); new(&expected_pair[0].second) EmplaceInt();
new(&expected_pair[1].first) EmplaceInt(1); new(&expected_pair[1].first) EmplaceInt(1);
new(&expected_pair[1].second) EmplaceInt(1); new(&expected_pair[1].second) EmplaceInt(1);
new(&expected_pair[2].first) EmplaceInt(2); new(&expected_pair[2].first) EmplaceInt(2);
new(&expected_pair[2].second) EmplaceInt(2); new(&expected_pair[2].second) EmplaceInt(2);
{ {
Container c; Container c;

View File

@ -502,6 +502,9 @@ int main()
return 1; return 1;
} }
if (!boost::container::test::instantiate_constructors<flat_map<int, int>, flat_multimap<int, int> >())
return 1;
//////////////////////////////////// ////////////////////////////////////
// Testing allocator implementations // Testing allocator implementations
//////////////////////////////////// ////////////////////////////////////

View File

@ -608,6 +608,9 @@ int main()
return 1; return 1;
} }
if (!boost::container::test::instantiate_constructors<flat_set<int>, flat_multiset<int> >())
return 1;
//////////////////////////////////// ////////////////////////////////////
// Testing allocator implementations // Testing allocator implementations
//////////////////////////////////// ////////////////////////////////////

View File

@ -432,6 +432,9 @@ int main ()
if(!node_type_test()) if(!node_type_test())
return 1; return 1;
if (!boost::container::test::instantiate_constructors<map<int, int>, multimap<int, int> >())
return 1;
test::test_merge_from_different_comparison(); test::test_merge_from_different_comparison();
//////////////////////////////////// ////////////////////////////////////
@ -440,22 +443,22 @@ int main ()
// //
// map // map
// //
typedef map< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> > typedef map< int*, int*, std::less<int*>, std::allocator< std::pair<int *const, int*> >
, tree_assoc_options< optimize_size<false>, tree_type<red_black_tree> >::type > rbmap_size_optimized_no; , tree_assoc_options< optimize_size<false>, tree_type<red_black_tree> >::type > rbmap_size_optimized_no;
typedef map< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> > typedef map< int*, int*, std::less<int*>, std::allocator< std::pair<int *const, int*> >
, tree_assoc_options< optimize_size<true>, tree_type<avl_tree> >::type > avlmap_size_optimized_yes; , tree_assoc_options< optimize_size<true>, tree_type<avl_tree> >::type > avlmap_size_optimized_yes;
// //
// multimap // multimap
// //
typedef multimap< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> > typedef multimap< int*, int*, std::less<int*>, std::allocator< std::pair<int *const, int*> >
, tree_assoc_options< optimize_size<true>, tree_type<red_black_tree> >::type > rbmmap_size_optimized_yes; , tree_assoc_options< optimize_size<true>, tree_type<red_black_tree> >::type > rbmmap_size_optimized_yes;
typedef multimap< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> > typedef multimap< int*, int*, std::less<int*>, std::allocator< std::pair<int *const, int*> >
, tree_assoc_options< optimize_size<false>, tree_type<avl_tree> >::type > avlmmap_size_optimized_no; , tree_assoc_options< optimize_size<false>, tree_type<avl_tree> >::type > avlmmap_size_optimized_no;
BOOST_STATIC_ASSERT(sizeof(rbmmap_size_optimized_yes) < sizeof(rbmap_size_optimized_no)); BOOST_STATIC_ASSERT(sizeof(rbmmap_size_optimized_yes) < sizeof(rbmap_size_optimized_no));
BOOST_STATIC_ASSERT(sizeof(avlmap_size_optimized_yes) < sizeof(avlmmap_size_optimized_no)); BOOST_STATIC_ASSERT(sizeof(avlmap_size_optimized_yes) < sizeof(avlmmap_size_optimized_no));
return 0; return 0;
} }

View File

@ -945,6 +945,88 @@ bool test_map_support_for_initialization_list_for()
return true; return true;
} }
template<typename MapType, typename MultimapType>
bool instantiate_constructors()
{
{
typedef typename MapType::value_type value_type;
typename MapType::key_compare comp;
typename MapType::allocator_type a;
typename MapType::value_type value;
{
MapType s0;
MapType s1(comp);
MapType s2(a);
MapType s3(comp, a);
}
{
MapType s0(&value, &value);
MapType s1(&value, &value ,comp);
MapType s2(&value, &value ,a);
MapType s3(&value, &value ,comp, a);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
{
std::initializer_list<value_type> il;
MapType s0(il);
MapType s1(il, comp);
MapType s2(il, a);
MapType s3(il, comp, a);
}
{
std::initializer_list<value_type> il;
MapType s0(ordered_unique_range, il);
MapType s1(ordered_unique_range, il, comp);
MapType s3(ordered_unique_range, il, comp, a);
}
#endif
{
MapType s0(ordered_unique_range, &value, &value);
MapType s1(ordered_unique_range, &value, &value ,comp);
MapType s2(ordered_unique_range, &value, &value ,comp, a);
}
}
{
typedef typename MultimapType::value_type value_type;
typename MultimapType::key_compare comp;
typename MultimapType::allocator_type a;
typename MultimapType::value_type value;
{
MultimapType s0;
MultimapType s1(comp);
MultimapType s2(a);
MultimapType s3(comp, a);
}
{
MultimapType s0(&value, &value);
MultimapType s1(&value, &value ,comp);
MultimapType s2(&value, &value ,a);
MultimapType s3(&value, &value ,comp, a);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
{
std::initializer_list<value_type> il;
MultimapType s0(il);
MultimapType s1(il, comp);
MultimapType s2(il, a);
MultimapType s3(il, comp, a);
}
{
std::initializer_list<value_type> il;
MultimapType s0(ordered_range, il);
MultimapType s1(ordered_range, il, comp);
MultimapType s3(ordered_range, il, comp, a);
}
#endif
{
MultimapType s0(ordered_range, &value, &value);
MultimapType s1(ordered_range, &value, &value ,comp);
MultimapType s2(ordered_range, &value, &value ,comp, a);
}
}
return true;
}
} //namespace test{ } //namespace test{
} //namespace container { } //namespace container {

View File

@ -318,7 +318,6 @@ void test_merge_from_different_comparison()
set1.merge(set2); set1.merge(set2);
} }
int main () int main ()
{ {
//Recursive container instantiation //Recursive container instantiation
@ -345,6 +344,9 @@ int main ()
s.emplace(p); s.emplace(p);
} }
if (!boost::container::test::instantiate_constructors<set<int>, multiset<int> >())
return 1;
test_merge_from_different_comparison(); test_merge_from_different_comparison();
//////////////////////////////////// ////////////////////////////////////

View File

@ -162,14 +162,14 @@ int set_test ()
IntType move_me(i/2); IntType move_me(i/2);
aux_vect3[i] = boost::move(move_me); aux_vect3[i] = boost::move(move_me);
} }
::boost::movelib::unique_ptr<MyBoostSet> const pboostset = ::boost::movelib::make_unique<MyBoostSet> ::boost::movelib::unique_ptr<MyBoostSet> const pboostset2 = ::boost::movelib::make_unique<MyBoostSet>
(boost::make_move_iterator(&aux_vect[0]), boost::make_move_iterator(&aux_vect[0]+50), typename MyBoostSet::key_compare()); (boost::make_move_iterator(&aux_vect[0]), boost::make_move_iterator(&aux_vect[0]+50), typename MyBoostSet::key_compare());
::boost::movelib::unique_ptr<MyStdSet> const pstdset = ::boost::movelib::make_unique<MyStdSet>(&aux_vect2[0], &aux_vect2[0]+50); ::boost::movelib::unique_ptr<MyStdSet> const pstdset2 = ::boost::movelib::make_unique<MyStdSet>(&aux_vect2[0], &aux_vect2[0]+50);
if(!test::CheckEqualContainers(*pboostset, *pstdset)) return 1; if(!test::CheckEqualContainers(*pboostset2, *pstdset2)) return 1;
::boost::movelib::unique_ptr<MyBoostMultiSet> const pboostmultiset = ::boost::movelib::make_unique<MyBoostMultiSet> ::boost::movelib::unique_ptr<MyBoostMultiSet> const pboostmultiset2 = ::boost::movelib::make_unique<MyBoostMultiSet>
(boost::make_move_iterator(&aux_vect3[0]), boost::make_move_iterator(&aux_vect3[0]+50), typename MyBoostMultiSet::key_compare()); (boost::make_move_iterator(&aux_vect3[0]), boost::make_move_iterator(&aux_vect3[0]+50), typename MyBoostMultiSet::key_compare());
::boost::movelib::unique_ptr<MyStdMultiSet> const pstdmultiset = ::boost::movelib::make_unique<MyStdMultiSet>(&aux_vect2[0], &aux_vect2[0]+50); ::boost::movelib::unique_ptr<MyStdMultiSet> const pstdmultiset2 = ::boost::movelib::make_unique<MyStdMultiSet>(&aux_vect2[0], &aux_vect2[0]+50);
if(!test::CheckEqualContainers(*pboostmultiset, *pstdmultiset)) return 1; if(!test::CheckEqualContainers(*pboostmultiset2, *pstdmultiset2)) return 1;
} }
{ //Set(beg, end, alloc) { //Set(beg, end, alloc)
IntType aux_vect[50]; IntType aux_vect[50];
@ -186,14 +186,14 @@ int set_test ()
IntType move_me(i/2); IntType move_me(i/2);
aux_vect3[i] = boost::move(move_me); aux_vect3[i] = boost::move(move_me);
} }
::boost::movelib::unique_ptr<MyBoostSet> const pboostset = ::boost::movelib::make_unique<MyBoostSet> ::boost::movelib::unique_ptr<MyBoostSet> const pboostset2 = ::boost::movelib::make_unique<MyBoostSet>
(boost::make_move_iterator(&aux_vect[0]), boost::make_move_iterator(&aux_vect[0]+50), typename MyBoostSet::allocator_type()); (boost::make_move_iterator(&aux_vect[0]), boost::make_move_iterator(&aux_vect[0]+50), typename MyBoostSet::allocator_type());
::boost::movelib::unique_ptr<MyStdSet> const pstdset = ::boost::movelib::make_unique<MyStdSet>(&aux_vect2[0], &aux_vect2[0]+50); ::boost::movelib::unique_ptr<MyStdSet> const pstdset2 = ::boost::movelib::make_unique<MyStdSet>(&aux_vect2[0], &aux_vect2[0]+50);
if(!test::CheckEqualContainers(*pboostset, *pstdset)) return 1; if(!test::CheckEqualContainers(*pboostset2, *pstdset2)) return 1;
::boost::movelib::unique_ptr<MyBoostMultiSet> const pboostmultiset = ::boost::movelib::make_unique<MyBoostMultiSet> ::boost::movelib::unique_ptr<MyBoostMultiSet> const pboostmultiset2 = ::boost::movelib::make_unique<MyBoostMultiSet>
(boost::make_move_iterator(&aux_vect3[0]), boost::make_move_iterator(&aux_vect3[0]+50), typename MyBoostMultiSet::allocator_type()); (boost::make_move_iterator(&aux_vect3[0]), boost::make_move_iterator(&aux_vect3[0]+50), typename MyBoostMultiSet::allocator_type());
::boost::movelib::unique_ptr<MyStdMultiSet> const pstdmultiset = ::boost::movelib::make_unique<MyStdMultiSet>(&aux_vect2[0], &aux_vect2[0]+50); ::boost::movelib::unique_ptr<MyStdMultiSet> const pstdmultiset2 = ::boost::movelib::make_unique<MyStdMultiSet>(&aux_vect2[0], &aux_vect2[0]+50);
if(!test::CheckEqualContainers(*pboostmultiset, *pstdmultiset)) return 1; if(!test::CheckEqualContainers(*pboostmultiset2, *pstdmultiset2)) return 1;
} }
{ {
IntType aux_vect[50]; IntType aux_vect[50];
@ -842,6 +842,87 @@ bool test_set_methods_with_initializer_list_as_argument_for()
return true; return true;
} }
template<typename SetType, typename MultisetType>
bool instantiate_constructors()
{
{
typedef typename SetType::value_type value_type;
typename SetType::key_compare comp;
typename SetType::allocator_type a;
typename SetType::value_type value;
{
SetType s0;
SetType s1(comp);
SetType s2(a);
SetType s3(comp, a);
}
{
SetType s0(&value, &value);
SetType s1(&value, &value ,comp);
SetType s2(&value, &value ,a);
SetType s3(&value, &value ,comp, a);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
{
SetType s0({ 0 });
SetType s1({ 0 },comp);
SetType s2({ 0 },a);
SetType s3({ 0 },comp, a);
}
{
std::initializer_list<value_type> il{0};
SetType s0(ordered_unique_range, il);
SetType s1(ordered_unique_range, il,comp);
SetType s3(ordered_unique_range, il,comp, a);
}
#endif
{
SetType s0(ordered_unique_range, &value, &value);
SetType s1(ordered_unique_range, &value, &value ,comp);
SetType s2(ordered_unique_range, &value, &value ,comp, a);
}
}
{
typename MultisetType::key_compare comp;
typename MultisetType::allocator_type a;
typename MultisetType::value_type value;
{
MultisetType s0;
MultisetType s1(comp);
MultisetType s2(a);
MultisetType s3(comp, a);
}
{
MultisetType s0(&value, &value);
MultisetType s1(&value, &value ,comp);
MultisetType s2(&value, &value ,a);
MultisetType s3(&value, &value ,comp, a);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
{
MultisetType s0({ 0 });
MultisetType s1({ 0 },comp);
MultisetType s2({ 0 },a);
MultisetType s3({ 0 },comp, a);
}
{
typedef typename MultisetType::value_type value_type;
std::initializer_list<value_type>il{0};
MultisetType s0(ordered_range, il);
MultisetType s1(ordered_range, il,comp);
MultisetType s3(ordered_range, il,comp, a);
}
#endif
{
MultisetType s0(ordered_range, &value, &value);
MultisetType s1(ordered_range, &value, &value ,comp);
MultisetType s2(ordered_range, &value, &value ,comp, a);
}
}
return true;
}
} //namespace test{ } //namespace test{
} //namespace container { } //namespace container {
} //namespace boost{ } //namespace boost{