mirror of
https://github.com/boostorg/container.git
synced 2025-07-31 21:14:30 +02:00
Avoid using inheriting constructors and initializer_list::cbegin/cend to be nicer with older compilers
This commit is contained in:
@@ -351,9 +351,11 @@ class devector
|
||||
const size_type n = boost::container::iterator_distance(first, last);
|
||||
m_.buffer = n ? allocate(n) : pointer();
|
||||
m_.front_idx = 0u;
|
||||
//this->allocate(n) will take care of overflows
|
||||
m_.set_back_idx(n);
|
||||
m_.set_capacity(n);
|
||||
construct_from_range(first, last);
|
||||
//construct_from_range releases memory on failure
|
||||
this->construct_from_range(first, last);
|
||||
BOOST_ASSERT(invariants_ok());
|
||||
}
|
||||
|
||||
@@ -464,8 +466,18 @@ class devector
|
||||
* **Equivalent to**: `devector(il.begin(), il.end())` or `devector(il.begin(), il.end(), allocator)`.
|
||||
*/
|
||||
devector(const std::initializer_list<T>& il, const allocator_type& allocator = allocator_type())
|
||||
: devector(il.begin(), il.end(), allocator)
|
||||
{}
|
||||
: m_(allocator, pointer(), 0u, 0u, 0u)
|
||||
{
|
||||
const size_type n = il.size();
|
||||
m_.buffer = n ? allocate(n) : pointer();
|
||||
m_.front_idx = 0u;
|
||||
//this->allocate(n) will take care of overflows
|
||||
m_.set_back_idx(n);
|
||||
m_.set_capacity(n);
|
||||
//construct_from_range releases memory on failure
|
||||
this->construct_from_range(il.begin(), il.end());
|
||||
BOOST_ASSERT(invariants_ok());
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@@ -73,7 +73,7 @@ void print_range(std::ostream& out, Iterator b, Iterator e)
|
||||
template <typename Range>
|
||||
void print_range(std::ostream& out, const Range& range)
|
||||
{
|
||||
print_range(out, range.cbegin(), range.cend());
|
||||
print_range(out, range.begin(), range.end());
|
||||
}
|
||||
|
||||
template <typename Array, std::size_t N>
|
||||
|
Reference in New Issue
Block a user