diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp index f53f34a..fef28a1 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -619,8 +619,18 @@ class deque : protected deque_base //! throws or T's copy constructor throws. //! //! Complexity: Linear to n. - deque(size_type n, const value_type& value, - const allocator_type& a = allocator_type()) + deque(size_type n, const value_type& value) + : Base(n, allocator_type()) + { this->priv_fill_initialize(value); } + + //! Effects: Constructs a deque that will use a copy of allocator a + //! and inserts n copies of value. + //! + //! Throws: If allocator_type's default constructor + //! throws or T's copy constructor throws. + //! + //! Complexity: Linear to n. + deque(size_type n, const value_type& value, const allocator_type& a) : Base(n, a) { this->priv_fill_initialize(value); } @@ -632,11 +642,29 @@ class deque : protected deque_base //! //! Complexity: Linear to the range [first, last). template - deque(InIt first, InIt last, const allocator_type& a = allocator_type() + deque(InIt first, InIt last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < !container_detail::is_convertible::value - >::type * = 0 + , typename container_detail::disable_if_convertible + ::type * = 0 + #endif + ) + : Base(allocator_type()) + { + this->priv_range_initialize(first, last); + } + + //! Effects: Constructs a deque that will use a copy of allocator a + //! and inserts a copy of the range [first, last) in the deque. + //! + //! Throws: If allocator_type's default constructor + //! throws or T's constructor taking a dereferenced InIt throws. + //! + //! Complexity: Linear to the range [first, last). + template + deque(InIt first, InIt last, const allocator_type& a + #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , typename container_detail::disable_if_convertible + ::type * = 0 #endif ) : Base(a) diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index 3be2d3e..3e989f5 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -821,6 +821,23 @@ class vector (this->m_holder.alloc(), n, this->priv_raw_begin()); } + //! Effects: Constructs a vector that will use a copy of allocator a + //! and inserts n value initialized values. + //! + //! Throws: If allocator_type's allocation + //! throws or T's value initialization throws. + //! + //! Complexity: Linear to n. + explicit vector(size_type n, const allocator_type &a) + : m_holder(container_detail::uninitialized_size, a, n) + { + #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS + this->num_alloc += n != 0; + #endif + boost::container::uninitialized_value_init_alloc_n + (this->m_holder.alloc(), n, this->priv_raw_begin()); + } + //! Effects: Constructs a vector that will use a copy of allocator a //! and inserts n default initialized values. //! @@ -840,23 +857,6 @@ class vector (this->m_holder.alloc(), n, this->priv_raw_begin()); } - //! Effects: Constructs a vector that will use a copy of allocator a - //! and inserts n value initialized values. - //! - //! Throws: If allocator_type's allocation - //! throws or T's value initialization throws. - //! - //! Complexity: Linear to n. - explicit vector(size_type n, const allocator_type &a) - : m_holder(container_detail::uninitialized_size, a, n) - { - #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS - this->num_alloc += n != 0; - #endif - boost::container::uninitialized_value_init_alloc_n - (this->m_holder.alloc(), n, this->priv_raw_begin()); - } - //! Effects: Constructs a vector that will use a copy of allocator a //! and inserts n default initialized values. //! @@ -918,7 +918,11 @@ class vector //! //! Complexity: Linear to the range [first, last). template - vector(InIt first, InIt last) + vector(InIt first, InIt last + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_c + < container_detail::is_convertible::value + BOOST_MOVE_I container_detail::nat >::type * = 0) + ) : m_holder() { this->assign(first, last); } @@ -930,7 +934,11 @@ class vector //! //! Complexity: Linear to the range [first, last). template - vector(InIt first, InIt last, const allocator_type& a) + vector(InIt first, InIt last, const allocator_type& a + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_c + < container_detail::is_convertible::value + BOOST_MOVE_I container_detail::nat >::type * = 0) + ) : m_holder(a) { this->assign(first, last); }