Add missing initializer list overload taking an additional allocator.

This commit is contained in:
Ion Gaztañaga
2015-02-28 23:46:08 +01:00
parent 8db0f4ad64
commit d39b1c143c
7 changed files with 136 additions and 42 deletions
+24
View File
@@ -271,6 +271,18 @@ 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 [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 last - first.
flat_map(std::initializer_list<value_type> il, const allocator_type& a)
: m_flat_tree(true, il.begin(), il.end(), 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 [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
@@ -1282,6 +1294,18 @@ 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_map using the specified
//! 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 last - first.
flat_multimap(std::initializer_list<value_type> il, const allocator_type& a)
: m_flat_tree(false, il.begin(), il.end(), 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 [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
+15 -5
View File
@@ -180,9 +180,16 @@ class flat_set
flat_set(std::initializer_list<value_type> il, const Compare& comp = Compare(),
const allocator_type& a = allocator_type())
: base_t(true, il.begin(), il.end(), comp, a)
{
{}
}
//! <b>Effects</b>: Constructs an empty container using the specified
//! 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().
flat_set(std::initializer_list<value_type> il, const allocator_type& a)
: base_t(true, il.begin(), il.end(), Compare(), a)
{}
//! <b>Effects</b>: Constructs an empty container using the specified comparison object and
//! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function
@@ -197,9 +204,7 @@ class flat_set
flat_set(ordered_unique_range_t, std::initializer_list<value_type> il,
const Compare& comp = Compare(), const allocator_type& a = allocator_type())
: base_t(ordered_range, il.begin(), il.end(), comp, a)
{
}
{}
#endif
//! <b>Effects</b>: Copy constructs the container.
@@ -946,6 +951,11 @@ class flat_multiset
: base_t(false, il.begin(), il.end(), comp, a)
{}
//! @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)
: base_t(false, il.begin(), il.end(), Compare(), a)
{}
//! @copydoc ::boost::container::flat_set::flat_set(ordered_unique_range_t, std::initializer_list<value_type>, const Compare& comp, const allocator_type&)
flat_multiset(ordered_unique_range_t, std::initializer_list<value_type> il,
const Compare& comp = Compare(), const allocator_type& a = allocator_type())
+44 -2
View File
@@ -143,8 +143,7 @@ class map
//! and allocator.
//!
//! <b>Complexity</b>: Constant.
explicit map(const Compare& comp,
const allocator_type& a = allocator_type())
explicit map(const Compare& comp, const allocator_type& a = allocator_type())
: base_t(comp, a)
{
//A type must be std::pair<CONST Key, T>
@@ -220,6 +219,28 @@ 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 [il.begin(), il.end()).
//!
//! <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().
map(std::initializer_list<value_type> il, const allocator_type& 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
//! 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.
//!
//! <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.
map(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(),
const allocator_type& a = allocator_type())
: base_t(ordered_range, il.begin(), il.end(), comp, a)
@@ -1038,6 +1059,27 @@ 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 [il.begin(), il.end()).
//!
//! <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().
multimap(std::initializer_list<value_type> il, const allocator_type& 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
//! allocator, 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.
multimap(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(),
const allocator_type& a = allocator_type())
: base_t(ordered_range, il.begin(), il.end(), comp, a)
+16 -2
View File
@@ -177,6 +177,15 @@ class set
: base_t(true, il.begin(), il.end(), comp, a)
{}
//! <b>Effects</b>: Constructs an empty set using the specified
//! 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().
set(std::initializer_list<value_type> il, const allocator_type& a)
: base_t(true, il.begin(), il.end(), Compare(), a)
{}
//! <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
//! is more efficient than the normal range creation for ordered ranges.
@@ -187,7 +196,8 @@ class set
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
set(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a = allocator_type())
set( ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare()
, const allocator_type& a = allocator_type())
: base_t(ordered_range, il.begin(), il.end(), comp, a)
{}
#endif
@@ -825,13 +835,17 @@ class multiset
: base_t(false, il.begin(), il.end(), comp, a)
{}
//! @copydoc ::boost::container::set::set(std::initializer_list<value_type>, const allocator_type&)
multiset(std::initializer_list<value_type> il, const allocator_type& 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&)
multiset(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a = allocator_type())
: base_t(ordered_range, il.begin(), il.end(), comp, a)
{}
#endif
//! @copydoc ::boost::container::set::set(const set &)
multiset(const multiset& x)
: base_t(static_cast<const base_t&>(x))