forked from boostorg/container
Addd new constructors to containers, according to C++14's new constructors taking allocator arguments.
This commit is contained in:
@@ -548,7 +548,7 @@ class deque : protected deque_base<Allocator>
|
||||
: Base(a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs a deque that will use a copy of allocator a
|
||||
//! <b>Effects</b>: Constructs a deque
|
||||
//! and inserts n value initialized values.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
@@ -563,6 +563,38 @@ class deque : protected deque_base<Allocator>
|
||||
//deque_base will deallocate in case of exception...
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a deque
|
||||
//! and inserts n default initialized values.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
//! throws or T's default initialization or copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension
|
||||
deque(size_type n, default_init_t)
|
||||
: Base(n, allocator_type())
|
||||
{
|
||||
container_detail::insert_default_initialized_n_proxy<Allocator, iterator> proxy;
|
||||
proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
|
||||
//deque_base will deallocate in case of exception...
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a deque that will use a copy of allocator a
|
||||
//! and inserts n value initialized values.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
//! throws or T's value initialization throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
explicit deque(size_type n, const allocator_type &a)
|
||||
: Base(n, a)
|
||||
{
|
||||
container_detail::insert_value_initialized_n_proxy<Allocator, iterator> proxy;
|
||||
proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
|
||||
//deque_base will deallocate in case of exception...
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a deque that will use a copy of allocator a
|
||||
//! and inserts n default initialized values.
|
||||
//!
|
||||
@@ -572,8 +604,8 @@ class deque : protected deque_base<Allocator>
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension
|
||||
deque(size_type n, default_init_t)
|
||||
: Base(n, allocator_type())
|
||||
deque(size_type n, default_init_t, const allocator_type &a)
|
||||
: Base(n, a)
|
||||
{
|
||||
container_detail::insert_default_initialized_n_proxy<Allocator, iterator> proxy;
|
||||
proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
|
||||
|
||||
@@ -222,6 +222,19 @@ class flat_map
|
||||
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty flat_map 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>
|
||||
flat_map(InputIterator first, InputIterator last, const allocator_type& a)
|
||||
: m_flat_tree(true, first, last, Compare(), container_detail::force<impl_allocator_type>(a))
|
||||
{
|
||||
//A type must be std::pair<Key, T>
|
||||
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
|
||||
//! allocator, and inserts elements from the ordered unique range [first ,last). This function
|
||||
//! is more efficient than the normal range creation for ordered ranges.
|
||||
@@ -1218,6 +1231,19 @@ class flat_multimap
|
||||
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty flat_multimap 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>
|
||||
flat_multimap(InputIterator first, InputIterator last, const allocator_type& a)
|
||||
: m_flat_tree(false, first, last, Compare(), container_detail::force<impl_allocator_type>(a))
|
||||
{
|
||||
//A type must be std::pair<Key, T>
|
||||
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty flat_multimap 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.
|
||||
|
||||
@@ -144,6 +144,16 @@ class flat_set
|
||||
: base_t(true, first, last, comp, a)
|
||||
{}
|
||||
|
||||
//! <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>
|
||||
flat_set(InputIterator first, InputIterator last, const allocator_type& a)
|
||||
: base_t(true, first, last, Compare(), a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
|
||||
//! allocator, and inserts elements from the ordered unique range [first ,last). This function
|
||||
//! is more efficient than the normal range creation for ordered ranges.
|
||||
@@ -907,6 +917,12 @@ class flat_multiset
|
||||
: base_t(false, first, last, comp, a)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const allocator_type&)
|
||||
template <class InputIterator>
|
||||
flat_multiset(InputIterator first, InputIterator last, const allocator_type& a)
|
||||
: base_t(false, first, last, Compare(), a)
|
||||
{}
|
||||
|
||||
//! <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.
|
||||
|
||||
@@ -201,8 +201,8 @@ class list
|
||||
: AllocHolder(a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs a list that will use a copy of allocator a
|
||||
//! and inserts n copies of value.
|
||||
//! <b>Effects</b>: Constructs a list
|
||||
//! and inserts n value-initialized value_types.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
@@ -212,6 +212,17 @@ class list
|
||||
: AllocHolder(Allocator())
|
||||
{ this->resize(n); }
|
||||
|
||||
//! <b>Effects</b>: Constructs a list that will use a copy of allocator a
|
||||
//! and inserts n copies of value.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
list(size_type n, const allocator_type &a)
|
||||
: AllocHolder(a)
|
||||
{ this->resize(n); }
|
||||
|
||||
//! <b>Effects</b>: Constructs a list that will use a copy of allocator a
|
||||
//! and inserts n copies of value.
|
||||
//!
|
||||
|
||||
@@ -175,6 +175,19 @@ class map
|
||||
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
|
||||
//! 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>
|
||||
map(InputIterator first, InputIterator last, const allocator_type& 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
|
||||
//! allocator, and inserts elements from the ordered unique range [first ,last). This function
|
||||
//! is more efficient than the normal range creation for ordered ranges.
|
||||
@@ -983,6 +996,19 @@ class multimap
|
||||
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, 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>
|
||||
multimap(InputIterator first, InputIterator last, const allocator_type& 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
|
||||
//! allocator, and inserts elements from the ordered range [first ,last). This function
|
||||
//! is more efficient than the normal range creation for ordered ranges.
|
||||
|
||||
@@ -141,6 +141,16 @@ class set
|
||||
: base_t(true, first, last, comp, a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs an empty set 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>
|
||||
set(InputIterator first, InputIterator last, const allocator_type& a)
|
||||
: base_t(true, first, last, key_compare(), a)
|
||||
{}
|
||||
|
||||
//! <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
|
||||
//! is more efficient than the normal range creation for ordered ranges.
|
||||
@@ -787,6 +797,12 @@ class multiset
|
||||
: base_t(false, first, last, comp, a)
|
||||
{}
|
||||
|
||||
//! @copydoc ::boost::container::set::set(InputIterator, InputIterator, const allocator_type&)
|
||||
template <class InputIterator>
|
||||
multiset(InputIterator first, InputIterator last, const allocator_type& a)
|
||||
: base_t(false, first, last, key_compare(), a)
|
||||
{}
|
||||
|
||||
//! <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
|
||||
//! is more efficient than the normal range creation for ordered ranges.
|
||||
|
||||
@@ -229,10 +229,28 @@ class slist
|
||||
: AllocHolder(a)
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs a list
|
||||
//! and inserts n value-initialized value_types.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
explicit slist(size_type n)
|
||||
: AllocHolder(allocator_type())
|
||||
{ this->resize(n); }
|
||||
|
||||
//! <b>Effects</b>: Constructs a list that will use a copy of allocator a
|
||||
//! and inserts n copies of value.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
slist(size_type n, const allocator_type &a)
|
||||
: AllocHolder(a)
|
||||
{ this->resize(n); }
|
||||
|
||||
//! <b>Effects</b>: Constructs a list that will use a copy of allocator a
|
||||
//! and inserts n copies of value.
|
||||
//!
|
||||
|
||||
@@ -557,7 +557,7 @@ class stable_vector
|
||||
STABLE_VECTOR_CHECK_INVARIANT;
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a
|
||||
//! <b>Effects</b>: Constructs a stable_vector
|
||||
//! and inserts n value initialized values.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
@@ -573,6 +573,40 @@ class stable_vector
|
||||
cod.release();
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a stable_vector
|
||||
//! and inserts n default initialized values.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension
|
||||
stable_vector(size_type n, default_init_t)
|
||||
: internal_data(), index()
|
||||
{
|
||||
stable_vector_detail::clear_on_destroy<stable_vector> cod(*this);
|
||||
this->resize(n, default_init);
|
||||
STABLE_VECTOR_CHECK_INVARIANT;
|
||||
cod.release();
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a
|
||||
//! and inserts n value initialized values.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
explicit stable_vector(size_type n, const allocator_type &a)
|
||||
: internal_data(), index(a)
|
||||
{
|
||||
stable_vector_detail::clear_on_destroy<stable_vector> cod(*this);
|
||||
this->resize(n);
|
||||
STABLE_VECTOR_CHECK_INVARIANT;
|
||||
cod.release();
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a
|
||||
//! and inserts n default initialized values.
|
||||
//!
|
||||
@@ -582,8 +616,8 @@ class stable_vector
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension
|
||||
stable_vector(size_type n, default_init_t)
|
||||
: internal_data(), index()
|
||||
stable_vector(size_type n, default_init_t, const allocator_type &a)
|
||||
: internal_data(), index(a)
|
||||
{
|
||||
stable_vector_detail::clear_on_destroy<stable_vector> cod(*this);
|
||||
this->resize(n, default_init);
|
||||
|
||||
Reference in New Issue
Block a user