11#ifndef INCLUDED_BSLSTL_VECTOR_CPP03
12#define INCLUDED_BSLSTL_VECTOR_CPP03
63#ifdef COMPILING_BSLSTL_VECTOR_H
69template <
class VALUE_TYPE,
class ITERATOR>
70class vector_UintPtrConversionIterator;
97 static void swap(
void *a,
void *b);
116template <
class BSLSTL_ITERATOR,
118struct Vector_DeduceIteratorCategory {
121 typedef typename bsl::iterator_traits<BSLSTL_ITERATOR>::iterator_category
129template <
class BSLSTL_ITERATOR>
130struct Vector_DeduceIteratorCategory<BSLSTL_ITERATOR, true> {
133 typedef BloombergLP::bslmf::Nil
type;
147template <
class t_ITERATOR,
149 bool t_NOTSPECIALIZED =
152struct Vector_RangeIteratorCategory {
155#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
159 typedef bsl::conditional_t<
160 BloombergLP::bslstl::IteratorUtil
161 ::canCalculateInsertDistance<t_ITERATOR, t_SENTINEL>(),
162 typename bsl::iterator_traits<t_ITERATOR>::iterator_category,
163 std::input_iterator_tag>
type;
165 typedef typename bsl::iterator_traits<t_ITERATOR>::iterator_category
type;
173template <
class t_ITERATOR,
class t_SENTINEL>
174struct Vector_RangeIteratorCategory<t_ITERATOR, t_SENTINEL, true> {
177 typedef BloombergLP::bslmf::Nil
type;
195template <class TARGET, class ITERATOR, bool = is_integral<ITERATOR>::value>
196struct vector_ForwardIteratorForPtrs {
199 typedef ITERATOR
type;
206template <
class TARGET,
class ITERATOR>
207struct vector_ForwardIteratorForPtrs<TARGET, ITERATOR, false> {
210 typedef vector_UintPtrConversionIterator<TARGET *, ITERATOR>
type;
213#if defined(BSLS_ASSERT_SAFE_IS_USED)
215template <
class BSLSTL_ITERATOR>
216struct Vector_IsRandomAccessIterator :
217 bsl::is_same<typename Vector_DeduceIteratorCategory<BSLSTL_ITERATOR>::type,
218 bsl::random_access_iterator_tag>::type
237struct Vector_RangeCheck {
244 template <
class BSLSTL_ITERATOR,
class SENTINEL>
247 !Vector_IsRandomAccessIterator<BSLSTL_ITERATOR>::value,
bool>::type
248 isInvalidRange(BSLSTL_ITERATOR, SENTINEL);
254 template <
class BSLSTL_ITERATOR>
257 Vector_IsRandomAccessIterator<BSLSTL_ITERATOR>::value,
bool>::type
258 isInvalidRange(BSLSTL_ITERATOR first, BSLSTL_ITERATOR last);
259 template <
class BSLSTL_ITERATOR,
class SENTINEL>
262 Vector_IsRandomAccessIterator<BSLSTL_ITERATOR>::value,
bool>::type
263 isInvalidRange(BSLSTL_ITERATOR first, SENTINEL last);
281template <
class VALUE_TYPE>
288 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
320 void adopt(BloombergLP::bslmf::MovableRef<vectorBase> base);
476template <class VALUE_TYPE, class ALLOCATOR = allocator<VALUE_TYPE> >
478 , private BloombergLP::
bslalg::ContainerBase<ALLOCATOR> {
484 typedef BloombergLP::bslalg::ArrayPrimitives ArrayPrimitives;
488 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
492 typedef BloombergLP::bslma::AllocatorUtil AllocatorUtil;
496 typedef allocator_traits<ALLOCATOR> AllocatorTraits;
501 typedef ALLOCATOR allocator_type;
505 typedef typename AllocatorTraits::size_type
size_type;
507 typedef typename AllocatorTraits::pointer pointer;
508 typedef typename AllocatorTraits::const_pointer const_pointer;
519 typedef vectorBase<VALUE_TYPE> ImpBase;
523 typedef BloombergLP::bslalg::ContainerBase<ALLOCATOR> ContainerBase;
532 VALUE_TYPE *d_data_p;
533 std::size_t d_capacity;
534 ContainerBase *d_container_p;
538 Proctor(
const Proctor&);
539 Proctor& operator=(
const Proctor&);
548 Proctor(VALUE_TYPE *data,
549 std::size_t capacity,
550 ContainerBase *container);
568 template <
class t_RANGE,
class t_ITERATOR>
569 void privateConstruct(from_range_t ,
578 template <
class t_RANGE,
class t_ITERATOR>
579 void privateConstruct(from_range_t ,
582 std::forward_iterator_tag);
583 template <
class t_RANGE,
class t_ITERATOR>
584 void privateConstruct(from_range_t ,
587 std::input_iterator_tag);
597 template <
class FWD_ITER,
class SENTINEL>
598 void constructFromRange(FWD_ITER first,
600 std::forward_iterator_tag);
601 template <
class INPUT_ITER,
class SENTINEL>
602 void constructFromRange(INPUT_ITER first,
604 std::input_iterator_tag);
612 template <
class INTEGRAL>
613 void constructFromRange(INTEGRAL initialSize,
615 BloombergLP::bslmf::Nil);
621 template <
class t_ITERATOR,
class t_SENTINEL>
622 void constructFromSizedRange(t_ITERATOR first,
629 template <
class t_RANGE,
class t_ITERATOR>
632 template <
class t_RANGE,
class t_ITERATOR>
635 std::forward_iterator_tag);
636 template <
class t_RANGE,
class t_ITERATOR>
639 std::input_iterator_tag);
643 template <
class t_ITERATOR,
class t_SENTINEL>
644 void privateAppendSizedRange(t_ITERATOR
begin,
649 template <
class t_ITERATOR,
class t_SENTINEL>
650 void privateAppendUnsizedRange(t_ITERATOR
begin, t_SENTINEL
end);
653 template <
class INPUT_ITER>
654 void privateInsertDispatch(
658 BloombergLP::bslmf::MatchArithmeticType ,
659 BloombergLP::bslmf::Nil );
662 template <
class INPUT_ITER>
666 BloombergLP::bslmf::MatchAnyType ,
667 BloombergLP::bslmf::MatchAnyType );
670 template <
class t_ITERATOR,
class t_SENTINEL>
676 template <
class INPUT_ITER,
class SENTINEL>
680 const std::input_iterator_tag&);
684 template <
class FWD_ITER,
class SENTINEL>
688 const std::forward_iterator_tag&);
693 void privateMoveInsert(vector *fromVector,
699 void privateReserveEmpty(
size_type numElements);
701#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
704#ifndef BSLSTL_VECTOR_VARIADIC_LIMIT
705#define BSLSTL_VECTOR_VARIADIC_LIMIT 10
707#ifndef BSLSTL_VECTOR_VARIADIC_LIMIT_A
708#define BSLSTL_VECTOR_VARIADIC_LIMIT_A BSLSTL_VECTOR_VARIADIC_LIMIT
710#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 0
711 void privateEmplaceBackWithAllocation(
715#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 1
716 template <
class Args_01>
717 void privateEmplaceBackWithAllocation(
721#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 2
722 template <
class Args_01,
724 void privateEmplaceBackWithAllocation(
729#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 3
730 template <
class Args_01,
733 void privateEmplaceBackWithAllocation(
739#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 4
740 template <
class Args_01,
744 void privateEmplaceBackWithAllocation(
751#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 5
752 template <
class Args_01,
757 void privateEmplaceBackWithAllocation(
765#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 6
766 template <
class Args_01,
772 void privateEmplaceBackWithAllocation(
781#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 7
782 template <
class Args_01,
789 void privateEmplaceBackWithAllocation(
799#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 8
800 template <
class Args_01,
808 void privateEmplaceBackWithAllocation(
819#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 9
820 template <
class Args_01,
829 void privateEmplaceBackWithAllocation(
841#if BSLSTL_VECTOR_VARIADIC_LIMIT_A >= 10
842 template <
class Args_01,
852 void privateEmplaceBackWithAllocation(
868 template <
class... Args>
869 void privateEmplaceBackWithAllocation(
877 void privatePushBackWithAllocation(
const VALUE_TYPE& value);
884 void privatePushBackWithAllocation(
885 BloombergLP::bslmf::MovableRef<VALUE_TYPE> value);
919 const ALLOCATOR& basicAllocator = ALLOCATOR());
935 const VALUE_TYPE& value,
936 const ALLOCATOR& basicAllocator = ALLOCATOR());
960 template <class INPUT_ITER>
961 vector(INPUT_ITER first,
963 const ALLOCATOR& basicAllocator = ALLOCATOR());
972 template <class t_RANGE>
974 vector(from_range_t ,
976 const ALLOCATOR& basicAllocator =
986 vector(const vector& original);
993 vector(BloombergLP::
bslmf::MovableRef<vector> original)
1004 vector(const vector& original,
1005 const typename type_identity<ALLOCATOR>::type& basicAllocator);
1019 vector(BloombergLP::
bslmf::MovableRef<vector> original,
1020 const typename type_identity<ALLOCATOR>::type& basicAllocator);
1022#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1035 vector(std::initializer_list<VALUE_TYPE> values,
1036 const ALLOCATOR& basicAllocator = ALLOCATOR());
1053 vector& operator=(
const vector&
rhs);
1073 BloombergLP::bslmf::MovableRef<vector<VALUE_TYPE, ALLOCATOR> >
rhs)
1075 AllocatorTraits::propagate_on_container_move_assignment::value ||
1076 AllocatorTraits::is_always_equal::value);
1078#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1087 vector& operator=(std::initializer_list<VALUE_TYPE> values);
1096 void assign(std::initializer_list<VALUE_TYPE> values);
1114 template <
class INPUT_ITER>
1115 void assign(INPUT_ITER first, INPUT_ITER last);
1131 template <
class t_RANGE>
1177 void shrink_to_fit();
1186 template <
class t_RANGE>
1190#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1193#ifndef BSLSTL_VECTOR_VARIADIC_LIMIT
1194#define BSLSTL_VECTOR_VARIADIC_LIMIT 10
1196#ifndef BSLSTL_VECTOR_VARIADIC_LIMIT_B
1197#define BSLSTL_VECTOR_VARIADIC_LIMIT_B BSLSTL_VECTOR_VARIADIC_LIMIT
1199#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 0
1200 VALUE_TYPE &emplace_back(
1204#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 1
1205 template <
class Args_01>
1206 VALUE_TYPE &emplace_back(
1210#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 2
1211 template <
class Args_01,
1213 VALUE_TYPE &emplace_back(
1218#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 3
1219 template <
class Args_01,
1222 VALUE_TYPE &emplace_back(
1228#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 4
1229 template <
class Args_01,
1233 VALUE_TYPE &emplace_back(
1240#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 5
1241 template <
class Args_01,
1246 VALUE_TYPE &emplace_back(
1254#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 6
1255 template <
class Args_01,
1261 VALUE_TYPE &emplace_back(
1270#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 7
1271 template <
class Args_01,
1278 VALUE_TYPE &emplace_back(
1288#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 8
1289 template <
class Args_01,
1297 VALUE_TYPE &emplace_back(
1308#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 9
1309 template <
class Args_01,
1318 VALUE_TYPE &emplace_back(
1330#if BSLSTL_VECTOR_VARIADIC_LIMIT_B >= 10
1331 template <
class Args_01,
1341 VALUE_TYPE &emplace_back(
1357 template <
class... Args>
1358 VALUE_TYPE &emplace_back(
1368 void push_back(
const VALUE_TYPE& value);
1377 void push_back(BloombergLP::bslmf::MovableRef<VALUE_TYPE> value);
1384#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1387#ifndef BSLSTL_VECTOR_VARIADIC_LIMIT
1388#define BSLSTL_VECTOR_VARIADIC_LIMIT 10
1390#ifndef BSLSTL_VECTOR_VARIADIC_LIMIT_C
1391#define BSLSTL_VECTOR_VARIADIC_LIMIT_C BSLSTL_VECTOR_VARIADIC_LIMIT
1393#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 0
1401 const iterator& pos =
const_cast<const iterator&
>(position);
1405 maxSize - this->
size())) {
1407 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
1408 "vector<...>::emplace(pos,arguments): vector too long");
1412 if (newSize > this->d_capacity) {
1414 newSize, this->d_capacity, maxSize);
1415 vector temp(this->get_allocator());
1416 temp.privateReserveEmpty(newCapacity);
1418 ArrayPrimitives::destructiveMoveAndEmplace(
1421 this->d_dataBegin_p,
1424 this->allocatorRef());
1426 temp.d_dataEnd_p += newSize;
1430 ArrayPrimitives::emplace(
1433 this->allocatorRef());
1437 return this->
begin() + index;
1441#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 1
1442 template <
class Args_01>
1451 const iterator& pos =
const_cast<const iterator&
>(position);
1455 maxSize - this->
size())) {
1457 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
1458 "vector<...>::emplace(pos,arguments): vector too long");
1462 if (newSize > this->d_capacity) {
1464 newSize, this->d_capacity, maxSize);
1465 vector temp(this->get_allocator());
1466 temp.privateReserveEmpty(newCapacity);
1468 ArrayPrimitives::destructiveMoveAndEmplace(
1471 this->d_dataBegin_p,
1474 this->allocatorRef(),
1477 temp.d_dataEnd_p += newSize;
1481 ArrayPrimitives::emplace(
1484 this->allocatorRef(),
1489 return this->
begin() + index;
1493#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 2
1494 template <
class Args_01,
1505 const iterator& pos =
const_cast<const iterator&
>(position);
1509 maxSize - this->
size())) {
1511 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
1512 "vector<...>::emplace(pos,arguments): vector too long");
1516 if (newSize > this->d_capacity) {
1518 newSize, this->d_capacity, maxSize);
1519 vector temp(this->get_allocator());
1520 temp.privateReserveEmpty(newCapacity);
1522 ArrayPrimitives::destructiveMoveAndEmplace(
1525 this->d_dataBegin_p,
1528 this->allocatorRef(),
1532 temp.d_dataEnd_p += newSize;
1536 ArrayPrimitives::emplace(
1539 this->allocatorRef(),
1545 return this->
begin() + index;
1549#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 3
1550 template <
class Args_01,
1563 const iterator& pos =
const_cast<const iterator&
>(position);
1567 maxSize - this->
size())) {
1569 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
1570 "vector<...>::emplace(pos,arguments): vector too long");
1574 if (newSize > this->d_capacity) {
1576 newSize, this->d_capacity, maxSize);
1577 vector temp(this->get_allocator());
1578 temp.privateReserveEmpty(newCapacity);
1580 ArrayPrimitives::destructiveMoveAndEmplace(
1583 this->d_dataBegin_p,
1586 this->allocatorRef(),
1591 temp.d_dataEnd_p += newSize;
1595 ArrayPrimitives::emplace(
1598 this->allocatorRef(),
1605 return this->
begin() + index;
1609#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 4
1610 template <
class Args_01,
1625 const iterator& pos =
const_cast<const iterator&
>(position);
1629 maxSize - this->
size())) {
1631 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
1632 "vector<...>::emplace(pos,arguments): vector too long");
1636 if (newSize > this->d_capacity) {
1638 newSize, this->d_capacity, maxSize);
1639 vector temp(this->get_allocator());
1640 temp.privateReserveEmpty(newCapacity);
1642 ArrayPrimitives::destructiveMoveAndEmplace(
1645 this->d_dataBegin_p,
1648 this->allocatorRef(),
1654 temp.d_dataEnd_p += newSize;
1658 ArrayPrimitives::emplace(
1661 this->allocatorRef(),
1669 return this->
begin() + index;
1673#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 5
1674 template <
class Args_01,
1691 const iterator& pos =
const_cast<const iterator&
>(position);
1695 maxSize - this->
size())) {
1697 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
1698 "vector<...>::emplace(pos,arguments): vector too long");
1702 if (newSize > this->d_capacity) {
1704 newSize, this->d_capacity, maxSize);
1705 vector temp(this->get_allocator());
1706 temp.privateReserveEmpty(newCapacity);
1708 ArrayPrimitives::destructiveMoveAndEmplace(
1711 this->d_dataBegin_p,
1714 this->allocatorRef(),
1721 temp.d_dataEnd_p += newSize;
1725 ArrayPrimitives::emplace(
1728 this->allocatorRef(),
1737 return this->
begin() + index;
1741#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 6
1742 template <
class Args_01,
1761 const iterator& pos =
const_cast<const iterator&
>(position);
1765 maxSize - this->
size())) {
1767 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
1768 "vector<...>::emplace(pos,arguments): vector too long");
1772 if (newSize > this->d_capacity) {
1774 newSize, this->d_capacity, maxSize);
1775 vector temp(this->get_allocator());
1776 temp.privateReserveEmpty(newCapacity);
1778 ArrayPrimitives::destructiveMoveAndEmplace(
1781 this->d_dataBegin_p,
1784 this->allocatorRef(),
1792 temp.d_dataEnd_p += newSize;
1796 ArrayPrimitives::emplace(
1799 this->allocatorRef(),
1809 return this->
begin() + index;
1813#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 7
1814 template <
class Args_01,
1835 const iterator& pos =
const_cast<const iterator&
>(position);
1839 maxSize - this->
size())) {
1841 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
1842 "vector<...>::emplace(pos,arguments): vector too long");
1846 if (newSize > this->d_capacity) {
1848 newSize, this->d_capacity, maxSize);
1849 vector temp(this->get_allocator());
1850 temp.privateReserveEmpty(newCapacity);
1852 ArrayPrimitives::destructiveMoveAndEmplace(
1855 this->d_dataBegin_p,
1858 this->allocatorRef(),
1867 temp.d_dataEnd_p += newSize;
1871 ArrayPrimitives::emplace(
1874 this->allocatorRef(),
1885 return this->
begin() + index;
1889#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 8
1890 template <
class Args_01,
1913 const iterator& pos =
const_cast<const iterator&
>(position);
1917 maxSize - this->
size())) {
1919 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
1920 "vector<...>::emplace(pos,arguments): vector too long");
1924 if (newSize > this->d_capacity) {
1926 newSize, this->d_capacity, maxSize);
1927 vector temp(this->get_allocator());
1928 temp.privateReserveEmpty(newCapacity);
1930 ArrayPrimitives::destructiveMoveAndEmplace(
1933 this->d_dataBegin_p,
1936 this->allocatorRef(),
1946 temp.d_dataEnd_p += newSize;
1950 ArrayPrimitives::emplace(
1953 this->allocatorRef(),
1965 return this->
begin() + index;
1969#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 9
1970 template <
class Args_01,
1995 const iterator& pos =
const_cast<const iterator&
>(position);
1999 maxSize - this->
size())) {
2001 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
2002 "vector<...>::emplace(pos,arguments): vector too long");
2006 if (newSize > this->d_capacity) {
2008 newSize, this->d_capacity, maxSize);
2009 vector temp(this->get_allocator());
2010 temp.privateReserveEmpty(newCapacity);
2012 ArrayPrimitives::destructiveMoveAndEmplace(
2015 this->d_dataBegin_p,
2018 this->allocatorRef(),
2029 temp.d_dataEnd_p += newSize;
2033 ArrayPrimitives::emplace(
2036 this->allocatorRef(),
2049 return this->
begin() + index;
2053#if BSLSTL_VECTOR_VARIADIC_LIMIT_C >= 10
2054 template <
class Args_01,
2081 const iterator& pos =
const_cast<const iterator&
>(position);
2085 maxSize - this->
size())) {
2087 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
2088 "vector<...>::emplace(pos,arguments): vector too long");
2092 if (newSize > this->d_capacity) {
2094 newSize, this->d_capacity, maxSize);
2095 vector temp(this->get_allocator());
2096 temp.privateReserveEmpty(newCapacity);
2098 ArrayPrimitives::destructiveMoveAndEmplace(
2101 this->d_dataBegin_p,
2104 this->allocatorRef(),
2116 temp.d_dataEnd_p += newSize;
2120 ArrayPrimitives::emplace(
2123 this->allocatorRef(),
2137 return this->
begin() + index;
2144 template <
class... Args>
2153 const iterator& pos =
const_cast<const iterator&
>(position);
2157 maxSize - this->
size())) {
2159 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
2160 "vector<...>::emplace(pos,arguments): vector too long");
2164 if (newSize > this->d_capacity) {
2166 newSize, this->d_capacity, maxSize);
2167 vector temp(this->get_allocator());
2168 temp.privateReserveEmpty(newCapacity);
2170 ArrayPrimitives::destructiveMoveAndEmplace(
2173 this->d_dataBegin_p,
2176 this->allocatorRef(),
2179 temp.d_dataEnd_p += newSize;
2183 ArrayPrimitives::emplace(
2186 this->allocatorRef(),
2191 return this->
begin() + index;
2224 BloombergLP::bslmf::MovableRef<VALUE_TYPE> value);
2240 const VALUE_TYPE& value);
2263 template <
class INPUT_ITER>
2282 privateInsertDispatch(
2283 position, first, last, first, BloombergLP::bslmf::Nil());
2284 return this->
begin() + index;
2287#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2301 std::initializer_list<VALUE_TYPE> values);
2309 template <
class t_RANGE>
2350 AllocatorTraits::propagate_on_container_swap::value ||
2351 AllocatorTraits::is_always_equal::value);
2386template <class VALUE_TYPE, class ALLOCATOR>
2387bool operator==(const vector<VALUE_TYPE, ALLOCATOR>&
lhs,
2388 const vector<VALUE_TYPE, ALLOCATOR>&
rhs);
2390#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
2398template <
class VALUE_TYPE,
class ALLOCATOR>
2400 const vector<VALUE_TYPE, ALLOCATOR>&
rhs);
2403#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
2408template <
class VALUE_TYPE,
class ALLOCATOR>
2409BloombergLP::bslalg::SynthThreeWayUtil::Result<VALUE_TYPE> operator<=>(
2410 const vector<VALUE_TYPE, ALLOCATOR>&
lhs,
2411 const vector<VALUE_TYPE, ALLOCATOR>&
rhs);
2426template <
class VALUE_TYPE,
class ALLOCATOR>
2427bool operator<(
const vector<VALUE_TYPE, ALLOCATOR>&
lhs,
2428 const vector<VALUE_TYPE, ALLOCATOR>&
rhs);
2438template <
class VALUE_TYPE,
class ALLOCATOR>
2439bool operator>(
const vector<VALUE_TYPE, ALLOCATOR>&
lhs,
2440 const vector<VALUE_TYPE, ALLOCATOR>&
rhs);
2450template <
class VALUE_TYPE,
class ALLOCATOR>
2452 const vector<VALUE_TYPE, ALLOCATOR>&
rhs);
2462template <
class VALUE_TYPE,
class ALLOCATOR>
2464 const vector<VALUE_TYPE, ALLOCATOR>&
rhs);
2472template <
class VALUE_TYPE,
class ALLOCATOR,
class BDE_OTHER_TYPE>
2474erase(vector<VALUE_TYPE, ALLOCATOR>& vec,
const BDE_OTHER_TYPE& value);
2478template <
class VALUE_TYPE,
class ALLOCATOR,
class PREDICATE>
2480erase_if(vector<VALUE_TYPE, ALLOCATOR>& vec, PREDICATE predicate);
2496template <
class VALUE_TYPE,
class ALLOCATOR>
2497void swap(vector<VALUE_TYPE, ALLOCATOR>& a,
2498 vector<VALUE_TYPE, ALLOCATOR>& b)
2517template <
class VALUE_TYPE,
class ALLOCATOR>
2518class vector<VALUE_TYPE *, ALLOCATOR>
2522 typedef BloombergLP::bsls::Types::UintPtr UintPtr;
2523#if defined(BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES)
2524 typedef typename allocator_traits<ALLOCATOR>::
2525 template rebind_alloc<UintPtr> ImplAlloc;
2527 typedef typename ALLOCATOR::template rebind<UintPtr>::other ImplAlloc;
2529 typedef vector<UintPtr, ImplAlloc> Impl;
2530 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
2544 typedef ALLOCATOR allocator_type;
2545 typedef typename allocator_traits<ALLOCATOR>::pointer
2547 typedef typename allocator_traits<ALLOCATOR>::const_pointer
2560 const ALLOCATOR& basicAllocator = ALLOCATOR());
2564 const ALLOCATOR& basicAllocator = ALLOCATOR());
2566 template <class INPUT_ITER>
2567 vector(INPUT_ITER first,
2569 const ALLOCATOR& basicAllocator = ALLOCATOR());
2571 template <class t_RANGE>
2573 vector(from_range_t ,
2575 const ALLOCATOR& basicAllocator =
2578 vector(const vector& original);
2580 vector(BloombergLP::
bslmf::MovableRef<vector> original)
2583 vector(const vector& original,
2584 const typename type_identity<ALLOCATOR>::type& basicAllocator);
2586 vector(BloombergLP::
bslmf::MovableRef<vector> original,
2587 const typename type_identity<ALLOCATOR>::type& basicAllocator);
2590#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2591 vector(std::initializer_list<VALUE_TYPE *> values,
2592 const ALLOCATOR& basicAllocator = ALLOCATOR());
2598 vector& operator=(
const vector&
rhs);
2603 BloombergLP::bslmf::MovableRef<vector<VALUE_TYPE *, ALLOCATOR> >
rhs)
2605 d_impl = MoveUtil::move(MoveUtil::access(
rhs).d_impl)))
2607 d_impl = MoveUtil::move(MoveUtil::access(
rhs).d_impl);
2611#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2612 vector& operator=(std::initializer_list<VALUE_TYPE *> values);
2614 void assign(std::initializer_list<VALUE_TYPE *> values);
2618 template <
class INPUT_ITER>
2619 void assign(INPUT_ITER first, INPUT_ITER last);
2622 template <
class t_RANGE>
2648 void resize(
size_type newLength, VALUE_TYPE *value);
2651 void shrink_to_fit();
2655 template <class t_RANGE>
2661# if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
2662 template <
class ARG>
2668 void push_back(VALUE_TYPE *value);
2674# if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
2675 template <
class ARG>
2686 template <
class INPUT_ITER>
2694 typedef typename vector_ForwardIteratorForPtrs<VALUE_TYPE,
2695 INPUT_ITER>::type Iter;
2698 (
const UintPtr *)position, Iter(first), Iter(last));
2701#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2703 std::initializer_list<VALUE_TYPE *> values);
2706 template <
class t_RANGE>
2714 void swap(vector<VALUE_TYPE *, ALLOCATOR>& other)
2716 d_impl.swap(other.d_impl)));
2756 bool operator==(const vector&
lhs, const vector&
rhs)
2758 return lhs.d_impl ==
rhs.d_impl;
2761#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
2763 friend BloombergLP::bslalg::SynthThreeWayUtil::Result<Impl>
2764 operator<=>(
const vector&
lhs,
const vector&
rhs)
2766 return BloombergLP::bslalg::SynthThreeWayUtil::compare(
lhs.d_impl,
2775 return lhs.d_impl !=
rhs.d_impl;
2781 return lhs.d_impl <
rhs.d_impl;
2787 return lhs.d_impl >
rhs.d_impl;
2793 return lhs.d_impl <=
rhs.d_impl;
2799 return lhs.d_impl >=
rhs.d_impl;
2805 void swap(vector& a, vector& b)
2807 a.d_impl.swap(b.d_impl)))
2809 a.d_impl.swap(b.d_impl);
2813#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2825 class = bsl::enable_if_t<
2826 bsl::is_convertible_v<
2829 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
2831vector(SIZE_TYPE, VALUE, ALLOC *) -> vector<VALUE>;
2836 class INPUT_ITERATOR,
2838 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>
2840vector(INPUT_ITERATOR, INPUT_ITERATOR) -> vector<VALUE>;
2847 class INPUT_ITERATOR,
2850 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
2851 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
2853vector(INPUT_ITERATOR, INPUT_ITERATOR, ALLOCATOR) -> vector<VALUE, ALLOCATOR>;
2860 class INPUT_ITERATOR,
2863 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
2865 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
2867vector(INPUT_ITERATOR, INPUT_ITERATOR, ALLOC *)
2878 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
2880vector(std::initializer_list<VALUE>, ALLOC *)
2883#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
2886template <ranges::input_range t_RANGE,
2888 allocator<ranges::range_value_t<t_RANGE>>>
2889vector(from_range_t, t_RANGE&&, t_ALLOCATOR = t_ALLOCATOR())
2890-> vector<ranges::range_value_t<t_RANGE>, t_ALLOCATOR>;
2914template <
class VALUE_TYPE,
class ITERATOR>
2915class vector_UintPtrConversionIterator {
2923 typedef BloombergLP::bsls::Types::UintPtr UintPtr;
2925 typedef UintPtr value_type;
2926 typedef UintPtr *pointer;
2927 typedef UintPtr reference;
2928 typedef typename iterator_traits<ITERATOR>::difference_type
2930 typedef typename iterator_traits<ITERATOR>::iterator_category
2936 vector_UintPtrConversionIterator();
2939 vector_UintPtrConversionIterator(ITERATOR it);
2945 vector_UintPtrConversionIterator&
operator++();
2949 vector_UintPtrConversionIterator
operator++(
int);
2957#ifdef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
2966 operator<=>(
const vector_UintPtrConversionIterator& other)
const =
default;
2979 bool operator!=(
const vector_UintPtrConversionIterator& lhs,
2980 const vector_UintPtrConversionIterator& rhs)
2982 return lhs.d_iter !=
rhs.d_iter;
2996 bool operator==(
const vector_UintPtrConversionIterator& lhs,
2997 const vector_UintPtrConversionIterator& rhs)
2999 return lhs.d_iter ==
rhs.d_iter;
3009 bool operator<(
const vector_UintPtrConversionIterator& lhs,
3010 const vector_UintPtrConversionIterator& rhs)
3012 return lhs.d_iter <
rhs.d_iter;
3015#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
3016 bool operator==(bsl::sentinel_for<ITERATOR>
auto rhs)
const
3018 return d_iter ==
rhs;
3020 friend auto operator-(bsl::sentinel_for<ITERATOR>
auto s,
3021 vector_UintPtrConversionIterator i)
3022 requires random_access_iterator<ITERATOR>
3024 return s - i.d_iter;
3034 difference_type
operator-(
const vector_UintPtrConversionIterator& lhs,
3035 const vector_UintPtrConversionIterator& rhs)
3036#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
3037 requires requires {
lhs.d_iter -
rhs.d_iter; }
3040 return lhs.d_iter -
rhs.d_iter;
3049template <
class VALUE_TYPE,
class ITERATOR>
3056template <
class VALUE_TYPE,
class ITERATOR>
3065template <
class VALUE_TYPE,
class ITERATOR>
3067vector_UintPtrConversionIterator<VALUE_TYPE, ITERATOR>&
3068vector_UintPtrConversionIterator<VALUE_TYPE, ITERATOR>::operator++()
3074template <
class VALUE_TYPE,
class ITERATOR>
3076vector_UintPtrConversionIterator<VALUE_TYPE, ITERATOR>
3077vector_UintPtrConversionIterator<VALUE_TYPE, ITERATOR>::operator++(
int)
3079 vector_UintPtrConversionIterator tmp(*
this);
3085template <
class VALUE_TYPE,
class ITERATOR>
3087BloombergLP::bsls::Types::UintPtr
3088vector_UintPtrConversionIterator<VALUE_TYPE, ITERATOR>::operator*()
const
3090 VALUE_TYPE
const ptr = *d_iter;
3091 return reinterpret_cast<UintPtr
>(ptr);
3108template <
class t_VALUE_TYPE,
class t_ITERATOR,
class t_SENTINEL>
3109struct vector_UintPtrRangeAdapter {
3111 typedef vector_UintPtrConversionIterator<t_VALUE_TYPE,t_ITERATOR> iterator;
3112 typedef iterator const_iterator;
3119 iterator
begin()
const {
return iterator(d_begin); }
3120 t_SENTINEL
end()
const {
return d_end; }
3124template <
class t_VALUE_TYPE,
class t_ITERATOR,
class t_SENTINEL>
3126vector_UintPtrRangeAdapter<t_VALUE_TYPE, t_ITERATOR, t_SENTINEL>
3129 vector_UintPtrRangeAdapter<t_VALUE_TYPE, t_ITERATOR, t_SENTINEL> range =
3147template <
class VALUE_TYPE,
class ALLOCATOR>
3148class Vector_PushProctor {
3151 VALUE_TYPE *d_target_p;
3152 ALLOCATOR d_allocator;
3156 Vector_PushProctor(
const Vector_PushProctor&);
3157 Vector_PushProctor& operator=(
const Vector_PushProctor&);
3167 Vector_PushProctor(VALUE_TYPE *target,
const ALLOCATOR& allocator);
3173 ~Vector_PushProctor();
3187template <
class VALUE_TYPE,
class ALLOCATOR>
3189Vector_PushProctor<VALUE_TYPE,ALLOCATOR>::Vector_PushProctor(
3191 const ALLOCATOR& allocator)
3193, d_allocator(allocator)
3197template <
class VALUE_TYPE,
class ALLOCATOR>
3199Vector_PushProctor<VALUE_TYPE,ALLOCATOR>::~Vector_PushProctor()
3207template <
class VALUE_TYPE,
class ALLOCATOR>
3209void Vector_PushProctor<VALUE_TYPE,ALLOCATOR>::release()
3214#if defined(BSLS_ASSERT_SAFE_IS_USED)
3219template <
class BSLSTL_ITERATOR,
class SENTINEL>
3221typename enable_if<!Vector_IsRandomAccessIterator<BSLSTL_ITERATOR>::value,
3223Vector_RangeCheck::isInvalidRange(BSLSTL_ITERATOR, SENTINEL)
3228template <
class BSLSTL_ITERATOR>
3230typename enable_if<Vector_IsRandomAccessIterator<BSLSTL_ITERATOR>::value,
3232Vector_RangeCheck::isInvalidRange(BSLSTL_ITERATOR first, BSLSTL_ITERATOR last)
3234 return last < first;
3237template <
class BSLSTL_ITERATOR,
class SENTINEL>
3239typename enable_if<Vector_IsRandomAccessIterator<BSLSTL_ITERATOR>::value,
3241Vector_RangeCheck::isInvalidRange(BSLSTL_ITERATOR first, SENTINEL last)
3243 return last - first < 0;
3252template <
class VALUE_TYPE>
3254vectorBase<VALUE_TYPE>::vectorBase()
3263template <
class VALUE_TYPE>
3266vectorBase<VALUE_TYPE>::adopt(BloombergLP::bslmf::MovableRef<vectorBase> base)
3272 vectorBase& lvalue = base;
3273 d_dataBegin_p = lvalue.d_dataBegin_p;
3274 d_dataEnd_p = lvalue.d_dataEnd_p;
3275 d_capacity = lvalue.d_capacity;
3277 lvalue.d_dataBegin_p = 0;
3278 lvalue.d_dataEnd_p = 0;
3279 lvalue.d_capacity = 0;
3282template <
class VALUE_TYPE>
3284typename vectorBase<VALUE_TYPE>::iterator
3287 return d_dataBegin_p;
3290template <
class VALUE_TYPE>
3292typename vectorBase<VALUE_TYPE>::iterator
3298template <
class VALUE_TYPE>
3300typename vectorBase<VALUE_TYPE>::reverse_iterator
3303 return reverse_iterator(
end());
3306template <
class VALUE_TYPE>
3308typename vectorBase<VALUE_TYPE>::reverse_iterator
3311 return reverse_iterator(
begin());
3316template <
class VALUE_TYPE>
3318typename vectorBase<VALUE_TYPE>::reference
3319vectorBase<VALUE_TYPE>::operator[](size_type position)
3323 return d_dataBegin_p[position];
3326template <
class VALUE_TYPE>
3327typename vectorBase<VALUE_TYPE>::reference
3328vectorBase<VALUE_TYPE>::at(size_type position)
3332 BloombergLP::bslstl::StdExceptUtil::throwOutOfRange(
3333 "vector<...>::at(position): invalid position");
3335 return d_dataBegin_p[position];
3338template <
class VALUE_TYPE>
3340typename vectorBase<VALUE_TYPE>::reference
3341vectorBase<VALUE_TYPE>::front()
3345 return *d_dataBegin_p;
3348template <
class VALUE_TYPE>
3350typename vectorBase<VALUE_TYPE>::reference
3351vectorBase<VALUE_TYPE>::back()
3355 return *(d_dataEnd_p - 1);
3358template <
class VALUE_TYPE>
3363 return d_dataBegin_p;
3369template <
class VALUE_TYPE>
3371typename vectorBase<VALUE_TYPE>::const_iterator
3374 return d_dataBegin_p;
3377template <
class VALUE_TYPE>
3379typename vectorBase<VALUE_TYPE>::const_iterator
3382 return d_dataBegin_p;
3385template <
class VALUE_TYPE>
3387typename vectorBase<VALUE_TYPE>::const_iterator
3393template <
class VALUE_TYPE>
3395typename vectorBase<VALUE_TYPE>::const_iterator
3401template <
class VALUE_TYPE>
3403typename vectorBase<VALUE_TYPE>::const_reverse_iterator
3406 return const_reverse_iterator(
end());
3409template <
class VALUE_TYPE>
3411typename vectorBase<VALUE_TYPE>::const_reverse_iterator
3414 return const_reverse_iterator(
end());
3417template <
class VALUE_TYPE>
3419typename vectorBase<VALUE_TYPE>::const_reverse_iterator
3422 return const_reverse_iterator(
begin());
3425template <
class VALUE_TYPE>
3427typename vectorBase<VALUE_TYPE>::const_reverse_iterator
3430 return const_reverse_iterator(
begin());
3435template <
class VALUE_TYPE>
3437typename vectorBase<VALUE_TYPE>::size_type
3440 return d_dataEnd_p - d_dataBegin_p;
3443template <
class VALUE_TYPE>
3445typename vectorBase<VALUE_TYPE>::size_type
3451template <
class VALUE_TYPE>
3455 return d_dataEnd_p == d_dataBegin_p;
3459template <
class VALUE_TYPE>
3461typename vectorBase<VALUE_TYPE>::const_reference
3462vectorBase<VALUE_TYPE>::operator[](size_type position)
const
3466 return d_dataBegin_p[position];
3469template <
class VALUE_TYPE>
3470typename vectorBase<VALUE_TYPE>::const_reference
3471vectorBase<VALUE_TYPE>::at(size_type position)
const
3475 BloombergLP::bslstl::StdExceptUtil::throwOutOfRange(
3476 "const vector<...>::at(position): invalid position");
3478 return d_dataBegin_p[position];
3481template <
class VALUE_TYPE>
3483typename vectorBase<VALUE_TYPE>::const_reference
3484vectorBase<VALUE_TYPE>::front()
const
3488 return *d_dataBegin_p;
3491template <
class VALUE_TYPE>
3493typename vectorBase<VALUE_TYPE>::const_reference
3494vectorBase<VALUE_TYPE>::back()
const
3498 return *(d_dataEnd_p - 1);
3501template <
class VALUE_TYPE>
3506 return d_dataBegin_p;
3514template <
class VALUE_TYPE,
class ALLOCATOR>
3516vector<VALUE_TYPE, ALLOCATOR>::Proctor::Proctor(VALUE_TYPE *data,
3517 std::size_t capacity,
3518 ContainerBase *container)
3520, d_capacity(capacity)
3521, d_container_p(container)
3525template <
class VALUE_TYPE,
class ALLOCATOR>
3527vector<VALUE_TYPE, ALLOCATOR>::Proctor::~Proctor()
3529 using BloombergLP::bslma::AllocatorUtil;
3532 AllocatorUtil::deallocateObject(d_container_p->allocatorRef(),
3533 d_data_p, d_capacity);
3538template <
class VALUE_TYPE,
class ALLOCATOR>
3540void vector<VALUE_TYPE, ALLOCATOR>::Proctor::release()
3550template <
class VALUE_TYPE,
class ALLOCATOR>
3551template <
class t_RANGE,
class t_ITERATOR>
3553void vector<VALUE_TYPE, ALLOCATOR>::privateConstruct(
3560 ranges::end(range)));
3562 typedef typename Vector_DeduceIteratorCategory<t_ITERATOR>::type Tag;
3564 privateConstruct(from_range,
3570template <
class VALUE_TYPE,
class ALLOCATOR>
3571template <
class t_RANGE,
class t_ITERATOR>
3573void vector<VALUE_TYPE, ALLOCATOR>::privateConstruct(
3577 std::forward_iterator_tag)
3579#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
3580 if constexpr (ranges::sized_range<t_RANGE>) {
3581 constructFromSizedRange(begin,
3583 ranges::size(range));
3587 constructFromSizedRange(
3590 BloombergLP::bslstl::IteratorUtil::insertDistance(begin,
3591 ranges::end(range)));
3594template <
class VALUE_TYPE,
class ALLOCATOR>
3595template <
class t_RANGE,
class t_ITERATOR>
3597void vector<VALUE_TYPE, ALLOCATOR>::privateConstruct(
3601 std::input_iterator_tag)
3603#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
3604 if constexpr (ranges::sized_range<t_RANGE>) {
3605 constructFromSizedRange(begin,
3607 ranges::size(range));
3611 if (begin != ranges::end(range)) {
3612 constructFromRange(begin,
3614 std::input_iterator_tag());
3618template <
class VALUE_TYPE,
class ALLOCATOR>
3619template <
class FWD_ITER,
class SENTINEL>
3621void vector<VALUE_TYPE, ALLOCATOR>::constructFromRange(
3624 std::forward_iterator_tag)
3630 ::canCalculateInsertDistance<FWD_ITER, FWD_ITER>()));
3632 constructFromSizedRange(
3635 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
3638template <
class VALUE_TYPE,
class ALLOCATOR>
3639template <
class INPUT_ITER,
class SENTINEL>
3640void vector<VALUE_TYPE, ALLOCATOR>::constructFromRange(
3643 std::input_iterator_tag)
3653 vector temp(this->get_allocator());
3654 while (first != last) {
3655 temp.emplace_back(*first);
3658 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
3661template <
class VALUE_TYPE,
class ALLOCATOR>
3662template <
class INTEGRAL>
3663void vector<VALUE_TYPE, ALLOCATOR>::constructFromRange(
3664 INTEGRAL initialSize,
3666 BloombergLP::bslmf::Nil)
3677 static_cast<size_type
>(initialSize) > max_size())) {
3679 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3680 "vector<...>::(repeated-value constructor): input too long");
3683 if (initialSize > 0) {
3684 privateReserveEmpty(initialSize);
3685 Proctor proctor(this->d_dataBegin_p,
3687 static_cast<ContainerBase *
>(
this));
3689 ArrayPrimitives::uninitializedFillN(this->d_dataBegin_p,
3691 static_cast<VALUE_TYPE
>(value),
3692 this->allocatorRef());
3695 this->d_dataEnd_p += initialSize;
3699template <
class VALUE_TYPE,
class ALLOCATOR>
3700template <
class t_ITERATOR,
class t_SENTINEL>
3701void vector<VALUE_TYPE, ALLOCATOR>::constructFromSizedRange(t_ITERATOR first,
3709 const size_type maxSize = max_size();
3712 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3713 "vector<...>::(range-constructor): input too long");
3716 size_type newCapacity = Vector_Util::computeNewCapacity(size, 0, maxSize);
3717 this->privateReserveEmpty(newCapacity);
3718 Proctor proctor(this->d_dataBegin_p,
3720 static_cast<ContainerBase *
>(
this));
3722 ArrayPrimitives::copyConstruct(this->d_dataEnd_p,
3725 this->allocatorRef());
3727 this->d_dataEnd_p +=
size;
3730template <
class VALUE_TYPE,
class ALLOCATOR>
3731template <
class t_RANGE,
class t_ITERATOR>
3733void vector<VALUE_TYPE, ALLOCATOR>::privateAppendRange(
3739 typedef typename Vector_DeduceIteratorCategory<t_ITERATOR>::type Tag;
3745template <
class VALUE_TYPE,
class ALLOCATOR>
3746template <
class t_RANGE,
class t_ITERATOR>
3748void vector<VALUE_TYPE, ALLOCATOR>::privateAppendRange(
3751 std::forward_iterator_tag)
3753#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
3754 if constexpr (ranges::sized_range<t_RANGE>) {
3755 privateAppendSizedRange(begin,
3757 ranges::size(range));
3761 privateAppendSizedRange(
3764 BloombergLP::bslstl::IteratorUtil::insertDistance(begin,
3765 ranges::end(range)));
3768template <
class VALUE_TYPE,
class ALLOCATOR>
3769template <
class t_RANGE,
class t_ITERATOR>
3771void vector<VALUE_TYPE, ALLOCATOR>::privateAppendRange(
3774 std::input_iterator_tag)
3776#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
3777 if constexpr (ranges::sized_range<t_RANGE>) {
3778 privateAppendSizedRange(begin,
3780 ranges::size(range));
3785 privateAppendUnsizedRange(begin, ranges::end(range));
3789template <
class VALUE_TYPE,
class ALLOCATOR>
3790template <
class t_ITERATOR,
class t_SENTINEL>
3792void vector<VALUE_TYPE, ALLOCATOR>::privateAppendSizedRange(
3795 size_type rangeSize)
3797 if (rangeSize == 0) {
3801 size_type
size = this->size();
3802 size_type diff = max_size() -
size;
3805 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3806 "vector<...>::(range-constructor): input too long");
3810 if (size > this->capacity()) {
3814 ArrayPrimitives::copyConstruct(this->d_dataEnd_p,
3817 this->allocatorRef());
3818 this->d_dataEnd_p += rangeSize;
3821template <
class VALUE_TYPE,
class ALLOCATOR>
3822template <
class t_ITERATOR,
class t_SENTINEL>
3824void vector<VALUE_TYPE, ALLOCATOR>::privateAppendUnsizedRange(t_ITERATOR begin,
3828 emplace_back(*begin);
3832template <
class VALUE_TYPE,
class ALLOCATOR>
3833template <
class INPUT_ITER>
3835void vector<VALUE_TYPE, ALLOCATOR>::privateInsertDispatch(
3836 const_iterator position,
3839 BloombergLP::bslmf::MatchArithmeticType ,
3840 BloombergLP::bslmf::Nil )
3845 this->insert(position,
3846 static_cast<size_type
>(count),
3847 static_cast<VALUE_TYPE
>(value));
3850template <
class VALUE_TYPE,
class ALLOCATOR>
3851template <
class INPUT_ITER>
3853void vector<VALUE_TYPE, ALLOCATOR>::privateInsertDispatch(
3854 const_iterator position,
3857 BloombergLP::bslmf::MatchAnyType ,
3858 BloombergLP::bslmf::MatchAnyType )
3863 typedef typename Vector_RangeIteratorCategory<INPUT_ITER,INPUT_ITER>::type
3865 this->privateInsert(position, first, last, Tag());
3868template <
class VALUE_TYPE,
class ALLOCATOR>
3869template <
class t_ITERATOR,
class t_SENTINEL>
3871void vector<VALUE_TYPE, ALLOCATOR>::privateInsert(const_iterator position,
3875 typedef typename Vector_RangeIteratorCategory<t_ITERATOR, t_SENTINEL>::type
3877 this->privateInsert(position, first, last, Tag());
3880template <
class VALUE_TYPE,
class ALLOCATOR>
3881template <
class INPUT_ITER,
class SENTINEL>
3882void vector<VALUE_TYPE, ALLOCATOR>::privateInsert(
3883 const_iterator position,
3886 const std::input_iterator_tag&)
3900 if (first == last) {
3904 if (!this->capacity()) {
3905 privateReserveEmpty(size_type(1));
3906 position = this->d_dataBegin_p;
3909 size_type insertOffset = position - this->d_dataBegin_p;
3910 size_type initialEnd = this->size();
3911 size_type tailLength = this->end() - position;
3913 VALUE_TYPE *emplaceBegin = this->d_dataEnd_p;
3914 VALUE_TYPE *emplaceEnd = this->d_dataBegin_p + this->d_capacity;
3915 VALUE_TYPE *emplacePosition = emplaceBegin;
3917 allocator_type alloc(this->get_allocator());
3924 vector resultState(alloc);
3930 BloombergLP::bslma::AutoDestructor<VALUE_TYPE> insertProctor(
3932 while (emplacePosition != emplaceEnd) {
3933 AllocatorTraits::construct(alloc, emplacePosition, *first);
3936 if (++first == last) {
3937 this->d_dataEnd_p = emplacePosition;
3938 insertProctor.release();
3940 ArrayPrimitives::rotate(this->d_dataBegin_p + insertOffset,
3941 this->d_dataBegin_p + initialEnd,
3951 resultState.reserve(this->d_capacity*2);
3952 emplacePosition = resultState.d_dataBegin_p + insertOffset;
3953 ArrayPrimitives::destructiveMove(emplacePosition,
3958 size_type emplaceOffset = (emplaceEnd - emplaceBegin);
3959 insertProctor.reset(emplacePosition);
3960 emplaceBegin = emplacePosition;
3961 emplaceEnd = resultState.d_dataBegin_p + resultState.d_capacity
3963 emplacePosition += emplaceOffset;
3965 while (first != last) {
3966 if (emplacePosition == emplaceEnd) {
3968 vector nextResult(alloc);
3969 nextResult.reserve(resultState.d_capacity*2);
3970 emplacePosition = nextResult.d_dataBegin_p + insertOffset;
3971 ArrayPrimitives::destructiveMove(emplacePosition,
3976 insertProctor.reset(emplacePosition);
3977 emplaceOffset = (emplaceEnd - emplaceBegin);
3978 emplaceBegin = emplacePosition;
3979 emplaceEnd = nextResult.d_dataBegin_p + nextResult.d_capacity
3981 emplacePosition += emplaceOffset;
3983 Vector_Util::swap(&nextResult.d_dataBegin_p,
3984 &resultState.d_dataBegin_p);
3987 AllocatorTraits::construct(alloc, emplacePosition, *first);
3994 ArrayPrimitives::destructiveMove(emplacePosition,
3995 this->d_dataBegin_p + insertOffset,
3996 this->d_dataBegin_p + initialEnd,
4000 this->d_dataEnd_p = this->d_dataBegin_p + insertOffset;
4001 emplacePosition += (initialEnd - insertOffset);
4002 insertProctor.setLength(
4003 insertProctor.length() +
static_cast<int>(initialEnd - insertOffset));
4006 ArrayPrimitives::destructiveMove(resultState.d_dataBegin_p,
4007 this->d_dataBegin_p,
4008 this->d_dataBegin_p + insertOffset,
4014 resultState.d_dataEnd_p = emplacePosition;
4017 insertProctor.release();
4018 this->d_dataEnd_p = this->d_dataBegin_p;
4021 Vector_Util::swap(&this->d_dataBegin_p, &resultState.d_dataBegin_p);
4024template <
class VALUE_TYPE,
class ALLOCATOR>
4025template <
class FWD_ITER,
class SENTINEL>
4026void vector<VALUE_TYPE, ALLOCATOR>::privateInsert(
4027 const_iterator position,
4030 const std::forward_iterator_tag&)
4036 ::canCalculateInsertDistance<FWD_ITER, SENTINEL>()));
4038 const iterator& pos =
const_cast<iterator
>(position);
4040 const size_type maxSize = max_size();
4042 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last);
4046 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4047 "vector<...>::insert(pos,first,last): vector too long");
4050 const size_type newSize = this->size() + n;
4051 if (newSize > this->d_capacity) {
4052 size_type newCapacity = Vector_Util::computeNewCapacity(
4057 vector temp(this->get_allocator());
4058 temp.privateReserveEmpty(newCapacity);
4060 ArrayPrimitives::destructiveMoveAndInsert(temp.d_dataBegin_p,
4062 this->d_dataBegin_p,
4068 this->allocatorRef());
4069 temp.d_dataEnd_p += newSize;
4070 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4073 ArrayPrimitives::insert(pos,
4078 this->allocatorRef());
4079 this->d_dataEnd_p += n;
4083template <
class VALUE_TYPE,
class ALLOCATOR>
4084void vector<VALUE_TYPE, ALLOCATOR>::privateMoveInsert(
4086 const_iterator position)
4088 const iterator& pos =
const_cast<const iterator&
>(position);
4090 const size_type maxSize = max_size();
4091 const size_type n = fromVector->size();
4094 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4095 "vector<...>::insert(pos,first,last): vector too long");
4098 const size_type newSize = this->size() + n;
4099 if (newSize > this->d_capacity) {
4100 const size_type newCapacity = Vector_Util::computeNewCapacity(
4105 vector temp(this->get_allocator());
4106 temp.privateReserveEmpty(newCapacity);
4108 ArrayPrimitives::destructiveMoveAndMoveInsert(
4111 &fromVector->d_dataEnd_p,
4112 this->d_dataBegin_p,
4115 fromVector->d_dataBegin_p,
4116 fromVector->d_dataEnd_p,
4118 this->allocatorRef());
4119 temp.d_dataEnd_p += newSize;
4120 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4123 ArrayPrimitives::moveInsert(pos,
4125 &fromVector->d_dataEnd_p,
4126 fromVector->d_dataBegin_p,
4127 fromVector->d_dataEnd_p,
4129 this->allocatorRef());
4130 this->d_dataEnd_p += n;
4134template <
class VALUE_TYPE,
class ALLOCATOR>
4136void vector<VALUE_TYPE, ALLOCATOR>::privateReserveEmpty(size_type numElements)
4141 this->d_dataBegin_p = this->d_dataEnd_p =
4142 AllocatorUtil::allocateObject<VALUE_TYPE>(this->allocatorRef(),
4145 this->d_capacity = numElements;
4148#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
4151#ifndef BSLSTL_VECTOR_VARIADIC_LIMIT
4152#define BSLSTL_VECTOR_VARIADIC_LIMIT 10
4154#ifndef BSLSTL_VECTOR_VARIADIC_LIMIT_D
4155#define BSLSTL_VECTOR_VARIADIC_LIMIT_D BSLSTL_VECTOR_VARIADIC_LIMIT
4157#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 0
4158template <
class VALUE_TYPE,
class ALLOCATOR>
4159void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4164 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4165 "vector<...>:emplace_back(args...): vector too long");
4168 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4171 vector temp(this->get_allocator());
4172 temp.privateReserveEmpty(newCapacity);
4174 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4175 AllocatorTraits::construct(
4176 this->allocatorRef(),
4179 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4180 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4181 this->d_dataBegin_p,
4183 this->allocatorRef());
4186 this->d_dataEnd_p = this->d_dataBegin_p;
4187 temp.d_dataEnd_p = ++pos;
4188 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4192#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 1
4193template <
class VALUE_TYPE,
class ALLOCATOR>
4194template <
class Args_01>
4195void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4200 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4201 "vector<...>:emplace_back(args...): vector too long");
4204 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4207 vector temp(this->get_allocator());
4208 temp.privateReserveEmpty(newCapacity);
4210 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4211 AllocatorTraits::construct(
4212 this->allocatorRef(),
4216 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4217 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4218 this->d_dataBegin_p,
4220 this->allocatorRef());
4223 this->d_dataEnd_p = this->d_dataBegin_p;
4224 temp.d_dataEnd_p = ++pos;
4225 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4229#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 2
4230template <
class VALUE_TYPE,
class ALLOCATOR>
4231template <
class Args_01,
4233void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4239 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4240 "vector<...>:emplace_back(args...): vector too long");
4243 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4246 vector temp(this->get_allocator());
4247 temp.privateReserveEmpty(newCapacity);
4249 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4250 AllocatorTraits::construct(
4251 this->allocatorRef(),
4256 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4257 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4258 this->d_dataBegin_p,
4260 this->allocatorRef());
4263 this->d_dataEnd_p = this->d_dataBegin_p;
4264 temp.d_dataEnd_p = ++pos;
4265 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4269#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 3
4270template <
class VALUE_TYPE,
class ALLOCATOR>
4271template <
class Args_01,
4274void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4281 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4282 "vector<...>:emplace_back(args...): vector too long");
4285 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4288 vector temp(this->get_allocator());
4289 temp.privateReserveEmpty(newCapacity);
4291 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4292 AllocatorTraits::construct(
4293 this->allocatorRef(),
4299 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4300 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4301 this->d_dataBegin_p,
4303 this->allocatorRef());
4306 this->d_dataEnd_p = this->d_dataBegin_p;
4307 temp.d_dataEnd_p = ++pos;
4308 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4312#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 4
4313template <
class VALUE_TYPE,
class ALLOCATOR>
4314template <
class Args_01,
4318void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4326 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4327 "vector<...>:emplace_back(args...): vector too long");
4330 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4333 vector temp(this->get_allocator());
4334 temp.privateReserveEmpty(newCapacity);
4336 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4337 AllocatorTraits::construct(
4338 this->allocatorRef(),
4345 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4346 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4347 this->d_dataBegin_p,
4349 this->allocatorRef());
4352 this->d_dataEnd_p = this->d_dataBegin_p;
4353 temp.d_dataEnd_p = ++pos;
4354 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4358#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 5
4359template <
class VALUE_TYPE,
class ALLOCATOR>
4360template <
class Args_01,
4365void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4374 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4375 "vector<...>:emplace_back(args...): vector too long");
4378 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4381 vector temp(this->get_allocator());
4382 temp.privateReserveEmpty(newCapacity);
4384 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4385 AllocatorTraits::construct(
4386 this->allocatorRef(),
4394 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4395 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4396 this->d_dataBegin_p,
4398 this->allocatorRef());
4401 this->d_dataEnd_p = this->d_dataBegin_p;
4402 temp.d_dataEnd_p = ++pos;
4403 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4407#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 6
4408template <
class VALUE_TYPE,
class ALLOCATOR>
4409template <
class Args_01,
4415void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4425 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4426 "vector<...>:emplace_back(args...): vector too long");
4429 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4432 vector temp(this->get_allocator());
4433 temp.privateReserveEmpty(newCapacity);
4435 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4436 AllocatorTraits::construct(
4437 this->allocatorRef(),
4446 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4447 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4448 this->d_dataBegin_p,
4450 this->allocatorRef());
4453 this->d_dataEnd_p = this->d_dataBegin_p;
4454 temp.d_dataEnd_p = ++pos;
4455 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4459#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 7
4460template <
class VALUE_TYPE,
class ALLOCATOR>
4461template <
class Args_01,
4468void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4479 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4480 "vector<...>:emplace_back(args...): vector too long");
4483 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4486 vector temp(this->get_allocator());
4487 temp.privateReserveEmpty(newCapacity);
4489 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4490 AllocatorTraits::construct(
4491 this->allocatorRef(),
4501 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4502 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4503 this->d_dataBegin_p,
4505 this->allocatorRef());
4508 this->d_dataEnd_p = this->d_dataBegin_p;
4509 temp.d_dataEnd_p = ++pos;
4510 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4514#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 8
4515template <
class VALUE_TYPE,
class ALLOCATOR>
4516template <
class Args_01,
4524void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4536 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4537 "vector<...>:emplace_back(args...): vector too long");
4540 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4543 vector temp(this->get_allocator());
4544 temp.privateReserveEmpty(newCapacity);
4546 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4547 AllocatorTraits::construct(
4548 this->allocatorRef(),
4559 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4560 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4561 this->d_dataBegin_p,
4563 this->allocatorRef());
4566 this->d_dataEnd_p = this->d_dataBegin_p;
4567 temp.d_dataEnd_p = ++pos;
4568 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4572#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 9
4573template <
class VALUE_TYPE,
class ALLOCATOR>
4574template <
class Args_01,
4583void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4596 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4597 "vector<...>:emplace_back(args...): vector too long");
4600 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4603 vector temp(this->get_allocator());
4604 temp.privateReserveEmpty(newCapacity);
4606 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4607 AllocatorTraits::construct(
4608 this->allocatorRef(),
4620 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4621 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4622 this->d_dataBegin_p,
4624 this->allocatorRef());
4627 this->d_dataEnd_p = this->d_dataBegin_p;
4628 temp.d_dataEnd_p = ++pos;
4629 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4633#if BSLSTL_VECTOR_VARIADIC_LIMIT_D >= 10
4634template <
class VALUE_TYPE,
class ALLOCATOR>
4635template <
class Args_01,
4645void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4659 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4660 "vector<...>:emplace_back(args...): vector too long");
4663 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4666 vector temp(this->get_allocator());
4667 temp.privateReserveEmpty(newCapacity);
4669 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4670 AllocatorTraits::construct(
4671 this->allocatorRef(),
4684 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4685 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4686 this->d_dataBegin_p,
4688 this->allocatorRef());
4691 this->d_dataEnd_p = this->d_dataBegin_p;
4692 temp.d_dataEnd_p = ++pos;
4693 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4700template <
class VALUE_TYPE,
class ALLOCATOR>
4701template <
class... Args>
4702void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
4707 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4708 "vector<...>:emplace_back(args...): vector too long");
4711 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4714 vector temp(this->get_allocator());
4715 temp.privateReserveEmpty(newCapacity);
4717 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4718 AllocatorTraits::construct(
4719 this->allocatorRef(),
4723 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4724 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4725 this->d_dataBegin_p,
4727 this->allocatorRef());
4730 this->d_dataEnd_p = this->d_dataBegin_p;
4731 temp.d_dataEnd_p = ++pos;
4732 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4737template <
class VALUE_TYPE,
class ALLOCATOR>
4738void vector<VALUE_TYPE, ALLOCATOR>::privatePushBackWithAllocation(
4739 const VALUE_TYPE& value)
4743 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4744 "vector<...>:push_back(lvalue): vector too long");
4747 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4751 vector temp(this->get_allocator());
4752 temp.privateReserveEmpty(newCapacity);
4755 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4756 AllocatorTraits::construct(this->allocatorRef(), pos, value);
4760 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4761 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4762 this->d_dataBegin_p,
4764 this->allocatorRef());
4767 this->d_dataEnd_p = this->d_dataBegin_p;
4768 temp.d_dataEnd_p = ++pos;
4769 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4772template <
class VALUE_TYPE,
class ALLOCATOR>
4773void vector<VALUE_TYPE, ALLOCATOR>::privatePushBackWithAllocation(
4774 BloombergLP::bslmf::MovableRef<VALUE_TYPE> value)
4776 VALUE_TYPE& lvalue = value;
4779 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4780 "vector<...>:push_back(rvalue): vector too long");
4783 size_type newCapacity = Vector_Util::computeNewCapacity(this->size() + 1,
4787 vector temp(this->get_allocator());
4788 temp.privateReserveEmpty(newCapacity);
4791 VALUE_TYPE *pos = temp.d_dataBegin_p + this->size();
4792 AllocatorTraits::construct(this->allocatorRef(),
4794 MoveUtil::move(lvalue));
4798 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
4799 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
4800 this->d_dataBegin_p,
4802 this->allocatorRef());
4805 this->d_dataEnd_p = this->d_dataBegin_p;
4806 temp.d_dataEnd_p = ++pos;
4807 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
4814template <
class VALUE_TYPE,
class ALLOCATOR>
4817: vectorBase<VALUE_TYPE>()
4818, ContainerBase(ALLOCATOR())
4822template <
class VALUE_TYPE,
class ALLOCATOR>
4824vector<VALUE_TYPE, ALLOCATOR>::vector(
const ALLOCATOR& basicAllocator)
4826: vectorBase<VALUE_TYPE>()
4827, ContainerBase(basicAllocator)
4831template <
class VALUE_TYPE,
class ALLOCATOR>
4832vector<VALUE_TYPE, ALLOCATOR>::vector(size_type initialSize,
4833 const ALLOCATOR& basicAllocator)
4834: vectorBase<VALUE_TYPE>()
4835, ContainerBase(basicAllocator)
4839 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4840 "vector<...>::vector(n,v): vector too long");
4842 if (initialSize > 0) {
4843 privateReserveEmpty(initialSize);
4844 Proctor proctor(this->d_dataBegin_p,
4846 static_cast<ContainerBase *
>(
this));
4848 ArrayPrimitives::defaultConstruct(this->d_dataBegin_p,
4850 this->allocatorRef());
4853 this->d_dataEnd_p += initialSize;
4857template <
class VALUE_TYPE,
class ALLOCATOR>
4858vector<VALUE_TYPE, ALLOCATOR>::vector(size_type initialSize,
4859 const VALUE_TYPE& value,
4860 const ALLOCATOR& basicAllocator)
4861: vectorBase<VALUE_TYPE>()
4862, ContainerBase(basicAllocator)
4866 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
4867 "vector<...>::vector(n,v): vector too long");
4869 if (initialSize > 0) {
4870 privateReserveEmpty(initialSize);
4871 Proctor proctor(this->d_dataBegin_p,
4873 static_cast<ContainerBase *
>(
this));
4875 ArrayPrimitives::uninitializedFillN(this->d_dataBegin_p,
4878 this->allocatorRef());
4881 this->d_dataEnd_p += initialSize;
4885template <
class VALUE_TYPE,
class ALLOCATOR>
4886template <
class INPUT_ITER>
4888vector<VALUE_TYPE, ALLOCATOR>::vector(INPUT_ITER first,
4890 const ALLOCATOR& basicAllocator)
4891: vectorBase<VALUE_TYPE>()
4892, ContainerBase(basicAllocator)
4896 typedef typename Vector_RangeIteratorCategory<INPUT_ITER, INPUT_ITER>::type
4899 if (is_same<Tag, BloombergLP::bslmf::Nil>::value || first != last) {
4901 constructFromRange(first, last, Tag());
4905template <
class VALUE_TYPE,
class ALLOCATOR>
4906vector<VALUE_TYPE, ALLOCATOR>::vector(
const vector& original)
4907: vectorBase<VALUE_TYPE>()
4908, ContainerBase(AllocatorTraits::select_on_container_copy_construction(
4909 original.get_allocator()))
4911 if (original.size() > 0) {
4912 privateReserveEmpty(original.size());
4913 Proctor proctor(this->d_dataBegin_p,
4915 static_cast<ContainerBase *
>(
this));
4917 ArrayPrimitives::copyConstruct(this->d_dataBegin_p,
4920 this->allocatorRef());
4923 this->d_dataEnd_p += original.size();
4927template <
class VALUE_TYPE,
class ALLOCATOR>
4928vector<VALUE_TYPE, ALLOCATOR>::
4929vector(
const vector& original,
4930 const typename type_identity<ALLOCATOR>::type& basicAllocator)
4931: vectorBase<VALUE_TYPE>()
4932, ContainerBase(basicAllocator)
4934 if (original.size() > 0) {
4935 privateReserveEmpty(original.size());
4936 Proctor proctor(this->d_dataBegin_p,
4938 static_cast<ContainerBase *
>(
this));
4940 ArrayPrimitives::copyConstruct(this->d_dataBegin_p,
4943 this->allocatorRef());
4946 this->d_dataEnd_p += original.size();
4950template <
class VALUE_TYPE,
class ALLOCATOR>
4951vector<VALUE_TYPE, ALLOCATOR>::vector(
4952 BloombergLP::bslmf::MovableRef<vector> original)
4954: vectorBase<VALUE_TYPE>()
4955, ContainerBase(MoveUtil::access(original).get_allocator())
4957 vector& lvalue = original;
4958 ImpBase::adopt(MoveUtil::move(
static_cast<ImpBase&
>(lvalue)));
4961template <
class VALUE_TYPE,
class ALLOCATOR>
4962vector<VALUE_TYPE, ALLOCATOR>::vector(
4963 BloombergLP::bslmf::MovableRef<vector> original,
4964 const typename type_identity<ALLOCATOR>::type& basicAllocator)
4965: vectorBase<VALUE_TYPE>()
4966, ContainerBase(basicAllocator)
4968 vector& lvalue = original;
4971 lvalue.get_allocator())) {
4972 ImpBase::adopt(MoveUtil::move(
static_cast<ImpBase&
>(lvalue)));
4975 if (lvalue.size() > 0) {
4976 privateReserveEmpty(lvalue.size());
4977 Proctor proctor(this->d_dataBegin_p,
4979 static_cast<ContainerBase *
>(
this));
4981 ArrayPrimitives::moveConstruct(this->d_dataBegin_p,
4984 this->allocatorRef());
4987 this->d_dataEnd_p += lvalue.size();
4992#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
4993template <
class VALUE_TYPE,
class ALLOCATOR>
4995vector<VALUE_TYPE, ALLOCATOR>::vector(
4996 std::initializer_list<VALUE_TYPE> values,
4997 const ALLOCATOR& basicAllocator)
4998: vectorBase<VALUE_TYPE>()
4999, ContainerBase(basicAllocator)
5001 if (values.begin() != values.end()) {
5002 constructFromRange(values.begin(),
5004 std::random_access_iterator_tag());
5010template <
class VALUE_TYPE,
class ALLOCATOR>
5011template <
class t_RANGE>
5014vector<VALUE_TYPE, ALLOCATOR>::vector(
5017 const ALLOCATOR& basicAllocator)
5018: vectorBase<VALUE_TYPE>()
5019, ContainerBase(basicAllocator)
5021 privateConstruct(from_range,
5023 ranges::begin(range));
5026template <
class VALUE_TYPE,
class ALLOCATOR>
5028vector<VALUE_TYPE, ALLOCATOR>::~vector()
5030 using BloombergLP::bslalg::ArrayDestructionPrimitives;
5033#ifdef BSLS_PLATFORM_CMP_GNU
5034#pragma GCC diagnostic push
5035#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
5037 if (this->d_dataBegin_p) {
5038 ArrayDestructionPrimitives::destroy(this->d_dataBegin_p,
5040 this->allocatorRef());
5041 AllocatorUtil::deallocateObject(this->allocatorRef(),
5042 this->d_dataBegin_p, this->d_capacity);
5044#ifdef BSLS_PLATFORM_CMP_GNU
5045#pragma GCC diagnostic pop
5050template <
class VALUE_TYPE,
class ALLOCATOR>
5051vector<VALUE_TYPE, ALLOCATOR>&
5052vector<VALUE_TYPE, ALLOCATOR>::operator=(
const vector& rhs)
5055 AllocatorTraits::propagate_on_container_copy_assignment Propagate;
5058 if (Propagate::value) {
5059 vector other(rhs,
rhs.get_allocator());
5060 Vector_Util::swap(&this->d_dataBegin_p, &other.d_dataBegin_p);
5061 AllocatorUtil::swap(&this->allocatorRef(),
5062 &other.allocatorRef(),
5067 insert(this->begin(),
rhs.begin(),
rhs.end());
5073template <
class VALUE_TYPE,
class ALLOCATOR>
5074vector<VALUE_TYPE, ALLOCATOR>& vector<VALUE_TYPE, ALLOCATOR>::operator=(
5075 BloombergLP::bslmf::MovableRef<vector<VALUE_TYPE, ALLOCATOR> > rhs)
5077 AllocatorTraits::propagate_on_container_move_assignment::value ||
5078 AllocatorTraits::is_always_equal::value)
5081 AllocatorTraits::propagate_on_container_move_assignment Propagate;
5083 vector& lvalue =
rhs;
5085 if (get_allocator() == lvalue.get_allocator()) {
5086 vector other(MoveUtil::move(lvalue));
5087 Vector_Util::swap(&this->d_dataBegin_p, &other.d_dataBegin_p);
5089 else if (Propagate::value) {
5090 vector other(MoveUtil::move(lvalue));
5091 AllocatorUtil::swap(&this->allocatorRef(),
5092 &other.allocatorRef(),
5094 Vector_Util::swap(&this->d_dataBegin_p, &other.d_dataBegin_p);
5097 vector other(MoveUtil::move(lvalue), this->allocatorRef());
5098 Vector_Util::swap(&this->d_dataBegin_p, &other.d_dataBegin_p);
5104#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
5105template <
class VALUE_TYPE,
class ALLOCATOR>
5107vector<VALUE_TYPE, ALLOCATOR>&
5108vector<VALUE_TYPE, ALLOCATOR>::operator=(
5109 std::initializer_list<VALUE_TYPE> values)
5111 this->
assign(values.begin(), values.end());
5115template <
class VALUE_TYPE,
class ALLOCATOR>
5117void vector<VALUE_TYPE, ALLOCATOR>::assign(
5118 std::initializer_list<VALUE_TYPE> values)
5120 assign(values.begin(), values.end());
5124template <
class VALUE_TYPE,
class ALLOCATOR>
5125template <
class INPUT_ITER>
5127void vector<VALUE_TYPE, ALLOCATOR>::assign(INPUT_ITER first, INPUT_ITER last)
5132 insert(this->begin(), first, last);
5135template <
class VALUE_TYPE,
class ALLOCATOR>
5137void vector<VALUE_TYPE, ALLOCATOR>::assign(size_type numElements,
5138 const VALUE_TYPE& value)
5141 insert(this->begin(), numElements, value);
5144template <
class VALUE_TYPE,
class ALLOCATOR>
5145template <
class t_RANGE>
5147void vector<VALUE_TYPE, ALLOCATOR>::assign_range(
5156template <
class VALUE_TYPE,
class ALLOCATOR>
5157void vector<VALUE_TYPE, ALLOCATOR>::resize(size_type newSize)
5165 if (newSize <= this->
size()) {
5166 BloombergLP::bslalg::ArrayDestructionPrimitives::destroy(
5167 this->d_dataBegin_p + newSize,
5169 this->allocatorRef());
5170 this->d_dataEnd_p = this->d_dataBegin_p + newSize;
5172 else if (0 == this->d_capacity) {
5175 vector temp(newSize, this->get_allocator());
5176 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
5178 else if (newSize > this->d_capacity) {
5179 const size_type maxSize = max_size();
5182 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
5183 "vector<...>::resize(n): vector too long");
5186 size_type newCapacity = Vector_Util::computeNewCapacity(
5187 newSize, this->d_capacity, maxSize);
5189 vector temp(this->get_allocator());
5190 temp.privateReserveEmpty(newCapacity);
5192 ArrayPrimitives::destructiveMoveAndInsert(temp.d_dataBegin_p,
5194 this->d_dataBegin_p,
5197 newSize - this->size(),
5198 this->allocatorRef());
5200 temp.d_dataEnd_p += newSize;
5201 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
5204 ArrayPrimitives::defaultConstruct(this->d_dataEnd_p,
5205 newSize - this->size(),
5206 this->allocatorRef());
5207 this->d_dataEnd_p = this->d_dataBegin_p + newSize;
5211template <
class VALUE_TYPE,
class ALLOCATOR>
5212void vector<VALUE_TYPE, ALLOCATOR>::resize(size_type newSize,
5213 const VALUE_TYPE& value)
5218 if (newSize <= this->
size()) {
5219 BloombergLP::bslalg::ArrayDestructionPrimitives::destroy(
5220 this->d_dataBegin_p + newSize,
5222 this->allocatorRef());
5223 this->d_dataEnd_p = this->d_dataBegin_p + newSize;
5226 insert(this->d_dataEnd_p, newSize - this->size(), value);
5230template <
class VALUE_TYPE,
class ALLOCATOR>
5231void vector<VALUE_TYPE, ALLOCATOR>::reserve(size_type newCapacity)
5235 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
5236 "vector<...>::reserve(newCapacity): vector too long");
5238 if (0 == this->d_capacity && 0 != newCapacity) {
5239 privateReserveEmpty(newCapacity);
5241 else if (this->d_capacity < newCapacity) {
5242 vector temp(this->get_allocator());
5243 temp.privateReserveEmpty(newCapacity);
5245 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
5246 this->d_dataBegin_p,
5248 this->allocatorRef());
5250 temp.d_dataEnd_p += this->size();
5251 this->d_dataEnd_p = this->d_dataBegin_p;
5252 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
5256template <
class VALUE_TYPE,
class ALLOCATOR>
5257void vector<VALUE_TYPE, ALLOCATOR>::shrink_to_fit()
5259 if (this->size() < this->d_capacity) {
5260 vector temp(this->get_allocator());
5261 if (this->size() > 0) {
5262 temp.privateReserveEmpty(this->size());
5263 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
5264 this->d_dataBegin_p,
5266 this->allocatorRef());
5268 temp.d_dataEnd_p += this->size();
5269 this->d_dataEnd_p = this->d_dataBegin_p;
5271 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
5277template <
class VALUE_TYPE,
class ALLOCATOR>
5278template <
class t_RANGE>
5280void vector<VALUE_TYPE, ALLOCATOR>::append_range(
5284 ranges::begin(range));
5287#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
5290#ifndef BSLSTL_VECTOR_VARIADIC_LIMIT
5291#define BSLSTL_VECTOR_VARIADIC_LIMIT 10
5293#ifndef BSLSTL_VECTOR_VARIADIC_LIMIT_E
5294#define BSLSTL_VECTOR_VARIADIC_LIMIT_E BSLSTL_VECTOR_VARIADIC_LIMIT
5296#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 0
5297template <
class VALUE_TYPE,
class ALLOCATOR>
5300vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5304 AllocatorTraits::construct(
5305 this->allocatorRef(),
5307 ++this->d_dataEnd_p;
5310 privateEmplaceBackWithAllocation(
5313 return *(this->d_dataEnd_p - 1);
5317#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 1
5318template <
class VALUE_TYPE,
class ALLOCATOR>
5319template <
class Args_01>
5322vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5326 AllocatorTraits::construct(
5327 this->allocatorRef(),
5330 ++this->d_dataEnd_p;
5333 privateEmplaceBackWithAllocation(
5336 return *(this->d_dataEnd_p - 1);
5340#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 2
5341template <
class VALUE_TYPE,
class ALLOCATOR>
5342template <
class Args_01,
5346vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5351 AllocatorTraits::construct(
5352 this->allocatorRef(),
5356 ++this->d_dataEnd_p;
5359 privateEmplaceBackWithAllocation(
5363 return *(this->d_dataEnd_p - 1);
5367#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 3
5368template <
class VALUE_TYPE,
class ALLOCATOR>
5369template <
class Args_01,
5374vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5380 AllocatorTraits::construct(
5381 this->allocatorRef(),
5386 ++this->d_dataEnd_p;
5389 privateEmplaceBackWithAllocation(
5394 return *(this->d_dataEnd_p - 1);
5398#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 4
5399template <
class VALUE_TYPE,
class ALLOCATOR>
5400template <
class Args_01,
5406vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5413 AllocatorTraits::construct(
5414 this->allocatorRef(),
5420 ++this->d_dataEnd_p;
5423 privateEmplaceBackWithAllocation(
5429 return *(this->d_dataEnd_p - 1);
5433#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 5
5434template <
class VALUE_TYPE,
class ALLOCATOR>
5435template <
class Args_01,
5442vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5450 AllocatorTraits::construct(
5451 this->allocatorRef(),
5458 ++this->d_dataEnd_p;
5461 privateEmplaceBackWithAllocation(
5468 return *(this->d_dataEnd_p - 1);
5472#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 6
5473template <
class VALUE_TYPE,
class ALLOCATOR>
5474template <
class Args_01,
5482vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5491 AllocatorTraits::construct(
5492 this->allocatorRef(),
5500 ++this->d_dataEnd_p;
5503 privateEmplaceBackWithAllocation(
5511 return *(this->d_dataEnd_p - 1);
5515#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 7
5516template <
class VALUE_TYPE,
class ALLOCATOR>
5517template <
class Args_01,
5526vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5536 AllocatorTraits::construct(
5537 this->allocatorRef(),
5546 ++this->d_dataEnd_p;
5549 privateEmplaceBackWithAllocation(
5558 return *(this->d_dataEnd_p - 1);
5562#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 8
5563template <
class VALUE_TYPE,
class ALLOCATOR>
5564template <
class Args_01,
5574vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5585 AllocatorTraits::construct(
5586 this->allocatorRef(),
5596 ++this->d_dataEnd_p;
5599 privateEmplaceBackWithAllocation(
5609 return *(this->d_dataEnd_p - 1);
5613#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 9
5614template <
class VALUE_TYPE,
class ALLOCATOR>
5615template <
class Args_01,
5626vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5638 AllocatorTraits::construct(
5639 this->allocatorRef(),
5650 ++this->d_dataEnd_p;
5653 privateEmplaceBackWithAllocation(
5664 return *(this->d_dataEnd_p - 1);
5668#if BSLSTL_VECTOR_VARIADIC_LIMIT_E >= 10
5669template <
class VALUE_TYPE,
class ALLOCATOR>
5670template <
class Args_01,
5682vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5695 AllocatorTraits::construct(
5696 this->allocatorRef(),
5708 ++this->d_dataEnd_p;
5711 privateEmplaceBackWithAllocation(
5723 return *(this->d_dataEnd_p - 1);
5730template <
class VALUE_TYPE,
class ALLOCATOR>
5731template <
class... Args>
5734vector<VALUE_TYPE, ALLOCATOR>::emplace_back(
5738 AllocatorTraits::construct(
5739 this->allocatorRef(),
5742 ++this->d_dataEnd_p;
5745 privateEmplaceBackWithAllocation(
5748 return *(this->d_dataEnd_p - 1);
5753template <
class VALUE_TYPE,
class ALLOCATOR>
5755void vector<VALUE_TYPE, ALLOCATOR>::push_back(
const VALUE_TYPE& value)
5758 AllocatorTraits::construct(this->allocatorRef(),
5761 ++this->d_dataEnd_p;
5764 privatePushBackWithAllocation(value);
5768template <
class VALUE_TYPE,
class ALLOCATOR>
5770void vector<VALUE_TYPE, ALLOCATOR>::push_back(
5771 BloombergLP::bslmf::MovableRef<VALUE_TYPE> value)
5773 VALUE_TYPE& lvalue = value;
5775 AllocatorTraits::construct(this->allocatorRef(),
5777 MoveUtil::move(lvalue));
5778 ++this->d_dataEnd_p;
5781 privatePushBackWithAllocation(MoveUtil::move(lvalue));
5785template <
class VALUE_TYPE,
class ALLOCATOR>
5787void vector<VALUE_TYPE, ALLOCATOR>::pop_back()
5791 AllocatorTraits::destroy(this->allocatorRef(),
5792 --this->d_dataEnd_p);
5795template <
class VALUE_TYPE,
class ALLOCATOR>
5797typename vector<VALUE_TYPE, ALLOCATOR>::iterator
5798vector<VALUE_TYPE, ALLOCATOR>::insert(const_iterator position,
5799 const VALUE_TYPE& value)
5804 return insert(position, size_type(1), value);
5807template <
class VALUE_TYPE,
class ALLOCATOR>
5808typename vector<VALUE_TYPE, ALLOCATOR>::iterator
5809vector<VALUE_TYPE, ALLOCATOR>::insert(
5810 const_iterator position,
5811 BloombergLP::bslmf::MovableRef<VALUE_TYPE> value)
5816 const size_type maxSize = max_size();
5819 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
5820 "vector<...>::insert(pos,rv): vector too long");
5823 VALUE_TYPE& lvalue = value;
5825 const size_type index = position - this->begin();
5826 const iterator& pos =
const_cast<const iterator&
>(position);
5827 const size_type newSize = this->size() + 1;
5829 if (newSize > this->d_capacity) {
5830 size_type newCapacity = Vector_Util::computeNewCapacity(
5835 vector temp(this->get_allocator());
5836 temp.privateReserveEmpty(newCapacity);
5838 ArrayPrimitives::destructiveMoveAndEmplace(temp.d_dataBegin_p,
5840 this->d_dataBegin_p,
5843 this->allocatorRef(),
5844 MoveUtil::move(lvalue));
5846 temp.d_dataEnd_p += newSize;
5847 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
5850 ArrayPrimitives::insert(pos,
5852 MoveUtil::move(lvalue),
5853 this->allocatorRef());
5854 ++this->d_dataEnd_p;
5857 return this->begin() + index;
5860template <
class VALUE_TYPE,
class ALLOCATOR>
5861typename vector<VALUE_TYPE, ALLOCATOR>::iterator
5862vector<VALUE_TYPE, ALLOCATOR>::insert(const_iterator position,
5863 size_type numElements,
5864 const VALUE_TYPE& value)
5869 const size_type maxSize = max_size();
5871 numElements > maxSize - this->size())) {
5873 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
5874 "vector<...>::insert(pos,n,v): vector too long");
5877 const size_type index = position - this->begin();
5878 const iterator& pos =
const_cast<const iterator&
>(position);
5879 const size_type newSize = this->size() + numElements;
5881 if (newSize > this->d_capacity) {
5882 size_type newCapacity = Vector_Util::computeNewCapacity(
5887 vector temp(this->get_allocator());
5888 temp.privateReserveEmpty(newCapacity);
5890 ArrayPrimitives::destructiveMoveAndInsert(temp.d_dataBegin_p,
5892 this->d_dataBegin_p,
5897 this->allocatorRef());
5899 temp.d_dataEnd_p += newSize;
5900 Vector_Util::swap(&this->d_dataBegin_p, &temp.d_dataBegin_p);
5903 ArrayPrimitives::insert(pos,
5907 this->allocatorRef());
5908 this->d_dataEnd_p += numElements;
5910 return this->begin() + index;
5913#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
5914template <
class VALUE_TYPE,
class ALLOCATOR>
5916typename vector<VALUE_TYPE, ALLOCATOR>::iterator
5917vector<VALUE_TYPE, ALLOCATOR>::insert(
5918 const_iterator position,
5919 std::initializer_list<VALUE_TYPE> values)
5921 return insert(position, values.begin(), values.end());
5925template <
class VALUE_TYPE,
class ALLOCATOR>
5926template <
class t_RANGE>
5928typename vector<VALUE_TYPE, ALLOCATOR>::iterator
5929vector<VALUE_TYPE, ALLOCATOR>::insert_range(
5930 const_iterator position,
5936 if (position == this->
cend()) {
5937 const size_type oldSize = this->size();
5939 return this->begin() + oldSize;
5942 const size_type index = position - this->begin();
5943 this->privateInsert(position, ranges::begin(range), ranges::end(range));
5944 return this->begin() + index;
5947template <
class VALUE_TYPE,
class ALLOCATOR>
5949typename vector<VALUE_TYPE, ALLOCATOR>::iterator
5950vector<VALUE_TYPE, ALLOCATOR>::erase(const_iterator position)
5955 return erase(position, position + 1);
5961template <
class VALUE_TYPE,
class ALLOCATOR>
5963typename vector<VALUE_TYPE, ALLOCATOR>::iterator
5964vector<VALUE_TYPE, ALLOCATOR>::erase(const_iterator first, const_iterator last)
5971 const size_type n = last - first;
5972 ArrayPrimitives::erase(
const_cast<VALUE_TYPE *
>(first),
5973 const_cast<VALUE_TYPE *
>(last),
5975 this->allocatorRef());
5976 this->d_dataEnd_p -= n;
5977 return const_cast<VALUE_TYPE *
>(first);
5980template <
class VALUE_TYPE,
class ALLOCATOR>
5981void vector<VALUE_TYPE, ALLOCATOR>::swap(vector<VALUE_TYPE, ALLOCATOR>& other)
5983 AllocatorTraits::propagate_on_container_swap::value ||
5984 AllocatorTraits::is_always_equal::value)
5987 AllocatorTraits::propagate_on_container_swap Propagate;
5989 if (Propagate::value) {
5990 Vector_Util::swap(&this->d_dataBegin_p, &other.d_dataBegin_p);
5991 AllocatorUtil::swap(&this->allocatorRef(),
5992 &other.allocatorRef(),
5997 this->get_allocator() == other.get_allocator())) {
5998 Vector_Util::swap(&this->d_dataBegin_p, &other.d_dataBegin_p);
6003 vector toOtherCopy(MoveUtil::move(*
this),
6004 other.get_allocator());
6005 vector toThisCopy( MoveUtil::move(other),
6006 this->get_allocator());
6008 Vector_Util::swap(&toOtherCopy.d_dataBegin_p,
6009 &other.d_dataBegin_p);
6010 Vector_Util::swap(&toThisCopy. d_dataBegin_p,
6011 &this->d_dataBegin_p);
6016template <
class VALUE_TYPE,
class ALLOCATOR>
6020 if (!this->
empty()) {
6021 BloombergLP::bslalg::ArrayDestructionPrimitives::destroy(
6022 this->d_dataBegin_p,
6024 this->allocatorRef());
6025 this->d_dataEnd_p = this->d_dataBegin_p;
6030template <
class VALUE_TYPE,
class ALLOCATOR>
6032typename vector<VALUE_TYPE, ALLOCATOR>::allocator_type
6035 return this->allocatorRef();
6040template <
class VALUE_TYPE,
class ALLOCATOR>
6042typename vector<VALUE_TYPE, ALLOCATOR>::size_type
6045 return AllocatorTraits::max_size(this->allocatorRef());
6052template <
class VALUE_TYPE,
class ALLOCATOR>
6054bool operator==(
const vector<VALUE_TYPE, ALLOCATOR>& lhs,
6055 const vector<VALUE_TYPE, ALLOCATOR>& rhs)
6057 return BloombergLP::bslalg::RangeCompare::equal(
lhs.begin(),
6065#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
6066template <
class VALUE_TYPE,
class ALLOCATOR>
6068bool operator!=(
const vector<VALUE_TYPE, ALLOCATOR>& lhs,
6069 const vector<VALUE_TYPE, ALLOCATOR>& rhs)
6075#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
6077template <
class VALUE_TYPE,
class ALLOCATOR>
6079BloombergLP::bslalg::SynthThreeWayUtil::Result<VALUE_TYPE> operator<=>(
6080 const vector<VALUE_TYPE, ALLOCATOR>& lhs,
6081 const vector<VALUE_TYPE, ALLOCATOR>& rhs)
6083 return lexicographical_compare_three_way(
6088 BloombergLP::bslalg::SynthThreeWayUtil::compare);
6093template <
class VALUE_TYPE,
class ALLOCATOR>
6095bool operator< (
const vector<VALUE_TYPE, ALLOCATOR>& lhs,
6096 const vector<VALUE_TYPE, ALLOCATOR>& rhs)
6098 return 0 > BloombergLP::bslalg::RangeCompare::lexicographical(
lhs.begin(),
6106template <
class VALUE_TYPE,
class ALLOCATOR>
6108bool operator> (
const vector<VALUE_TYPE, ALLOCATOR>& lhs,
6109 const vector<VALUE_TYPE, ALLOCATOR>& rhs)
6114template <
class VALUE_TYPE,
class ALLOCATOR>
6116bool operator<=(
const vector<VALUE_TYPE, ALLOCATOR>& lhs,
6117 const vector<VALUE_TYPE, ALLOCATOR>& rhs)
6122template <
class VALUE_TYPE,
class ALLOCATOR>
6124bool operator>=(
const vector<VALUE_TYPE, ALLOCATOR>& lhs,
6125 const vector<VALUE_TYPE, ALLOCATOR>& rhs)
6136template <
class VALUE_TYPE,
class ALLOCATOR,
class BDE_OTHER_TYPE>
6137inline typename vector<VALUE_TYPE, ALLOCATOR>::size_type
6138erase(vector<VALUE_TYPE, ALLOCATOR>& vec,
const BDE_OTHER_TYPE& value)
6140 typename vector<VALUE_TYPE, ALLOCATOR>::size_type oldSize = vec.
size();
6141 vec.erase(bsl::remove(vec.begin(), vec.end(), value), vec.end());
6142 return oldSize - vec.size();
6145template <
class VALUE_TYPE,
class ALLOCATOR,
class PREDICATE>
6146inline typename vector<VALUE_TYPE, ALLOCATOR>::size_type
6147erase_if(vector<VALUE_TYPE, ALLOCATOR>& vec, PREDICATE predicate)
6149 typename vector<VALUE_TYPE, ALLOCATOR>::size_type oldSize = vec.
size();
6150 vec.erase(bsl::remove_if(vec.begin(), vec.end(), predicate), vec.end());
6151 return oldSize - vec.size();
6154template <
class VALUE_TYPE,
class ALLOCATOR>
6156void swap(vector<VALUE_TYPE, ALLOCATOR>& a,
6157 vector<VALUE_TYPE, ALLOCATOR>& b)
6165template <
class HASHALG,
class VALUE_TYPE,
class ALLOCATOR>
6167void hashAppend(HASHALG& hashAlg,
const vector<VALUE_TYPE, ALLOCATOR>& input)
6169 using ::BloombergLP::bslh::hashAppend;
6170 typedef typename vector<VALUE_TYPE, ALLOCATOR>::const_iterator ci_t;
6172 for (ci_t b = input.begin(), e = input.end(); b != e; ++b) {
6185template <
class VALUE_TYPE,
class ALLOCATOR>
6192template <
class VALUE_TYPE,
class ALLOCATOR>
6194vector<VALUE_TYPE *, ALLOCATOR>::vector(
const ALLOCATOR& basicAllocator)
6196: d_impl(ImplAlloc(basicAllocator))
6200template <
class VALUE_TYPE,
class ALLOCATOR>
6202vector<VALUE_TYPE *, ALLOCATOR>::vector(size_type initialSize,
6203 const ALLOCATOR& basicAllocator)
6204: d_impl(initialSize, ImplAlloc(basicAllocator))
6208template <
class VALUE_TYPE,
class ALLOCATOR>
6210vector<VALUE_TYPE *, ALLOCATOR>::vector(size_type initialSize,
6212 const ALLOCATOR& basicAllocator)
6213: d_impl(initialSize, (UintPtr) value, ImplAlloc(basicAllocator))
6217template <
class VALUE_TYPE,
class ALLOCATOR>
6218template <
class INPUT_ITER>
6220vector<VALUE_TYPE *, ALLOCATOR>::vector(INPUT_ITER first,
6222 const ALLOCATOR& basicAllocator)
6223: d_impl(typename vector_ForwardIteratorForPtrs<VALUE_TYPE, INPUT_ITER>::type(
6225 typename vector_ForwardIteratorForPtrs<VALUE_TYPE, INPUT_ITER>::type(
6231template <
class VALUE_TYPE,
class ALLOCATOR>
6232template <
class t_RANGE>
6235vector<VALUE_TYPE *, ALLOCATOR>::vector(
6238 const ALLOCATOR& basicAllocator)
6241 ranges::
end(range)),
6246template <
class VALUE_TYPE,
class ALLOCATOR>
6248vector<VALUE_TYPE *, ALLOCATOR>::vector(
const vector& original)
6249: d_impl(original.d_impl)
6253template <
class VALUE_TYPE,
class ALLOCATOR>
6255vector<VALUE_TYPE *, ALLOCATOR>::vector(
6256 BloombergLP::bslmf::MovableRef<vector> original)
6258: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl))
6262template <
class VALUE_TYPE,
class ALLOCATOR>
6264vector<VALUE_TYPE *, ALLOCATOR>::vector(
const vector& original,
6265 const typename type_identity<ALLOCATOR>::type& basicAllocator)
6266: d_impl(original.d_impl, ImplAlloc(basicAllocator))
6270template <
class VALUE_TYPE,
class ALLOCATOR>
6272vector<VALUE_TYPE *, ALLOCATOR>::vector(
6273 BloombergLP::bslmf::MovableRef<vector> original,
6274 const typename type_identity<ALLOCATOR>::type& basicAllocator)
6275: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl),
6276 ImplAlloc(basicAllocator))
6280#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
6281template <
class VALUE_TYPE,
class ALLOCATOR>
6283vector<VALUE_TYPE *, ALLOCATOR>::vector(
6284 std::initializer_list<VALUE_TYPE *> values,
6285 const ALLOCATOR& basicAllocator)
6286: d_impl(typename vector_ForwardIteratorForPtrs<
6288 typename
std::initializer_list<VALUE_TYPE *>::const_iterator>::
6289 type(values.
begin()),
6290 typename vector_ForwardIteratorForPtrs<
6292 typename
std::initializer_list<VALUE_TYPE *>::const_iterator>::
6299template <
class VALUE_TYPE,
class ALLOCATOR>
6301vector<VALUE_TYPE *, ALLOCATOR>::~vector()
6306template <
class VALUE_TYPE,
class ALLOCATOR>
6308vector<VALUE_TYPE *, ALLOCATOR>& vector<VALUE_TYPE *, ALLOCATOR>::operator=(
6311 d_impl =
rhs.d_impl;
6315#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
6316template <
class VALUE_TYPE,
class ALLOCATOR>
6318vector<VALUE_TYPE *, ALLOCATOR>& vector<VALUE_TYPE *, ALLOCATOR>::operator=(
6319 std::initializer_list<VALUE_TYPE *> values)
6325template <
class VALUE_TYPE,
class ALLOCATOR>
6327void vector<VALUE_TYPE *, ALLOCATOR>::assign(
6328 std::initializer_list<VALUE_TYPE *> values)
6330 typedef typename std::initializer_list<VALUE_TYPE *>::const_iterator
6333 typedef typename vector_ForwardIteratorForPtrs<VALUE_TYPE, InitIter>::type
6336 d_impl.assign(Iter(values.begin()), Iter(values.end()));
6340template <
class VALUE_TYPE,
class ALLOCATOR>
6341template <
class INPUT_ITER>
6343void vector<VALUE_TYPE *, ALLOCATOR>::assign(INPUT_ITER first, INPUT_ITER last)
6345 typedef typename vector_ForwardIteratorForPtrs<VALUE_TYPE,
6346 INPUT_ITER>::type Iter;
6348 d_impl.assign(Iter(first), Iter(last));
6351template <
class VALUE_TYPE,
class ALLOCATOR>
6353void vector<VALUE_TYPE *, ALLOCATOR>::assign(size_type numElements,
6356 d_impl.assign(numElements, (UintPtr) value);
6359template <
class VALUE_TYPE,
class ALLOCATOR>
6360template <
class t_RANGE>
6363void vector<VALUE_TYPE *, ALLOCATOR>::assign_range(
6366 d_impl.assign_range(
6367 vector_makeUintPtrRangeAdapter<VALUE_TYPE *>(ranges::begin(range),
6368 ranges::end(range)));
6373template <
class VALUE_TYPE,
class ALLOCATOR>
6375typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6378 return (iterator) d_impl.begin();
6381template <
class VALUE_TYPE,
class ALLOCATOR>
6383typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6386 return (iterator) d_impl.end();
6389template <
class VALUE_TYPE,
class ALLOCATOR>
6391typename vector<VALUE_TYPE *, ALLOCATOR>::reverse_iterator
6394 return reverse_iterator((iterator) d_impl.rbegin().base());
6397template <
class VALUE_TYPE,
class ALLOCATOR>
6399typename vector<VALUE_TYPE *, ALLOCATOR>::reverse_iterator
6402 return reverse_iterator((iterator) d_impl.rend().base());
6407template <
class VALUE_TYPE,
class ALLOCATOR>
6409typename vector<VALUE_TYPE *, ALLOCATOR>::size_type
6412 return d_impl.size();
6415template <
class VALUE_TYPE,
class ALLOCATOR>
6417typename vector<VALUE_TYPE *, ALLOCATOR>::size_type
6420 return d_impl.capacity();
6423template <
class VALUE_TYPE,
class ALLOCATOR>
6428 return d_impl.empty();
6433template <
class VALUE_TYPE,
class ALLOCATOR>
6435typename vector<VALUE_TYPE *, ALLOCATOR>::reference
6436vector<VALUE_TYPE *, ALLOCATOR>::operator[](size_type position)
6438 return (reference) d_impl.operator[](position);
6441template <
class VALUE_TYPE,
class ALLOCATOR>
6443typename vector<VALUE_TYPE *, ALLOCATOR>::reference
6444vector<VALUE_TYPE *, ALLOCATOR>::at(size_type position)
6446 return (reference) d_impl.at(position);
6449template <
class VALUE_TYPE,
class ALLOCATOR>
6451typename vector<VALUE_TYPE *, ALLOCATOR>::reference
6452vector<VALUE_TYPE *, ALLOCATOR>::front()
6454 return (reference) d_impl.front();
6457template <
class VALUE_TYPE,
class ALLOCATOR>
6459typename vector<VALUE_TYPE *, ALLOCATOR>::reference
6460vector<VALUE_TYPE *, ALLOCATOR>::back()
6462 return (reference) d_impl.back();
6465template <
class VALUE_TYPE,
class ALLOCATOR>
6469 return (VALUE_TYPE **) d_impl.data();
6474template <
class VALUE_TYPE,
class ALLOCATOR>
6476void vector<VALUE_TYPE *, ALLOCATOR>::resize(size_type newLength)
6478 d_impl.resize(newLength);
6481template <
class VALUE_TYPE,
class ALLOCATOR>
6483void vector<VALUE_TYPE *, ALLOCATOR>::resize(size_type newLength,
6486 d_impl.resize(newLength, (UintPtr) value);
6489template <
class VALUE_TYPE,
class ALLOCATOR>
6491void vector<VALUE_TYPE *, ALLOCATOR>::reserve(size_type newCapacity)
6493 d_impl.reserve(newCapacity);
6496template <
class VALUE_TYPE,
class ALLOCATOR>
6498void vector<VALUE_TYPE *, ALLOCATOR>::shrink_to_fit()
6500 d_impl.shrink_to_fit();
6506template <
class VALUE_TYPE,
class ALLOCATOR>
6507template <
class t_RANGE>
6510void vector<VALUE_TYPE *, ALLOCATOR>::append_range(
6513 d_impl.append_range(
6514 vector_makeUintPtrRangeAdapter<VALUE_TYPE *>(ranges::begin(range),
6515 ranges::end(range)));
6518template <
class VALUE_TYPE,
class ALLOCATOR>
6520typename vector<VALUE_TYPE *, ALLOCATOR>::reference
6521vector<VALUE_TYPE *, ALLOCATOR>::emplace_back()
6523 d_impl.emplace_back();
6527# if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
6528template <
class VALUE_TYPE,
class ALLOCATOR>
6531typename vector<VALUE_TYPE *, ALLOCATOR>::reference
6532vector<VALUE_TYPE *, ALLOCATOR>::emplace_back(ARG&& arg)
6534 VALUE_TYPE *ptr(arg);
6535 d_impl.emplace_back(
reinterpret_cast<UintPtr
>(ptr));
6539template <
class VALUE_TYPE,
class ALLOCATOR>
6541typename vector<VALUE_TYPE *, ALLOCATOR>::reference
6542vector<VALUE_TYPE *, ALLOCATOR>::emplace_back(VALUE_TYPE *ptr)
6544 d_impl.emplace_back(
reinterpret_cast<UintPtr
>(ptr));
6549template <
class VALUE_TYPE,
class ALLOCATOR>
6551void vector<VALUE_TYPE *, ALLOCATOR>::push_back(VALUE_TYPE *value)
6553 d_impl.emplace_back(
reinterpret_cast<UintPtr
>(value));
6556template <
class VALUE_TYPE,
class ALLOCATOR>
6558void vector<VALUE_TYPE *, ALLOCATOR>::pop_back()
6563template <
class VALUE_TYPE,
class ALLOCATOR>
6565typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6566vector<VALUE_TYPE *, ALLOCATOR>::emplace(const_iterator position)
6568 return (iterator) d_impl.emplace((
const UintPtr*) position);
6571# if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
6572template <
class VALUE_TYPE,
class ALLOCATOR>
6575typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6576vector<VALUE_TYPE *, ALLOCATOR>::emplace(const_iterator position, ARG&& arg)
6578 VALUE_TYPE *ptr(arg);
6579 return (iterator) d_impl.emplace((
const UintPtr *)position,
6580 reinterpret_cast<UintPtr
>(ptr));
6583template <
class VALUE_TYPE,
class ALLOCATOR>
6585typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6586vector<VALUE_TYPE *, ALLOCATOR>::emplace(const_iterator position,
6589 return (iterator) d_impl.emplace((
const UintPtr*) position,
6590 reinterpret_cast<UintPtr
>(ptr));
6594template <
class VALUE_TYPE,
class ALLOCATOR>
6596typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6597vector<VALUE_TYPE *, ALLOCATOR>::insert(const_iterator position,
6600 return (iterator) d_impl.emplace((
const UintPtr*) position,
6601 reinterpret_cast<UintPtr
>(value));
6604template <
class VALUE_TYPE,
class ALLOCATOR>
6606typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6607vector<VALUE_TYPE *, ALLOCATOR>::insert(const_iterator position,
6608 size_type numElements,
6611 return (iterator) d_impl.insert(
6612 (
const UintPtr *)position, numElements, (UintPtr)value);
6615#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
6616template <
class VALUE_TYPE,
class ALLOCATOR>
6618typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6619vector<VALUE_TYPE *, ALLOCATOR>::insert(
6620 const_iterator position,
6621 std::initializer_list<VALUE_TYPE *> values)
6623 typedef typename std::initializer_list<VALUE_TYPE *>::const_iterator
6626 typedef typename vector_ForwardIteratorForPtrs<VALUE_TYPE, InitIter>::type
6629 return (iterator) d_impl.insert(
6630 (
const UintPtr *)position, Iter(values.begin()), Iter(values.end()));
6634template <
class VALUE_TYPE,
class ALLOCATOR>
6635template <
class t_RANGE>
6638typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6639vector<VALUE_TYPE *, ALLOCATOR>::insert_range(
6640 const_iterator position,
6643 return (iterator) d_impl.insert_range(
6644 (
const UintPtr*) position,
6645 vector_makeUintPtrRangeAdapter<VALUE_TYPE *>(ranges::begin(range),
6646 ranges::end(range)));
6649template <
class VALUE_TYPE,
class ALLOCATOR>
6651typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6652vector<VALUE_TYPE *, ALLOCATOR>::erase(const_iterator position)
6654 return (iterator) d_impl.erase((
const UintPtr*) position);
6657template <
class VALUE_TYPE,
class ALLOCATOR>
6659typename vector<VALUE_TYPE *, ALLOCATOR>::iterator
6660vector<VALUE_TYPE *, ALLOCATOR>::erase(const_iterator first,
6661 const_iterator last)
6663 return (iterator) d_impl.erase((
const UintPtr*) first,
6664 (
const UintPtr*) last);
6667template <
class VALUE_TYPE,
class ALLOCATOR>
6669void vector<VALUE_TYPE *, ALLOCATOR>::swap(
6670 vector<VALUE_TYPE *, ALLOCATOR>& other)
6672 d_impl.swap(other.d_impl)))
6674 d_impl.swap(other.d_impl);
6677template <
class VALUE_TYPE,
class ALLOCATOR>
6685template <
class VALUE_TYPE,
class ALLOCATOR>
6687typename vector<VALUE_TYPE *, ALLOCATOR>::allocator_type
6690 return ALLOCATOR(d_impl.get_allocator());
6693template <
class VALUE_TYPE,
class ALLOCATOR>
6695typename vector<VALUE_TYPE *, ALLOCATOR>::size_type
6698 return d_impl.max_size();
6704template <
class VALUE_TYPE,
class ALLOCATOR>
6706typename vector<VALUE_TYPE *, ALLOCATOR>::const_iterator
6709 return (const_iterator) d_impl.begin();
6712template <
class VALUE_TYPE,
class ALLOCATOR>
6714typename vector<VALUE_TYPE *, ALLOCATOR>::const_iterator
6717 return (const_iterator) d_impl.cbegin();
6720template <
class VALUE_TYPE,
class ALLOCATOR>
6722typename vector<VALUE_TYPE *, ALLOCATOR>::const_iterator
6725 return (const_iterator) d_impl.end();
6728template <
class VALUE_TYPE,
class ALLOCATOR>
6730typename vector<VALUE_TYPE *, ALLOCATOR>::const_iterator
6733 return (const_iterator) d_impl.cend();
6736template <
class VALUE_TYPE,
class ALLOCATOR>
6738typename vector<VALUE_TYPE *, ALLOCATOR>::const_reverse_iterator
6741 return const_reverse_iterator((const_iterator) d_impl.rbegin().base());
6744template <
class VALUE_TYPE,
class ALLOCATOR>
6746typename vector<VALUE_TYPE *, ALLOCATOR>::const_reverse_iterator
6749 return const_reverse_iterator((const_iterator) d_impl.crbegin().base());
6752template <
class VALUE_TYPE,
class ALLOCATOR>
6754typename vector<VALUE_TYPE *, ALLOCATOR>::const_reverse_iterator
6757 return const_reverse_iterator((const_iterator) d_impl.rend().base());
6760template <
class VALUE_TYPE,
class ALLOCATOR>
6762typename vector<VALUE_TYPE *, ALLOCATOR>::const_reverse_iterator
6765 return const_reverse_iterator((const_iterator) d_impl.crend().base());
6771template <
class VALUE_TYPE,
class ALLOCATOR>
6773typename vector<VALUE_TYPE *, ALLOCATOR>::const_reference
6774vector<VALUE_TYPE *, ALLOCATOR>::operator[](size_type position)
const
6776 return (const_reference) d_impl.operator[](position);
6779template <
class VALUE_TYPE,
class ALLOCATOR>
6781typename vector<VALUE_TYPE *, ALLOCATOR>::const_reference
6782vector<VALUE_TYPE *, ALLOCATOR>::at(size_type position)
const
6784 return (const_reference) d_impl.at(position);
6787template <
class VALUE_TYPE,
class ALLOCATOR>
6789typename vector<VALUE_TYPE *, ALLOCATOR>::const_reference
6790vector<VALUE_TYPE *, ALLOCATOR>::front()
const
6792 return (const_reference) d_impl.front();
6795template <
class VALUE_TYPE,
class ALLOCATOR>
6797typename vector<VALUE_TYPE *, ALLOCATOR>::const_reference
6798vector<VALUE_TYPE *, ALLOCATOR>::back()
const
6800 return (const_reference) d_impl.back();
6803template <
class VALUE_TYPE,
class ALLOCATOR>
6805VALUE_TYPE *
const *vector<VALUE_TYPE *, ALLOCATOR>::data() const
6808 return (VALUE_TYPE *
const *) d_impl.data();
6829template <
class VALUE_TYPE,
class ALLOCATOR>
6837template <
class VALUE_TYPE,
class ALLOCATOR>
6838struct UsesBslmaAllocator<
bsl::vector<VALUE_TYPE, ALLOCATOR> >
6846template <
class VALUE_TYPE,
class ALLOCATOR>
6847struct IsBitwiseMoveable<
bsl::vector<VALUE_TYPE, ALLOCATOR> >
6848 : IsBitwiseMoveable<ALLOCATOR>
6855#ifdef BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE
6894# error Not valid except when included from bslstl_vector.h
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements contained by this deque.
Definition bslstl_deque.h:2241
Definition bslma_bslallocator.h:588
Definition bslstl_vector.h:924
VALUE_TYPE const & const_reference
Definition bslstl_vector.h:942
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this vector.
Definition bslstl_vector.h:3019
std::size_t d_capacity
Definition bslstl_vector.h:936
VALUE_TYPE * d_dataEnd_p
Definition bslstl_vector.h:935
void adopt(BloombergLP::bslmf::MovableRef< vectorBase > base)
Definition bslstl_vector.h:2847
iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2866
reference back()
Definition bslstl_vector.h:2932
size_type capacity() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:3027
std::ptrdiff_t difference_type
Definition bslstl_vector.h:946
VALUE_TYPE value_type
Definition bslstl_vector.h:940
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2977
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2961
VALUE_TYPE const * const_iterator
Definition bslstl_vector.h:944
std::size_t size_type
Definition bslstl_vector.h:945
const_reverse_iterator crend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:3009
reverse_iterator rbegin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2882
vectorBase()
Create an empty base object with no capacity.
Definition bslstl_vector.h:2835
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2874
VALUE_TYPE * d_dataBegin_p
Definition bslstl_vector.h:934
bsl::reverse_iterator< const_iterator > const_reverse_iterator
Definition bslstl_vector.h:948
reference at(size_type position)
Definition bslstl_vector.h:2909
VALUE_TYPE & reference
Definition bslstl_vector.h:941
bsl::reverse_iterator< iterator > reverse_iterator
Definition bslstl_vector.h:947
bool empty() const BSLS_KEYWORD_NOEXCEPT
Return true if this vector has size 0, and false otherwise.
Definition bslstl_vector.h:3034
reference front()
Definition bslstl_vector.h:2922
reverse_iterator rend() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2890
const_reverse_iterator crbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2993
VALUE_TYPE * iterator
Definition bslstl_vector.h:943
VALUE_TYPE * data() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2942
vector_UintPtrConversionIterator()
Create an uninitialized proxy iterator.
Definition bslstl_vector.h:2633
Definition bslstl_vector.h:1120
AllocatorTraits::size_type size_type
Definition bslstl_vector.h:1147
static const bool value
Definition bslmf_integralconstant.h:267
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_ASSERT_OPT(X)
Definition bsls_assert.h:2045
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
#define BSLS_KEYWORD_NOEXCEPT_OPERATOR(...)
Definition bsls_keyword.h:677
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:676
#define BSLSTL_VECTOR_REQUIRES_CONTAINER_COMPATIBLE_RANGE(R, T)
Definition bslstl_vector.h:691
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
bool operator<(const MetricId &lhs, const MetricId &rhs)
void resize(TYPE *array, int newSize)
bsl::size_t size(const TYPE &array)
Return the number of elements in the specified array.
int reserve(TYPE *array, int numElements)
int assign(LHS_TYPE *lhs, const RHS_TYPE &rhs)
bool operator>=(const Guid &lhs, const Guid &rhs)
FunctionOutputIterator< FUNCTION > & operator++(FunctionOutputIterator< FUNCTION > &iterator)
Do nothing and return specified iterator.
Definition bdlb_functionoutputiterator.h:408
void hashAppend(HASH_ALGORITHM &hashAlgorithm, const BigEndianInt16 &object)
bool operator<=(const Guid &lhs, const Guid &rhs)
bool operator>(const Guid &lhs, const Guid &rhs)
TransformIterator< FUNCTOR, ITERATOR > operator-(const TransformIterator< FUNCTOR, ITERATOR > &iterator, typename TransformIterator< FUNCTOR, ITERATOR >::difference_type offset)
Decimal32 operator*(Decimal32 lhs, Decimal32 rhs)
Definition bdlat_valuetypefunctions.h:939
T::const_iterator cend(const T &container)
Definition bslstl_iterator.h:1709
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
deque< VALUE_TYPE, ALLOCATOR >::size_type erase(deque< VALUE_TYPE, ALLOCATOR > &deq, const BDE_OTHER_TYPE &value)
Definition bslstl_deque.h:4424
T::iterator begin(T &container)
Definition bslstl_iterator.h:1593
const from_range_t from_range
ALLOCATOR & lhs
Definition bslstl_string.h:3917
T::iterator end(T &container)
Definition bslstl_iterator.h:1621
deque< VALUE_TYPE, ALLOCATOR >::size_type erase_if(deque< VALUE_TYPE, ALLOCATOR > &deq, PREDICATE predicate)
Definition bslstl_deque.h:4433
BSLS_KEYWORD_CONSTEXPR CONTAINER::value_type * data(CONTAINER &container)
Definition bslstl_iterator.h:1325
BSLS_KEYWORD_CONSTEXPR bool empty(const CONTAINER &container)
Definition bslstl_iterator.h:1377
vector_UintPtrRangeAdapter< t_VALUE_TYPE, t_ITERATOR, t_SENTINEL > vector_makeUintPtrRangeAdapter(t_ITERATOR begin, t_SENTINEL end)
Factory function for vector_UintPtrRangeAdapter.
Definition bslstl_vector.h:2708
Definition bdlc_flathashmap.h:2218
Definition baljsn_encoder_testtypes.h:76
Definition bdlbb_blob.h:579
Definition bdldfp_decimal.h:5549
bsl::iterator_traits< BSLSTL_ITERATOR >::iterator_category type
Definition bslstl_vector.h:764
bsl::iterator_traits< t_ITERATOR >::iterator_category type
Definition bslstl_vector.h:807
static std::size_t computeNewCapacity(std::size_t newLength, std::size_t capacity, std::size_t maxSize)
static void swap(void *a, void *b)
BloombergLP::bslma::AllocatorTraits_SizeType< ALLOCATOR_TYPE >::type size_type
Definition bslma_allocatortraits.h:1196
static void destroy(ALLOCATOR_TYPE &basicAllocator, ELEMENT_TYPE *elementAddr)
Definition bslma_allocatortraits.h:1549
Definition bslmf_enableif.h:530
Definition bslmf_isconvertible.h:875
Definition bslmf_issame.h:146
ITERATOR type
Definition bslstl_vector.h:841