mirror of
https://github.com/boostorg/container.git
synced 2025-08-02 05:54:28 +02:00
Use SFINAE in range constructors to detect iterators
This commit is contained in:
@@ -619,8 +619,18 @@ class deque : protected deque_base<Allocator>
|
||||
//! throws or T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: 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); }
|
||||
|
||||
//! <b>Effects</b>: Constructs a deque 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 copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: 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<Allocator>
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the range [first, last).
|
||||
template <class InIt>
|
||||
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<InIt, size_type>::value
|
||||
>::type * = 0
|
||||
, typename container_detail::disable_if_convertible
|
||||
<InIt, size_type>::type * = 0
|
||||
#endif
|
||||
)
|
||||
: Base(allocator_type())
|
||||
{
|
||||
this->priv_range_initialize(first, last);
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a deque that will use a copy of allocator a
|
||||
//! and inserts a copy of the range [first, last) in the deque.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor
|
||||
//! throws or T's constructor taking a dereferenced InIt throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the range [first, last).
|
||||
template <class InIt>
|
||||
deque(InIt first, InIt last, const allocator_type& a
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
, typename container_detail::disable_if_convertible
|
||||
<InIt, size_type>::type * = 0
|
||||
#endif
|
||||
)
|
||||
: Base(a)
|
||||
|
@@ -821,6 +821,23 @@ class vector
|
||||
(this->m_holder.alloc(), n, this->priv_raw_begin());
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
|
||||
//! and inserts n value initialized values.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's allocation
|
||||
//! throws or T's value initialization throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: 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());
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: 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());
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
|
||||
//! and inserts n value initialized values.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's allocation
|
||||
//! throws or T's value initialization throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: 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());
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
|
||||
//! and inserts n default initialized values.
|
||||
//!
|
||||
@@ -918,7 +918,11 @@ class vector
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the range [first, last).
|
||||
template <class InIt>
|
||||
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<InIt BOOST_MOVE_I size_type>::value
|
||||
BOOST_MOVE_I container_detail::nat >::type * = 0)
|
||||
)
|
||||
: m_holder()
|
||||
{ this->assign(first, last); }
|
||||
|
||||
@@ -930,7 +934,11 @@ class vector
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the range [first, last).
|
||||
template <class InIt>
|
||||
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<InIt BOOST_MOVE_I size_type>::value
|
||||
BOOST_MOVE_I container_detail::nat >::type * = 0)
|
||||
)
|
||||
: m_holder(a)
|
||||
{ this->assign(first, last); }
|
||||
|
||||
|
Reference in New Issue
Block a user