mirror of
https://github.com/boostorg/container.git
synced 2025-08-03 14:34:27 +02:00
small_vector's initializer list constructor was not implemented and tested.
This commit is contained in:
@@ -445,6 +445,7 @@ class small_vector : public small_vector_base<T, Allocator>
|
|||||||
|
|
||||||
typedef typename base_type::allocator_type allocator_type;
|
typedef typename base_type::allocator_type allocator_type;
|
||||||
typedef typename base_type::size_type size_type;
|
typedef typename base_type::size_type size_type;
|
||||||
|
typedef typename base_type::value_type value_type;
|
||||||
|
|
||||||
static std::size_t internal_capacity()
|
static std::size_t internal_capacity()
|
||||||
{ return (sizeof(small_vector) - storage_test::s_start)/sizeof(T); }
|
{ return (sizeof(small_vector) - storage_test::s_start)/sizeof(T); }
|
||||||
@@ -485,6 +486,14 @@ class small_vector : public small_vector_base<T, Allocator>
|
|||||||
: base_type(initial_capacity_t(), internal_capacity(), a)
|
: base_type(initial_capacity_t(), internal_capacity(), a)
|
||||||
{ this->move_construct_impl(other, a); }
|
{ this->move_construct_impl(other, a); }
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||||
|
small_vector(std::initializer_list<value_type> il, const allocator_type& a = allocator_type())
|
||||||
|
: base_type(initial_capacity_t(), internal_capacity(), a)
|
||||||
|
{
|
||||||
|
this->assign(il.begin(), il.end());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
small_vector& operator=(BOOST_COPY_ASSIGN_REF(small_vector) other)
|
small_vector& operator=(BOOST_COPY_ASSIGN_REF(small_vector) other)
|
||||||
{ return static_cast<small_vector&>(this->base_type::operator=(static_cast<base_type const&>(other))); }
|
{ return static_cast<small_vector&>(this->base_type::operator=(static_cast<base_type const&>(other))); }
|
||||||
|
|
||||||
|
@@ -167,9 +167,8 @@ int main()
|
|||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
// Initializer lists testing
|
// Initializer lists testing
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
if(!boost::container::test::test_vector_methods_with_initializer_list_as_argument_for<
|
if(!boost::container::test::test_vector_methods_with_initializer_list_as_argument_for
|
||||||
boost::container::vector<int>
|
< boost::container::small_vector<int, 5> >()) {
|
||||||
>()) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user