8#ifndef INCLUDED_BSLSTL_VECTOR
9#define INCLUDED_BSLSTL_VECTOR
606#include <bslscm_version.h>
656#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
658#include <initializer_list>
661#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
666#if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
670# define COMPILING_BSLSTL_VECTOR_H
672# undef COMPILING_BSLSTL_VECTOR_H
679template <
class VALUE_TYPE,
class ITERATOR>
680class vector_UintPtrConversionIterator;
701 std::size_t capacity,
702 std::size_t maxSize);
706 static void swap(
void *a,
void *b);
723template <
class BSLSTL_ITERATOR,
728 typedef typename bsl::iterator_traits<BSLSTL_ITERATOR>::iterator_category
736template <
class BSLSTL_ITERATOR>
740 typedef BloombergLP::bslmf::Nil
type;
757template <class TARGET, class ITERATOR, bool = is_integral<ITERATOR>::value>
768template <
class TARGET,
class ITERATOR>
775#if defined(BSLS_ASSERT_SAFE_IS_USED)
777template <
class BSLSTL_ITERATOR>
778struct Vector_IsRandomAccessIterator :
779 bsl::is_same<typename Vector_DeduceIteratorCategory<BSLSTL_ITERATOR>::type,
780 bsl::random_access_iterator_tag>::type
789struct Vector_RangeCheck {
799 template <
class BSLSTL_ITERATOR>
802 !Vector_IsRandomAccessIterator<BSLSTL_ITERATOR>::value,
bool>::type
803 isInvalidRange(BSLSTL_ITERATOR, BSLSTL_ITERATOR);
807 template <
class BSLSTL_ITERATOR>
810 Vector_IsRandomAccessIterator<BSLSTL_ITERATOR>::value,
bool>::type
811 isInvalidRange(BSLSTL_ITERATOR first, BSLSTL_ITERATOR last);
833template <
class VALUE_TYPE>
840 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
871 void adopt(BloombergLP::bslmf::MovableRef<vectorBase> base);
1023template <class VALUE_TYPE, class ALLOCATOR =
allocator<VALUE_TYPE> >
1025 , private BloombergLP::
bslalg::ContainerBase<ALLOCATOR> {
1031 typedef BloombergLP::bslalg::ArrayPrimitives ArrayPrimitives;
1035 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
1039 typedef BloombergLP::bslma::AllocatorUtil AllocatorUtil;
1070 typedef BloombergLP::bslalg::ContainerBase<ALLOCATOR> ContainerBase;
1079 VALUE_TYPE *d_data_p;
1080 std::size_t d_capacity;
1081 ContainerBase *d_container_p;
1085 Proctor(
const Proctor&);
1086 Proctor& operator=(
const Proctor&);
1095 Proctor(VALUE_TYPE *
data,
1096 std::size_t capacity,
1097 ContainerBase *container);
1117 template <
class FWD_ITER>
1118 void constructFromRange(FWD_ITER first,
1120 std::forward_iterator_tag);
1121 template <
class INPUT_ITER>
1122 void constructFromRange(INPUT_ITER first,
1124 std::input_iterator_tag);
1132 template <
class INTEGRAL>
1133 void constructFromRange(INTEGRAL initialSize,
1135 BloombergLP::bslmf::Nil);
1139 template <
class INPUT_ITER>
1140 void privateInsertDispatch(
1144 BloombergLP::bslmf::MatchArithmeticType ,
1145 BloombergLP::bslmf::Nil );
1148 template <
class INPUT_ITER>
1152 BloombergLP::bslmf::MatchAnyType ,
1153 BloombergLP::bslmf::MatchAnyType );
1156 template <
class INPUT_ITER>
1160 const std::input_iterator_tag&);
1164 template <
class FWD_ITER>
1168 const std::forward_iterator_tag&);
1173 void privateMoveInsert(
vector *fromVector,
1178 void privateReserveEmpty(
size_type numElements);
1180#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
1188 template <
class... Args>
1189 void privateEmplaceBackWithAllocation(Args&&...arguments);
1195 void privatePushBackWithAllocation(
const VALUE_TYPE& value);
1202 void privatePushBackWithAllocation(
1203 BloombergLP::bslmf::MovableRef<VALUE_TYPE> value);
1235 const ALLOCATOR& basicAllocator = ALLOCATOR());
1250 const VALUE_TYPE& value,
1251 const ALLOCATOR& basicAllocator = ALLOCATOR());
1273 template <class INPUT_ITER>
1276 const ALLOCATOR& basicAllocator = ALLOCATOR());
1303 const typename
type_identity<ALLOCATOR>::type& basicAllocator);
1317 const typename
type_identity<ALLOCATOR>::type& basicAllocator);
1319#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1320 vector(std::initializer_list<VALUE_TYPE> values,
1321 const ALLOCATOR& basicAllocator = ALLOCATOR());
1354 AllocatorTraits::propagate_on_container_move_assignment::value ||
1355 AllocatorTraits::is_always_equal::value);
1373#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1382 vector& operator=(std::initializer_list<VALUE_TYPE> values);
1391 void assign(std::initializer_list<VALUE_TYPE> values);
1408 template <
class INPUT_ITER>
1409 void assign(INPUT_ITER first, INPUT_ITER last);
1465#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
1477 template <
class... Args>
1495 void push_back(BloombergLP::bslmf::MovableRef<VALUE_TYPE> value);
1501#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
1519 template <
class... Args>
1527 const iterator& pos =
const_cast<const iterator&
>(position);
1531 maxSize - this->
size())) {
1533 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
1534 "vector<...>::emplace(pos,arguments): vector too long");
1538 if (newSize > this->d_capacity) {
1540 newSize, this->d_capacity, maxSize);
1541 vector temp(this->get_allocator());
1542 temp.privateReserveEmpty(newCapacity);
1544 ArrayPrimitives::destructiveMoveAndEmplace(
1547 this->d_dataBegin_p,
1550 this->allocatorRef(),
1557 ArrayPrimitives::emplace(
1560 this->allocatorRef(),
1565 return this->
begin() + index;
1595 BloombergLP::bslmf::MovableRef<VALUE_TYPE> value);
1610 const VALUE_TYPE& value);
1632 template <
class INPUT_ITER>
1651 privateInsertDispatch(
1652 position, first, last, first, BloombergLP::bslmf::Nil());
1653 return this->
begin() + index;
1656#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1669 std::initializer_list<VALUE_TYPE> values);
1692 AllocatorTraits::propagate_on_container_swap::value ||
1693 AllocatorTraits::is_always_equal::value);
1741template <class VALUE_TYPE, class ALLOCATOR>
1742bool operator==(const
vector<VALUE_TYPE, ALLOCATOR>& lhs,
1743 const
vector<VALUE_TYPE, ALLOCATOR>& rhs);
1745#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
1746template <
class VALUE_TYPE,
class ALLOCATOR>
1759#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
1764template <
class VALUE_TYPE,
class ALLOCATOR>
1765BloombergLP::bslalg::SynthThreeWayUtil::Result<VALUE_TYPE> operator<=>(
1771template <
class VALUE_TYPE,
class ALLOCATOR>
1786template <
class VALUE_TYPE,
class ALLOCATOR>
1797template <
class VALUE_TYPE,
class ALLOCATOR>
1808template <
class VALUE_TYPE,
class ALLOCATOR>
1825template <
class VALUE_TYPE,
class ALLOCATOR,
class BDE_OTHER_TYPE>
1831template <
class VALUE_TYPE,
class ALLOCATOR,
class PREDICATE>
1835template <
class VALUE_TYPE,
class ALLOCATOR>
1867template <
class VALUE_TYPE,
class ALLOCATOR>
1872 typedef BloombergLP::bsls::Types::UintPtr UintPtr;
1873#if defined(BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES)
1875 template rebind_alloc<UintPtr> ImplAlloc;
1877 typedef typename ALLOCATOR::template rebind<UintPtr>::other ImplAlloc;
1880 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
1908 const ALLOCATOR& basicAllocator = ALLOCATOR());
1912 const ALLOCATOR& basicAllocator = ALLOCATOR());
1914 template <class INPUT_ITER>
1917 const ALLOCATOR& basicAllocator = ALLOCATOR());
1925 const typename
type_identity<ALLOCATOR>::type& basicAllocator);
1928 const typename
type_identity<ALLOCATOR>::type& basicAllocator);
1931#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1932 vector(std::initializer_list<VALUE_TYPE *> values,
1933 const ALLOCATOR& basicAllocator = ALLOCATOR());
1946 d_impl = MoveUtil::move(MoveUtil::access(rhs).d_impl)))
1948 d_impl = MoveUtil::move(MoveUtil::access(rhs).d_impl);
1952#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1953 vector& operator=(std::initializer_list<VALUE_TYPE *> values);
1955 void assign(std::initializer_list<VALUE_TYPE *> values);
1959 template <
class INPUT_ITER>
1960 void assign(INPUT_ITER first, INPUT_ITER last);
1961 void assign(
size_type numElements, VALUE_TYPE *value);
1985 void resize(
size_type newLength, VALUE_TYPE *value);
1988 void shrink_to_fit();
1994# if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
1995 template <
class ARG>
2001 void push_back(VALUE_TYPE *value);
2007# if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
2008 template <
class ARG>
2019 template <
class INPUT_ITER>
2028 INPUT_ITER>::type Iter;
2031 (
const UintPtr *)position, Iter(first), Iter(last));
2034#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2036 std::initializer_list<VALUE_TYPE *> values);
2044 d_impl.swap(other.d_impl)));
2086 return lhs.d_impl == rhs.d_impl;
2089#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
2091 friend BloombergLP::bslalg::SynthThreeWayUtil::Result<Impl>
2094 return BloombergLP::bslalg::SynthThreeWayUtil::compare(lhs.d_impl,
2103 return lhs.d_impl != rhs.d_impl;
2109 return lhs.d_impl < rhs.d_impl;
2115 return lhs.d_impl > rhs.d_impl;
2121 return lhs.d_impl <= rhs.d_impl;
2127 return lhs.d_impl >= rhs.d_impl;
2135 a.d_impl.swap(b.d_impl)))
2137 a.d_impl.swap(b.d_impl);
2141#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2153 class = bsl::enable_if_t<
2154 bsl::is_convertible_v<
2157 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
2159vector(SIZE_TYPE, VALUE, ALLOC *) -> vector<VALUE>;
2164 class INPUT_ITERATOR,
2166 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>
2168vector(INPUT_ITERATOR, INPUT_ITERATOR) -> vector<VALUE>;
2175 class INPUT_ITERATOR,
2178 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
2179 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
2181vector(INPUT_ITERATOR, INPUT_ITERATOR, ALLOCATOR) -> vector<VALUE, ALLOCATOR>;
2188 class INPUT_ITERATOR,
2191 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
2193 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
2195vector(INPUT_ITERATOR, INPUT_ITERATOR, ALLOC *)
2206 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
2208vector(std::initializer_list<VALUE>, ALLOC *)
2233template <
class VALUE_TYPE,
class ITERATOR>
2242 typedef BloombergLP::bsls::Types::UintPtr
UintPtr;
2247 typedef typename iterator_traits<ITERATOR>::difference_type
2249 typedef typename iterator_traits<ITERATOR>::iterator_category
2269#ifdef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
2292 return lhs.d_iter != rhs.d_iter;
2308 return lhs.d_iter == rhs.d_iter;
2320 return lhs.d_iter < rhs.d_iter;
2331 return lhs.d_iter - rhs.d_iter;
2340template <
class VALUE_TYPE,
class ITERATOR>
2349template <
class VALUE_TYPE,
class ITERATOR>
2359template <
class VALUE_TYPE,
class ITERATOR>
2361BloombergLP::bsls::Types::UintPtr
2364 VALUE_TYPE
const ptr = *d_iter;
2365 return reinterpret_cast<UintPtr>(ptr);
2381template <
class VALUE_TYPE,
class ALLOCATOR>
2385 VALUE_TYPE *d_target_p;
2386 ALLOCATOR d_allocator;
2422template <
class VALUE_TYPE,
class ALLOCATOR>
2432template <
class VALUE_TYPE,
class ALLOCATOR>
2442template <
class VALUE_TYPE,
class ALLOCATOR>
2449#if defined(BSLS_ASSERT_SAFE_IS_USED)
2454template <
class BSLSTL_ITERATOR>
2458Vector_RangeCheck::isInvalidRange(BSLSTL_ITERATOR, BSLSTL_ITERATOR)
2463template <
class BSLSTL_ITERATOR>
2465typename enable_if<Vector_IsRandomAccessIterator<BSLSTL_ITERATOR>::value,
2467Vector_RangeCheck::isInvalidRange(BSLSTL_ITERATOR first, BSLSTL_ITERATOR last)
2469 return last < first;
2478template <
class VALUE_TYPE>
2489template <
class VALUE_TYPE>
2508template <
class VALUE_TYPE>
2513 return d_dataBegin_p;
2516template <
class VALUE_TYPE>
2524template <
class VALUE_TYPE>
2532template <
class VALUE_TYPE>
2542template <
class VALUE_TYPE>
2549 return d_dataBegin_p[position];
2552template <
class VALUE_TYPE>
2558 BloombergLP::bslstl::StdExceptUtil::throwOutOfRange(
2559 "vector<...>::at(position): invalid position");
2561 return d_dataBegin_p[position];
2564template <
class VALUE_TYPE>
2571 return *d_dataBegin_p;
2574template <
class VALUE_TYPE>
2581 return *(d_dataEnd_p - 1);
2584template <
class VALUE_TYPE>
2589 return d_dataBegin_p;
2595template <
class VALUE_TYPE>
2600 return d_dataBegin_p;
2603template <
class VALUE_TYPE>
2608 return d_dataBegin_p;
2611template <
class VALUE_TYPE>
2619template <
class VALUE_TYPE>
2627template <
class VALUE_TYPE>
2635template <
class VALUE_TYPE>
2643template <
class VALUE_TYPE>
2651template <
class VALUE_TYPE>
2661template <
class VALUE_TYPE>
2666 return d_dataEnd_p - d_dataBegin_p;
2669template <
class VALUE_TYPE>
2677template <
class VALUE_TYPE>
2681 return d_dataEnd_p == d_dataBegin_p;
2685template <
class VALUE_TYPE>
2692 return d_dataBegin_p[position];
2695template <
class VALUE_TYPE>
2701 BloombergLP::bslstl::StdExceptUtil::throwOutOfRange(
2702 "const vector<...>::at(position): invalid position");
2704 return d_dataBegin_p[position];
2707template <
class VALUE_TYPE>
2714 return *d_dataBegin_p;
2717template <
class VALUE_TYPE>
2724 return *(d_dataEnd_p - 1);
2727template <
class VALUE_TYPE>
2732 return d_dataBegin_p;
2740template <
class VALUE_TYPE,
class ALLOCATOR>
2743 std::size_t capacity,
2744 ContainerBase *container)
2746, d_capacity(capacity)
2747, d_container_p(container)
2751template <
class VALUE_TYPE,
class ALLOCATOR>
2753vector<VALUE_TYPE, ALLOCATOR>::Proctor::~Proctor()
2755 using BloombergLP::bslma::AllocatorUtil;
2758 AllocatorUtil::deallocateObject(d_container_p->allocatorRef(),
2759 d_data_p, d_capacity);
2764template <
class VALUE_TYPE,
class ALLOCATOR>
2766void vector<VALUE_TYPE, ALLOCATOR>::Proctor::release()
2776template <
class VALUE_TYPE,
class ALLOCATOR>
2777template <
class FWD_ITER>
2778void vector<VALUE_TYPE, ALLOCATOR>::constructFromRange(
2781 std::forward_iterator_tag)
2787 const size_type maxSize = max_size();
2788 const size_type newSize = bsl::distance(first, last);
2792 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
2793 "vector<...>::(range-constructor): input too long");
2799 this->privateReserveEmpty(newCapacity);
2800 Proctor proctor(this->d_dataBegin_p,
2802 static_cast<ContainerBase *
>(
this));
2804 ArrayPrimitives::copyConstruct(this->d_dataEnd_p,
2807 this->allocatorRef());
2809 this->d_dataEnd_p += newSize;
2812template <
class VALUE_TYPE,
class ALLOCATOR>
2813template <
class INPUT_ITER>
2814void vector<VALUE_TYPE, ALLOCATOR>::constructFromRange(
2817 std::input_iterator_tag)
2827 vector temp(this->get_allocator());
2828 while (first != last) {
2829 temp.emplace_back(*first);
2835template <
class VALUE_TYPE,
class ALLOCATOR>
2836template <
class INTEGRAL>
2837void vector<VALUE_TYPE, ALLOCATOR>::constructFromRange(
2838 INTEGRAL initialSize,
2840 BloombergLP::bslmf::Nil)
2851 static_cast<size_type
>(initialSize) > max_size())) {
2853 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
2854 "vector<...>::(repeated-value constructor): input too long");
2857 if (initialSize > 0) {
2858 privateReserveEmpty(initialSize);
2859 Proctor proctor(this->d_dataBegin_p,
2861 static_cast<ContainerBase *
>(
this));
2863 ArrayPrimitives::uninitializedFillN(this->d_dataBegin_p,
2865 static_cast<VALUE_TYPE
>(value),
2866 this->allocatorRef());
2869 this->d_dataEnd_p += initialSize;
2873template <
class VALUE_TYPE,
class ALLOCATOR>
2874template <
class INPUT_ITER>
2876void vector<VALUE_TYPE, ALLOCATOR>::privateInsertDispatch(
2877 const_iterator position,
2880 BloombergLP::bslmf::MatchArithmeticType ,
2881 BloombergLP::bslmf::Nil )
2886 this->insert(position,
2887 static_cast<size_type
>(count),
2888 static_cast<VALUE_TYPE
>(value));
2891template <
class VALUE_TYPE,
class ALLOCATOR>
2892template <
class INPUT_ITER>
2894void vector<VALUE_TYPE, ALLOCATOR>::privateInsertDispatch(
2895 const_iterator position,
2898 BloombergLP::bslmf::MatchAnyType ,
2899 BloombergLP::bslmf::MatchAnyType )
2904 typedef typename iterator_traits<INPUT_ITER>::iterator_category Tag;
2905 this->privateInsert(position, first, last, Tag());
2908template <
class VALUE_TYPE,
class ALLOCATOR>
2909template <
class INPUT_ITER>
2910void vector<VALUE_TYPE, ALLOCATOR>::privateInsert(
2911 const_iterator position,
2914 const std::input_iterator_tag&)
2928 if (first == last) {
2932 if (!this->capacity()) {
2933 privateReserveEmpty(size_type(1));
2934 position = this->d_dataBegin_p;
2937 size_type insertOffset = position - this->d_dataBegin_p;
2938 size_type initialEnd = this->
size();
2939 size_type tailLength = this->
end() - position;
2941 VALUE_TYPE *emplaceBegin = this->d_dataEnd_p;
2942 VALUE_TYPE *emplaceEnd = this->d_dataBegin_p + this->d_capacity;
2943 VALUE_TYPE *emplacePosition = emplaceBegin;
2945 allocator_type alloc(this->get_allocator());
2952 vector resultState(alloc);
2958 BloombergLP::bslma::AutoDestructor<VALUE_TYPE> insertProctor(
2960 while (emplacePosition != emplaceEnd) {
2961 AllocatorTraits::construct(alloc, emplacePosition, *first);
2964 if (++first == last) {
2965 this->d_dataEnd_p = emplacePosition;
2966 insertProctor.release();
2968 ArrayPrimitives::rotate(this->d_dataBegin_p + insertOffset,
2969 this->d_dataBegin_p + initialEnd,
2979 resultState.reserve(this->d_capacity*2);
2980 emplacePosition = resultState.d_dataBegin_p + insertOffset;
2981 ArrayPrimitives::destructiveMove(emplacePosition,
2986 size_type emplaceOffset = (emplaceEnd - emplaceBegin);
2987 insertProctor.reset(emplacePosition);
2988 emplaceBegin = emplacePosition;
2989 emplaceEnd = resultState.d_dataBegin_p + resultState.d_capacity
2991 emplacePosition += emplaceOffset;
2993 while (first != last) {
2994 if (emplacePosition == emplaceEnd) {
2996 vector nextResult(alloc);
2997 nextResult.reserve(resultState.d_capacity*2);
2998 emplacePosition = nextResult.d_dataBegin_p + insertOffset;
2999 ArrayPrimitives::destructiveMove(emplacePosition,
3004 insertProctor.reset(emplacePosition);
3005 emplaceOffset = (emplaceEnd - emplaceBegin);
3006 emplaceBegin = emplacePosition;
3007 emplaceEnd = nextResult.d_dataBegin_p + nextResult.d_capacity
3009 emplacePosition += emplaceOffset;
3012 &resultState.d_dataBegin_p);
3015 AllocatorTraits::construct(alloc, emplacePosition, *first);
3022 ArrayPrimitives::destructiveMove(emplacePosition,
3023 this->d_dataBegin_p + insertOffset,
3024 this->d_dataBegin_p + initialEnd,
3028 this->d_dataEnd_p = this->d_dataBegin_p + insertOffset;
3029 emplacePosition += (initialEnd - insertOffset);
3030 insertProctor.setLength(
3031 insertProctor.length() +
static_cast<int>(initialEnd - insertOffset));
3034 ArrayPrimitives::destructiveMove(resultState.d_dataBegin_p,
3035 this->d_dataBegin_p,
3036 this->d_dataBegin_p + insertOffset,
3042 resultState.d_dataEnd_p = emplacePosition;
3045 insertProctor.release();
3046 this->d_dataEnd_p = this->d_dataBegin_p;
3052template <
class VALUE_TYPE,
class ALLOCATOR>
3053template <
class FWD_ITER>
3054void vector<VALUE_TYPE, ALLOCATOR>::privateInsert(
3055 const_iterator position,
3058 const std::forward_iterator_tag&)
3064 const iterator& pos =
const_cast<iterator
>(position);
3066 const size_type maxSize = max_size();
3067 const size_type n = bsl::distance(first, last);
3071 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3072 "vector<...>::insert(pos,first,last): vector too long");
3075 const size_type newSize = this->
size() + n;
3076 if (newSize > this->d_capacity) {
3082 vector temp(this->get_allocator());
3083 temp.privateReserveEmpty(newCapacity);
3085 ArrayPrimitives::destructiveMoveAndInsert(temp.d_dataBegin_p,
3087 this->d_dataBegin_p,
3093 this->allocatorRef());
3094 temp.d_dataEnd_p += newSize;
3098 ArrayPrimitives::insert(pos,
3103 this->allocatorRef());
3104 this->d_dataEnd_p += n;
3108template <
class VALUE_TYPE,
class ALLOCATOR>
3109void vector<VALUE_TYPE, ALLOCATOR>::privateMoveInsert(
3111 const_iterator position)
3113 const iterator& pos =
const_cast<const iterator&
>(position);
3115 const size_type maxSize = max_size();
3116 const size_type n = fromVector->size();
3119 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3120 "vector<...>::insert(pos,first,last): vector too long");
3123 const size_type newSize = this->
size() + n;
3124 if (newSize > this->d_capacity) {
3130 vector temp(this->get_allocator());
3131 temp.privateReserveEmpty(newCapacity);
3133 ArrayPrimitives::destructiveMoveAndMoveInsert(
3136 &fromVector->d_dataEnd_p,
3137 this->d_dataBegin_p,
3140 fromVector->d_dataBegin_p,
3141 fromVector->d_dataEnd_p,
3143 this->allocatorRef());
3144 temp.d_dataEnd_p += newSize;
3148 ArrayPrimitives::moveInsert(pos,
3150 &fromVector->d_dataEnd_p,
3151 fromVector->d_dataBegin_p,
3152 fromVector->d_dataEnd_p,
3154 this->allocatorRef());
3155 this->d_dataEnd_p += n;
3159template <
class VALUE_TYPE,
class ALLOCATOR>
3161void vector<VALUE_TYPE, ALLOCATOR>::privateReserveEmpty(size_type numElements)
3166 this->d_dataBegin_p = this->d_dataEnd_p =
3167 AllocatorUtil::allocateObject<VALUE_TYPE>(this->allocatorRef(),
3170 this->d_capacity = numElements;
3173#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
3174template <
class VALUE_TYPE,
class ALLOCATOR>
3175template <
class... Args>
3176void vector<VALUE_TYPE, ALLOCATOR>::privateEmplaceBackWithAllocation(
3181 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3182 "vector<...>:emplace_back(args...): vector too long");
3188 vector temp(this->get_allocator());
3189 temp.privateReserveEmpty(newCapacity);
3192 VALUE_TYPE *pos = temp.d_dataBegin_p + this->
size();
3193 AllocatorTraits::construct(
3194 this->allocatorRef(),
3200 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
3201 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
3202 this->d_dataBegin_p,
3204 this->allocatorRef());
3207 this->d_dataEnd_p = this->d_dataBegin_p;
3208 temp.d_dataEnd_p = ++pos;
3213template <
class VALUE_TYPE,
class ALLOCATOR>
3214void vector<VALUE_TYPE, ALLOCATOR>::privatePushBackWithAllocation(
3215 const VALUE_TYPE& value)
3219 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3220 "vector<...>:push_back(lvalue): vector too long");
3227 vector temp(this->get_allocator());
3228 temp.privateReserveEmpty(newCapacity);
3231 VALUE_TYPE *pos = temp.d_dataBegin_p + this->
size();
3232 AllocatorTraits::construct(this->allocatorRef(), pos, value);
3236 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
3237 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
3238 this->d_dataBegin_p,
3240 this->allocatorRef());
3243 this->d_dataEnd_p = this->d_dataBegin_p;
3244 temp.d_dataEnd_p = ++pos;
3248template <
class VALUE_TYPE,
class ALLOCATOR>
3249void vector<VALUE_TYPE, ALLOCATOR>::privatePushBackWithAllocation(
3250 BloombergLP::bslmf::MovableRef<VALUE_TYPE> value)
3252 VALUE_TYPE& lvalue = value;
3255 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3256 "vector<...>:push_back(rvalue): vector too long");
3263 vector temp(this->get_allocator());
3264 temp.privateReserveEmpty(newCapacity);
3267 VALUE_TYPE *pos = temp.d_dataBegin_p + this->
size();
3268 AllocatorTraits::construct(this->allocatorRef(),
3270 MoveUtil::move(lvalue));
3274 Vector_PushProctor<VALUE_TYPE, ALLOCATOR> guard(pos, this->allocatorRef());
3275 ArrayPrimitives::destructiveMove(temp.d_dataBegin_p,
3276 this->d_dataBegin_p,
3278 this->allocatorRef());
3281 this->d_dataEnd_p = this->d_dataBegin_p;
3282 temp.d_dataEnd_p = ++pos;
3290template <
class VALUE_TYPE,
class ALLOCATOR>
3294, ContainerBase(ALLOCATOR())
3298template <
class VALUE_TYPE,
class ALLOCATOR>
3303, ContainerBase(basicAllocator)
3307template <
class VALUE_TYPE,
class ALLOCATOR>
3309 const ALLOCATOR& basicAllocator)
3311, ContainerBase(basicAllocator)
3315 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3316 "vector<...>::vector(n,v): vector too long");
3318 if (initialSize > 0) {
3319 privateReserveEmpty(initialSize);
3320 Proctor proctor(this->d_dataBegin_p,
3322 static_cast<ContainerBase *
>(
this));
3324 ArrayPrimitives::defaultConstruct(this->d_dataBegin_p,
3326 this->allocatorRef());
3329 this->d_dataEnd_p += initialSize;
3333template <
class VALUE_TYPE,
class ALLOCATOR>
3335 const VALUE_TYPE& value,
3336 const ALLOCATOR& basicAllocator)
3338, ContainerBase(basicAllocator)
3342 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3343 "vector<...>::vector(n,v): vector too long");
3345 if (initialSize > 0) {
3346 privateReserveEmpty(initialSize);
3347 Proctor proctor(this->d_dataBegin_p,
3349 static_cast<ContainerBase *
>(
this));
3351 ArrayPrimitives::uninitializedFillN(this->d_dataBegin_p,
3354 this->allocatorRef());
3357 this->d_dataEnd_p += initialSize;
3361template <
class VALUE_TYPE,
class ALLOCATOR>
3362template <
class INPUT_ITER>
3366 const ALLOCATOR& basicAllocator)
3368, ContainerBase(basicAllocator)
3376 constructFromRange(first, last, Tag());
3380template <
class VALUE_TYPE,
class ALLOCATOR>
3383, ContainerBase(
AllocatorTraits::select_on_container_copy_construction(
3384 original.get_allocator()))
3386 if (original.
size() > 0) {
3387 privateReserveEmpty(original.
size());
3388 Proctor proctor(this->d_dataBegin_p,
3390 static_cast<ContainerBase *
>(
this));
3392 ArrayPrimitives::copyConstruct(this->d_dataBegin_p,
3395 this->allocatorRef());
3398 this->d_dataEnd_p += original.
size();
3402template <
class VALUE_TYPE,
class ALLOCATOR>
3407, ContainerBase(basicAllocator)
3409 if (original.
size() > 0) {
3410 privateReserveEmpty(original.
size());
3411 Proctor proctor(this->d_dataBegin_p,
3413 static_cast<ContainerBase *
>(
this));
3415 ArrayPrimitives::copyConstruct(this->d_dataBegin_p,
3418 this->allocatorRef());
3421 this->d_dataEnd_p += original.
size();
3425template <
class VALUE_TYPE,
class ALLOCATOR>
3427 BloombergLP::bslmf::MovableRef<vector> original)
3430, ContainerBase(MoveUtil::access(original).get_allocator())
3432 vector& lvalue = original;
3433 ImpBase::adopt(MoveUtil::move(
static_cast<ImpBase&
>(lvalue)));
3436template <
class VALUE_TYPE,
class ALLOCATOR>
3438 BloombergLP::bslmf::MovableRef<vector> original,
3441, ContainerBase(basicAllocator)
3443 vector& lvalue = original;
3450 if (lvalue.
size() > 0) {
3451 privateReserveEmpty(lvalue.
size());
3452 Proctor proctor(this->d_dataBegin_p,
3454 static_cast<ContainerBase *
>(
this));
3456 ArrayPrimitives::moveConstruct(this->d_dataBegin_p,
3459 this->allocatorRef());
3462 this->d_dataEnd_p += lvalue.
size();
3467#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3468template <
class VALUE_TYPE,
class ALLOCATOR>
3471 std::initializer_list<VALUE_TYPE> values,
3472 const ALLOCATOR& basicAllocator)
3474, ContainerBase(basicAllocator)
3476 if (values.begin() != values.end()) {
3477 constructFromRange(values.begin(),
3479 std::random_access_iterator_tag());
3486template <
class VALUE_TYPE,
class ALLOCATOR>
3490 using BloombergLP::bslalg::ArrayDestructionPrimitives;
3493#ifdef BSLS_PLATFORM_CMP_GNU
3494#pragma GCC diagnostic push
3495#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
3497 if (this->d_dataBegin_p) {
3498 ArrayDestructionPrimitives::destroy(this->d_dataBegin_p,
3500 this->allocatorRef());
3501 AllocatorUtil::deallocateObject(this->allocatorRef(),
3502 this->d_dataBegin_p, this->d_capacity);
3504#ifdef BSLS_PLATFORM_CMP_GNU
3505#pragma GCC diagnostic pop
3510template <
class VALUE_TYPE,
class ALLOCATOR>
3518 if (Propagate::value) {
3521 AllocatorUtil::swap(&this->allocatorRef(),
3522 &other.allocatorRef(),
3527 if (!this->
empty()) {
3536template <
class VALUE_TYPE,
class ALLOCATOR>
3540 AllocatorTraits::propagate_on_container_move_assignment::value ||
3541 AllocatorTraits::is_always_equal::value)
3544 AllocatorTraits::propagate_on_container_move_assignment Propagate;
3549 vector other(MoveUtil::move(lvalue));
3552 else if (Propagate::value) {
3553 vector other(MoveUtil::move(lvalue));
3554 AllocatorUtil::swap(&this->allocatorRef(),
3555 &other.allocatorRef(),
3560 vector other(MoveUtil::move(lvalue), this->allocatorRef());
3567#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3568template <
class VALUE_TYPE,
class ALLOCATOR>
3570vector<VALUE_TYPE, ALLOCATOR>&
3572 std::initializer_list<VALUE_TYPE> values)
3574 this->
assign(values.begin(), values.end());
3578template <
class VALUE_TYPE,
class ALLOCATOR>
3581 std::initializer_list<VALUE_TYPE> values)
3583 assign(values.begin(), values.end());
3587template <
class VALUE_TYPE,
class ALLOCATOR>
3588template <
class INPUT_ITER>
3594 if (!this->
empty()) {
3598 insert(this->
begin(), first, last);
3601template <
class VALUE_TYPE,
class ALLOCATOR>
3604 const VALUE_TYPE& value)
3606 if (!this->
empty()) {
3609 insert(this->
begin(), numElements, value);
3615template <
class VALUE_TYPE,
class ALLOCATOR>
3624 if (newSize <= this->
size()) {
3625 BloombergLP::bslalg::ArrayDestructionPrimitives::destroy(
3626 this->d_dataBegin_p + newSize,
3628 this->allocatorRef());
3629 this->d_dataEnd_p = this->d_dataBegin_p + newSize;
3631 else if (0 == this->d_capacity) {
3634 vector temp(newSize, this->get_allocator());
3637 else if (newSize > this->d_capacity) {
3641 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3642 "vector<...>::resize(n): vector too long");
3646 newSize, this->d_capacity, maxSize);
3648 vector temp(this->get_allocator());
3649 temp.privateReserveEmpty(newCapacity);
3651 ArrayPrimitives::destructiveMoveAndInsert(temp.
d_dataBegin_p,
3653 this->d_dataBegin_p,
3656 newSize - this->size(),
3657 this->allocatorRef());
3663 ArrayPrimitives::defaultConstruct(this->d_dataEnd_p,
3664 newSize - this->
size(),
3665 this->allocatorRef());
3666 this->d_dataEnd_p = this->d_dataBegin_p + newSize;
3670template <
class VALUE_TYPE,
class ALLOCATOR>
3672 const VALUE_TYPE& value)
3677 if (newSize <= this->
size()) {
3678 BloombergLP::bslalg::ArrayDestructionPrimitives::destroy(
3679 this->d_dataBegin_p + newSize,
3681 this->allocatorRef());
3682 this->d_dataEnd_p = this->d_dataBegin_p + newSize;
3685 insert(this->d_dataEnd_p, newSize - this->
size(), value);
3689template <
class VALUE_TYPE,
class ALLOCATOR>
3694 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3695 "vector<...>::reserve(newCapacity): vector too long");
3697 if (0 == this->d_capacity && 0 != newCapacity) {
3698 privateReserveEmpty(newCapacity);
3700 else if (this->d_capacity < newCapacity) {
3701 vector temp(this->get_allocator());
3702 temp.privateReserveEmpty(newCapacity);
3705 this->d_dataBegin_p,
3707 this->allocatorRef());
3710 this->d_dataEnd_p = this->d_dataBegin_p;
3715template <
class VALUE_TYPE,
class ALLOCATOR>
3718 if (this->
size() < this->d_capacity) {
3719 vector temp(this->get_allocator());
3720 if (this->
size() > 0) {
3721 temp.privateReserveEmpty(this->
size());
3723 this->d_dataBegin_p,
3725 this->allocatorRef());
3728 this->d_dataEnd_p = this->d_dataBegin_p;
3736#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
3737template <
class VALUE_TYPE,
class ALLOCATOR>
3738template <
class... Args>
3744 AllocatorTraits::construct(
3745 this->allocatorRef(),
3748 ++this->d_dataEnd_p;
3751 privateEmplaceBackWithAllocation(
3754 return *(this->d_dataEnd_p - 1);
3758template <
class VALUE_TYPE,
class ALLOCATOR>
3763 AllocatorTraits::construct(this->allocatorRef(),
3766 ++this->d_dataEnd_p;
3769 privatePushBackWithAllocation(value);
3773template <
class VALUE_TYPE,
class ALLOCATOR>
3776 BloombergLP::bslmf::MovableRef<VALUE_TYPE> value)
3778 VALUE_TYPE& lvalue = value;
3780 AllocatorTraits::construct(this->allocatorRef(),
3782 MoveUtil::move(lvalue));
3783 ++this->d_dataEnd_p;
3786 privatePushBackWithAllocation(MoveUtil::move(lvalue));
3790template <
class VALUE_TYPE,
class ALLOCATOR>
3796 AllocatorTraits::destroy(this->allocatorRef(),
3797 --this->d_dataEnd_p);
3800template <
class VALUE_TYPE,
class ALLOCATOR>
3804 const VALUE_TYPE& value)
3809 return insert(position,
size_type(1), value);
3812template <
class VALUE_TYPE,
class ALLOCATOR>
3816 BloombergLP::bslmf::MovableRef<VALUE_TYPE> value)
3824 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3825 "vector<...>::insert(pos,rv): vector too long");
3828 VALUE_TYPE& lvalue = value;
3831 const iterator& pos =
const_cast<const iterator&
>(position);
3834 if (newSize > this->d_capacity) {
3840 vector temp(this->get_allocator());
3841 temp.privateReserveEmpty(newCapacity);
3843 ArrayPrimitives::destructiveMoveAndEmplace(temp.
d_dataBegin_p,
3845 this->d_dataBegin_p,
3848 this->allocatorRef(),
3849 MoveUtil::move(lvalue));
3855 ArrayPrimitives::insert(pos,
3857 MoveUtil::move(lvalue),
3858 this->allocatorRef());
3859 ++this->d_dataEnd_p;
3862 return this->
begin() + index;
3865template <
class VALUE_TYPE,
class ALLOCATOR>
3869 const VALUE_TYPE& value)
3876 numElements > maxSize - this->
size())) {
3878 BloombergLP::bslstl::StdExceptUtil::throwLengthError(
3879 "vector<...>::insert(pos,n,v): vector too long");
3883 const iterator& pos =
const_cast<const iterator&
>(position);
3886 if (newSize > this->d_capacity) {
3892 vector temp(this->get_allocator());
3893 temp.privateReserveEmpty(newCapacity);
3895 ArrayPrimitives::destructiveMoveAndInsert(temp.
d_dataBegin_p,
3897 this->d_dataBegin_p,
3902 this->allocatorRef());
3908 ArrayPrimitives::insert(pos,
3912 this->allocatorRef());
3913 this->d_dataEnd_p += numElements;
3915 return this->
begin() + index;
3918#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
3919template <
class VALUE_TYPE,
class ALLOCATOR>
3923 const_iterator position,
3924 std::initializer_list<VALUE_TYPE> values)
3926 return insert(position, values.begin(), values.end());
3930template <
class VALUE_TYPE,
class ALLOCATOR>
3938 return erase(position, position + 1);
3944template <
class VALUE_TYPE,
class ALLOCATOR>
3955 ArrayPrimitives::erase(
const_cast<VALUE_TYPE *
>(first),
3956 const_cast<VALUE_TYPE *
>(last),
3958 this->allocatorRef());
3959 this->d_dataEnd_p -= n;
3960 return const_cast<VALUE_TYPE *
>(first);
3963template <
class VALUE_TYPE,
class ALLOCATOR>
3966 AllocatorTraits::propagate_on_container_swap::value ||
3967 AllocatorTraits::is_always_equal::value)
3970 AllocatorTraits::propagate_on_container_swap Propagate;
3972 if (Propagate::value) {
3974 AllocatorUtil::swap(&this->allocatorRef(),
3975 &other.allocatorRef(),
3980 this->get_allocator() == other.get_allocator())) {
3986 vector toOtherCopy(MoveUtil::move(*
this),
3987 other.get_allocator());
3988 vector toThisCopy( MoveUtil::move(other),
3989 this->get_allocator());
3992 &other.d_dataBegin_p);
3994 &this->d_dataBegin_p);
3999template <
class VALUE_TYPE,
class ALLOCATOR>
4004 BloombergLP::bslalg::ArrayDestructionPrimitives::destroy(
4005 this->d_dataBegin_p,
4007 this->allocatorRef());
4008 this->d_dataEnd_p = this->d_dataBegin_p;
4016template <
class VALUE_TYPE,
class ALLOCATOR>
4021 return this->allocatorRef();
4026template <
class VALUE_TYPE,
class ALLOCATOR>
4031 return AllocatorTraits::max_size(this->allocatorRef());
4038template <
class VALUE_TYPE,
class ALLOCATOR>
4043 return BloombergLP::bslalg::RangeCompare::equal(lhs.
begin(),
4051#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
4052template <
class VALUE_TYPE,
class ALLOCATOR>
4057 return ! (lhs == rhs);
4061#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
4063template <
class VALUE_TYPE,
class ALLOCATOR>
4065BloombergLP::bslalg::SynthThreeWayUtil::Result<VALUE_TYPE> operator<=>(
4066 const vector<VALUE_TYPE, ALLOCATOR>& lhs,
4067 const vector<VALUE_TYPE, ALLOCATOR>& rhs)
4069 return lexicographical_compare_three_way(
4074 BloombergLP::bslalg::SynthThreeWayUtil::compare);
4079template <
class VALUE_TYPE,
class ALLOCATOR>
4084 return 0 > BloombergLP::bslalg::RangeCompare::lexicographical(lhs.
begin(),
4092template <
class VALUE_TYPE,
class ALLOCATOR>
4100template <
class VALUE_TYPE,
class ALLOCATOR>
4105 return !(rhs < lhs);
4108template <
class VALUE_TYPE,
class ALLOCATOR>
4113 return !(lhs < rhs);
4122template <
class VALUE_TYPE,
class ALLOCATOR,
class BDE_OTHER_TYPE>
4128 return oldSize - vec.
size();
4131template <
class VALUE_TYPE,
class ALLOCATOR,
class PREDICATE>
4137 return oldSize - vec.
size();
4140template <
class VALUE_TYPE,
class ALLOCATOR>
4151template <
class HASHALG,
class VALUE_TYPE,
class ALLOCATOR>
4155 using ::BloombergLP::bslh::hashAppend;
4158 for (ci_t b = input.
begin(), e = input.
end(); b != e; ++b) {
4171template <
class VALUE_TYPE,
class ALLOCATOR>
4178template <
class VALUE_TYPE,
class ALLOCATOR>
4182: d_impl(ImplAlloc(basicAllocator))
4186template <
class VALUE_TYPE,
class ALLOCATOR>
4189 const ALLOCATOR& basicAllocator)
4190: d_impl(initialSize, ImplAlloc(basicAllocator))
4194template <
class VALUE_TYPE,
class ALLOCATOR>
4198 const ALLOCATOR& basicAllocator)
4199: d_impl(initialSize, (UintPtr) value, ImplAlloc(basicAllocator))
4203template <
class VALUE_TYPE,
class ALLOCATOR>
4204template <
class INPUT_ITER>
4208 const ALLOCATOR& basicAllocator)
4217template <
class VALUE_TYPE,
class ALLOCATOR>
4220: d_impl(original.d_impl)
4224template <
class VALUE_TYPE,
class ALLOCATOR>
4227 BloombergLP::bslmf::MovableRef<vector> original)
4229: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl))
4233template <
class VALUE_TYPE,
class ALLOCATOR>
4237: d_impl(original.d_impl, ImplAlloc(basicAllocator))
4241template <
class VALUE_TYPE,
class ALLOCATOR>
4244 BloombergLP::bslmf::MovableRef<vector> original,
4246: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl),
4247 ImplAlloc(basicAllocator))
4251#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
4252template <
class VALUE_TYPE,
class ALLOCATOR>
4255 std::initializer_list<VALUE_TYPE *> values,
4256 const ALLOCATOR& basicAllocator)
4259 typename
std::initializer_list<VALUE_TYPE *>::const_iterator>::
4260 type(values.
begin()),
4263 typename
std::initializer_list<VALUE_TYPE *>::const_iterator>::
4270template <
class VALUE_TYPE,
class ALLOCATOR>
4277template <
class VALUE_TYPE,
class ALLOCATOR>
4282 d_impl = rhs.d_impl;
4286#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
4287template <
class VALUE_TYPE,
class ALLOCATOR>
4290 std::initializer_list<VALUE_TYPE *> values)
4296template <
class VALUE_TYPE,
class ALLOCATOR>
4299 std::initializer_list<VALUE_TYPE *> values)
4301 typedef typename std::initializer_list<VALUE_TYPE *>::const_iterator
4307 d_impl.
assign(Iter(values.begin()), Iter(values.end()));
4311template <
class VALUE_TYPE,
class ALLOCATOR>
4312template <
class INPUT_ITER>
4317 INPUT_ITER>::type Iter;
4319 d_impl.
assign(Iter(first), Iter(last));
4322template <
class VALUE_TYPE,
class ALLOCATOR>
4327 d_impl.
assign(numElements, (UintPtr) value);
4332template <
class VALUE_TYPE,
class ALLOCATOR>
4340template <
class VALUE_TYPE,
class ALLOCATOR>
4348template <
class VALUE_TYPE,
class ALLOCATOR>
4356template <
class VALUE_TYPE,
class ALLOCATOR>
4366template <
class VALUE_TYPE,
class ALLOCATOR>
4371 return d_impl.
size();
4374template <
class VALUE_TYPE,
class ALLOCATOR>
4382template <
class VALUE_TYPE,
class ALLOCATOR>
4387 return d_impl.
empty();
4392template <
class VALUE_TYPE,
class ALLOCATOR>
4397 return (
reference) d_impl.operator[](position);
4400template <
class VALUE_TYPE,
class ALLOCATOR>
4408template <
class VALUE_TYPE,
class ALLOCATOR>
4416template <
class VALUE_TYPE,
class ALLOCATOR>
4424template <
class VALUE_TYPE,
class ALLOCATOR>
4428 return (VALUE_TYPE **) d_impl.
data();
4433template <
class VALUE_TYPE,
class ALLOCATOR>
4437 d_impl.
resize(newLength);
4440template <
class VALUE_TYPE,
class ALLOCATOR>
4445 d_impl.
resize(newLength, (UintPtr) value);
4448template <
class VALUE_TYPE,
class ALLOCATOR>
4455template <
class VALUE_TYPE,
class ALLOCATOR>
4465template <
class VALUE_TYPE,
class ALLOCATOR>
4474# if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
4475template <
class VALUE_TYPE,
class ALLOCATOR>
4481 VALUE_TYPE *ptr(arg);
4486template <
class VALUE_TYPE,
class ALLOCATOR>
4496template <
class VALUE_TYPE,
class ALLOCATOR>
4503template <
class VALUE_TYPE,
class ALLOCATOR>
4510template <
class VALUE_TYPE,
class ALLOCATOR>
4518# if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
4519template <
class VALUE_TYPE,
class ALLOCATOR>
4525 VALUE_TYPE *ptr(arg);
4526 return (iterator) d_impl.
emplace((
const UintPtr *)position,
4527 reinterpret_cast<UintPtr
>(ptr));
4530template <
class VALUE_TYPE,
class ALLOCATOR>
4537 reinterpret_cast<UintPtr
>(ptr));
4541template <
class VALUE_TYPE,
class ALLOCATOR>
4548 reinterpret_cast<UintPtr
>(value));
4551template <
class VALUE_TYPE,
class ALLOCATOR>
4559 (
const UintPtr *)position, numElements, (UintPtr)value);
4562#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
4563template <
class VALUE_TYPE,
class ALLOCATOR>
4567 const_iterator position,
4568 std::initializer_list<VALUE_TYPE *> values)
4570 typedef typename std::initializer_list<VALUE_TYPE *>::const_iterator
4576 return (iterator) d_impl.
insert(
4577 (
const UintPtr *)position, Iter(values.begin()), Iter(values.end()));
4581template <
class VALUE_TYPE,
class ALLOCATOR>
4589template <
class VALUE_TYPE,
class ALLOCATOR>
4596 (
const UintPtr*) last);
4599template <
class VALUE_TYPE,
class ALLOCATOR>
4604 d_impl.swap(other.d_impl)))
4606 d_impl.swap(other.d_impl);
4609template <
class VALUE_TYPE,
class ALLOCATOR>
4617template <
class VALUE_TYPE,
class ALLOCATOR>
4625template <
class VALUE_TYPE,
class ALLOCATOR>
4636template <
class VALUE_TYPE,
class ALLOCATOR>
4644template <
class VALUE_TYPE,
class ALLOCATOR>
4652template <
class VALUE_TYPE,
class ALLOCATOR>
4660template <
class VALUE_TYPE,
class ALLOCATOR>
4668template <
class VALUE_TYPE,
class ALLOCATOR>
4676template <
class VALUE_TYPE,
class ALLOCATOR>
4684template <
class VALUE_TYPE,
class ALLOCATOR>
4692template <
class VALUE_TYPE,
class ALLOCATOR>
4703template <
class VALUE_TYPE,
class ALLOCATOR>
4711template <
class VALUE_TYPE,
class ALLOCATOR>
4719template <
class VALUE_TYPE,
class ALLOCATOR>
4727template <
class VALUE_TYPE,
class ALLOCATOR>
4735template <
class VALUE_TYPE,
class ALLOCATOR>
4740 return (VALUE_TYPE *
const *) d_impl.
data();
4761template <
class VALUE_TYPE,
class ALLOCATOR>
4769template <
class VALUE_TYPE,
class ALLOCATOR>
4778template <
class VALUE_TYPE,
class ALLOCATOR>
4787#ifdef BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE
Definition bslstl_vector.h:2382
~Vector_PushProctor()
Definition bslstl_vector.h:2434
void release()
Definition bslstl_vector.h:2444
Definition bslma_bslallocator.h:580
Definition bslstl_vector.h:834
VALUE_TYPE const & const_reference
Definition bslstl_vector.h:852
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this vector.
Definition bslstl_vector.h:2664
std::size_t d_capacity
Definition bslstl_vector.h:846
VALUE_TYPE * d_dataEnd_p
Definition bslstl_vector.h:845
void adopt(BloombergLP::bslmf::MovableRef< vectorBase > base)
Definition bslstl_vector.h:2492
iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2511
reference back()
Definition bslstl_vector.h:2577
size_type capacity() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2672
std::ptrdiff_t difference_type
Definition bslstl_vector.h:856
VALUE_TYPE value_type
Definition bslstl_vector.h:850
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2622
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2606
VALUE_TYPE const * const_iterator
Definition bslstl_vector.h:854
std::size_t size_type
Definition bslstl_vector.h:855
const_reverse_iterator crend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2654
reverse_iterator rbegin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2527
vectorBase()
Create an empty base object with no capacity.
Definition bslstl_vector.h:2480
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2519
VALUE_TYPE * d_dataBegin_p
Definition bslstl_vector.h:844
bsl::reverse_iterator< const_iterator > const_reverse_iterator
Definition bslstl_vector.h:858
reference at(size_type position)
Definition bslstl_vector.h:2554
VALUE_TYPE & reference
Definition bslstl_vector.h:851
bsl::reverse_iterator< iterator > reverse_iterator
Definition bslstl_vector.h:857
bool empty() const BSLS_KEYWORD_NOEXCEPT
Return true if this vector has size 0, and false otherwise.
Definition bslstl_vector.h:2679
reference front()
Definition bslstl_vector.h:2567
reference operator[](size_type position)
Definition bslstl_vector.h:2545
reverse_iterator rend() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2535
const_reverse_iterator crbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2638
VALUE_TYPE * iterator
Definition bslstl_vector.h:853
VALUE_TYPE * data() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2587
ALLOCATOR::const_pointer const_pointer
Definition bslstl_vector.h:1896
std::size_t size_type
Definition bslstl_vector.h:1892
value_type & reference
Definition bslstl_vector.h:1888
ALLOCATOR allocator_type
Definition bslstl_vector.h:1894
const value_type & const_reference
Definition bslstl_vector.h:1889
friend bool operator!=(const vector &lhs, const vector &rhs)
Definition bslstl_vector.h:2101
bsl::reverse_iterator< const_iterator > const_reverse_iterator
Definition bslstl_vector.h:1898
bsl::reverse_iterator< iterator > reverse_iterator
Definition bslstl_vector.h:1897
friend void swap(vector &a, vector &b) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(BSLS_KEYWORD_NOEXCEPT_OPERATOR(a.d_impl.swap(b.d_impl)))
Definition bslstl_vector.h:2133
VALUE_TYPE ** iterator
Definition bslstl_vector.h:1890
iterator insert(const_iterator position, INPUT_ITER first, INPUT_ITER last)
Definition bslstl_vector.h:2020
friend bool operator<=(const vector &lhs, const vector &rhs)
Definition bslstl_vector.h:2119
vector & operator=(BloombergLP::bslmf::MovableRef< vector< VALUE_TYPE *, ALLOCATOR > > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(BSLS_KEYWORD_NOEXCEPT_OPERATOR(d_impl
ALLOCATOR::pointer pointer
Definition bslstl_vector.h:1895
friend bool operator>=(const vector &lhs, const vector &rhs)
Definition bslstl_vector.h:2125
std::ptrdiff_t difference_type
Definition bslstl_vector.h:1893
VALUE_TYPE * value_type
Definition bslstl_vector.h:1887
friend bool operator<(const vector &lhs, const vector &rhs)
Definition bslstl_vector.h:2107
VALUE_TYPE *const * const_iterator
Definition bslstl_vector.h:1891
friend bool operator>(const vector &lhs, const vector &rhs)
Definition bslstl_vector.h:2113
Definition bslstl_vector.h:2234
vector_UintPtrConversionIterator(ITERATOR it)
Create a proxy iterator adapting the specified it.
Definition bslstl_vector.h:2343
iterator_traits< ITERATOR >::iterator_category iterator_category
Definition bslstl_vector.h:2250
friend bool operator==(const vector_UintPtrConversionIterator &lhs, const vector_UintPtrConversionIterator &rhs)
Definition bslstl_vector.h:2305
BloombergLP::bsls::Types::UintPtr UintPtr
Definition bslstl_vector.h:2242
UintPtr reference
Definition bslstl_vector.h:2246
iterator_traits< ITERATOR >::difference_type difference_type
Definition bslstl_vector.h:2248
friend bool operator<(const vector_UintPtrConversionIterator &lhs, const vector_UintPtrConversionIterator &rhs)
Definition bslstl_vector.h:2317
friend bool operator!=(const vector_UintPtrConversionIterator &lhs, const vector_UintPtrConversionIterator &rhs)
Definition bslstl_vector.h:2284
UintPtr * pointer
Definition bslstl_vector.h:2245
vector_UintPtrConversionIterator & operator++()
Definition bslstl_vector.h:2352
UintPtr operator*() const
Definition bslstl_vector.h:2362
UintPtr value_type
Definition bslstl_vector.h:2244
friend difference_type operator-(const vector_UintPtrConversionIterator &lhs, const vector_UintPtrConversionIterator &rhs)
Definition bslstl_vector.h:2328
Definition bslstl_vector.h:1025
void assign(size_type numElements, const VALUE_TYPE &value)
Definition bslstl_vector.h:3603
VALUE_TYPE & reference
Definition bslstl_vector.h:1049
const VALUE_TYPE & const_reference
Definition bslstl_vector.h:1050
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:4019
VALUE_TYPE value_type
Definition bslstl_vector.h:1047
void shrink_to_fit()
Definition bslstl_vector.h:3716
iterator insert(const_iterator position, const VALUE_TYPE &value)
Definition bslstl_vector.h:3803
~vector()
Destroy this vector.
Definition bslstl_vector.h:3488
AllocatorTraits::size_type size_type
Definition bslstl_vector.h:1052
ALLOCATOR allocator_type
Definition bslstl_vector.h:1048
VALUE_TYPE & emplace_back(Args &&... arguments)
Definition bslstl_vector.h:3741
void reserve(size_type newCapacity)
Definition bslstl_vector.h:3690
iterator erase(const_iterator first, const_iterator last)
Definition bslstl_vector.h:3947
void push_back(const VALUE_TYPE &value)
Definition bslstl_vector.h:3760
VALUE_TYPE * iterator
Definition bslstl_vector.h:1057
AllocatorTraits::difference_type difference_type
Definition bslstl_vector.h:1053
VALUE_TYPE const * const_iterator
Definition bslstl_vector.h:1058
bsl::reverse_iterator< iterator > reverse_iterator
Definition bslstl_vector.h:1059
iterator insert(const_iterator position, size_type numElements, const VALUE_TYPE &value)
Definition bslstl_vector.h:3867
iterator erase(const_iterator position)
Definition bslstl_vector.h:3933
size_type max_size() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:4029
iterator insert(const_iterator position, INPUT_ITER first, INPUT_ITER last)
Definition bslstl_vector.h:1633
void swap(vector &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:1712
bsl::reverse_iterator< const_iterator > const_reverse_iterator
Definition bslstl_vector.h:1060
AllocatorTraits::const_pointer const_pointer
Definition bslstl_vector.h:1055
vector & operator=(const vector &rhs)
Definition bslstl_vector.h:3512
void resize(size_type newSize)
Definition bslstl_vector.h:3616
vector() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:3292
void resize(size_type newSize, const VALUE_TYPE &value)
Definition bslstl_vector.h:3671
iterator insert(const_iterator position, BloombergLP::bslmf::MovableRef< VALUE_TYPE > value)
Definition bslstl_vector.h:3814
void pop_back()
Definition bslstl_vector.h:3792
vector &operator=(BloombergLP::bslmf::MovableRef< vector< VALUE_TYPE, ALLOCATOR > > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits void assign(INPUT_ITER first, INPUT_ITER last)
iterator emplace(const_iterator position, Args &&... arguments)
Definition bslstl_vector.h:1520
AllocatorTraits::pointer pointer
Definition bslstl_vector.h:1054
void push_back(BloombergLP::bslmf::MovableRef< VALUE_TYPE > value)
Definition bslstl_vector.h:3775
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_NOEXCEPT_OPERATOR(...)
Definition bsls_keyword.h:635
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:632
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:634
int assign(LHS_TYPE *lhs, const RHS_TYPE &rhs)
Definition bdlb_printmethods.h:283
void hashAppend(HASH_ALGORITHM &hashAlgorithm, const array< TYPE, SIZE > &input)
Pass the specified input to the specified hashAlgorithm
Definition bslstl_array.h:950
deque< VALUE_TYPE, ALLOCATOR >::size_type erase(deque< VALUE_TYPE, ALLOCATOR > &deq, const BDE_OTHER_TYPE &value)
Definition bslstl_deque.h:4126
T::iterator begin(T &container)
Definition bslstl_iterator.h:1495
BSLS_KEYWORD_CONSTEXPR size_t size(const TYPE(&)[DIMENSION]) BSLS_KEYWORD_NOEXCEPT
Return the dimension of the specified array argument.
Definition bslstl_iterator.h:1331
T::iterator end(T &container)
Definition bslstl_iterator.h:1523
deque< VALUE_TYPE, ALLOCATOR >::size_type erase_if(deque< VALUE_TYPE, ALLOCATOR > &deq, PREDICATE predicate)
Definition bslstl_deque.h:4135
BSLS_KEYWORD_CONSTEXPR CONTAINER::value_type * data(CONTAINER &container)
Definition bslstl_iterator.h:1231
BSLS_KEYWORD_CONSTEXPR bool empty(const CONTAINER &container)
Definition bslstl_iterator.h:1279
Definition bdlc_flathashmap.h:1805
Definition balxml_encoderoptions.h:68
Definition bdlbb_blob.h:576
Definition bdldfp_decimal.h:5188
BloombergLP::bslmf::Nil type
Definition bslstl_vector.h:740
Definition bslstl_vector.h:725
bsl::iterator_traits< BSLSTL_ITERATOR >::iterator_category type
Definition bslstl_vector.h:729
Definition bslstl_vector.h:691
static std::size_t computeNewCapacity(std::size_t newLength, std::size_t capacity, std::size_t maxSize)
static void swap(void *a, void *b)
Definition bslma_allocatortraits.h:1061
BloombergLP::bslma::AllocatorTraits_ConstPointerType< ALLOCATOR >::type const_pointer
Definition bslma_allocatortraits.h:1152
BloombergLP::bslma::AllocatorTraits_PropOnCopyAssign< ALLOCATOR >::type propagate_on_container_copy_assignment
Definition bslma_allocatortraits.h:1297
BloombergLP::bslma::AllocatorTraits_SizeType< ALLOCATOR_TYPE >::type size_type
Definition bslma_allocatortraits.h:1165
BloombergLP::bslma::AllocatorTraits_PointerType< ALLOCATOR >::type pointer
Definition bslma_allocatortraits.h:1149
static void destroy(ALLOCATOR_TYPE &basicAllocator, ELEMENT_TYPE *elementAddr)
Definition bslma_allocatortraits.h:1494
BloombergLP::bslma::AllocatorTraits_DifferenceType< ALLOCATOR >::type difference_type
Definition bslma_allocatortraits.h:1162
Definition bslmf_enableif.h:525
Definition bslmf_isconvertible.h:867
Definition bslmf_isfundamental.h:329
Definition bslmf_issame.h:146
Metafunction returning t_TYPE unchanged.
Definition bslmf_typeidentity.h:213
t_TYPE type
Definition bslmf_typeidentity.h:216
vector_UintPtrConversionIterator< TARGET *, ITERATOR > type
Definition bslstl_vector.h:772
Definition bslstl_vector.h:758
ITERATOR type
Definition bslstl_vector.h:761
Definition bslalg_hasstliterators.h:99
Definition bslma_usesbslmaallocator.h:343
Definition bslmf_isbitwisemoveable.h:718