58 #pragma push_macro("max")
59 #pragma push_macro("min")
65 NAMESPACE_BENTLEY_BSTDCXX_BEGIN
67 template <
class _TypeT,
class _Allocator>
72 #ifndef _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
74 if (capacity () < __rhs.
size ())
76 else if (&__rhs !=
this)
77 assign (__rhs.
begin (), __rhs.
end ());
79 #else // if defined (_RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE)
83 #endif // _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
89 template <
class _TypeT,
class _Allocator>
94 const size_type __max_size =
max_size ();
101 if (__max_size < __cap)
108 __tmp._C_alloc._C_begin = _C_alloc.allocate (__cap,
this);
111 __tmp._C_alloc._C_end = __tmp._C_alloc._C_begin;
112 __tmp._C_alloc._C_bufend = __tmp._C_alloc._C_begin + __cap;
119 for (pointer __ptr = _C_alloc._C_begin; !(__ptr == _C_alloc._C_end);
121 __tmp._C_push_back (*__ptr);
129 template <
class _TypeT,
class _Allocator>
133 _RWSTD_ASSERT_RANGE (__first,
end ());
135 for (size_type __n =
end () - __first; !(0 == __n); --__n)
136 _C_alloc.destroy (--_C_alloc._C_end);
140 template <
class _TypeT,
class _Allocator>
156 _RWSTD_ASSERT (__tmp.get_allocator () == __other.
get_allocator ());
159 assign (__other.
begin (), __other.
end ());
160 __other.
swap (__tmp);
164 template <
class _TypeT,
class _Allocator>
168 #ifndef _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
175 #else // if defined (_RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE)
180 #endif // _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
184 template <
class _TypeT,
class _Allocator>
186 _C_insert_1 (
const iterator &__it, const_reference __x)
188 _RWSTD_ASSERT_RANGE (
begin (), __it);
190 if (
size () < capacity ()) {
194 const pointer __end = _C_alloc._C_end;
199 _C_push_back (*(_C_alloc._C_end - difference_type (1)));
203 std::copy_backward (__it,
end () - 2, __end);
215 _C_insert_n (__it, size_type (1), __x);
220 template <
class _TypeT,
class _Allocator>
222 _C_insert_n (
const iterator &__it, size_type __n, const_reference __x)
224 _RWSTD_ASSERT_RANGE (
begin (), __it);
233 const size_type __size1 = BC__DISTANCE (
begin (), __it, size_type);
234 const size_type __size2 =
size () + __n;
236 if (capacity () < __size2) {
240 __tmp.reserve (__size2);
242 _RWSTD_ASSERT (!(pointer () == __tmp._C_alloc._C_end));
248 for (__i =
begin (); !(__i == __it); ++__i) {
250 _RWSTD_ASSERT (!( __tmp._C_alloc._C_end
251 == __tmp._C_alloc._C_bufend));
253 __tmp._C_push_back (*__i);
259 for ( ; __n; --__n) {
261 _RWSTD_ASSERT (!( __tmp._C_alloc._C_end
262 == __tmp._C_alloc._C_bufend));
264 __tmp._C_push_back (__x);
272 for (__i = __it; !(__i ==
end ()); ++__i) {
274 _RWSTD_ASSERT (!( __tmp._C_alloc._C_end
275 == __tmp._C_alloc._C_bufend));
277 __tmp._C_push_back (*__i);
290 const pointer __movbeg = _C_alloc._C_begin + __size1;
291 const pointer __movend = __movbeg + __n;
293 _RWSTD_ASSERT (_C_make_iter (__movbeg) == __it);
295 if (__movend <= _C_alloc._C_end) {
303 const pointer __ucpbeg = _C_alloc._C_end - __n;
304 const pointer __ucpend = _C_alloc._C_end;
308 BC__RW::uninitialized_copy (__ucpbeg, _C_alloc._C_end,
309 _C_alloc._C_end, _C_alloc);
312 _C_alloc._C_end += __n;
316 std::copy_backward (__movbeg, __ucpbeg, __ucpend);
323 const size_type __n1 =
size () - __size1;
324 const size_type __n2 = __n - __n1;
326 BC__RW::uninitialized_fill_n (_C_alloc._C_end, __n2, __x, _C_alloc);
328 const pointer __end = _C_alloc._C_end;
330 _C_alloc._C_end += __n2;
334 BC__RW::uninitialized_copy (__movbeg, __end, _C_alloc._C_end, _C_alloc);
336 _C_alloc._C_end += __end - __movbeg;
341 std::fill_n (__movbeg, __n, __x);
345 template<
class _TypeT,
class _Allocator>
346 template<
class _InputIter>
348 _C_assign_range (_InputIter __first, _InputIter __last, std::input_iterator_tag)
350 _RWSTD_ASSERT_RANGE (__first, __last);
352 #ifndef _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
368 const iterator __end = this->
end ();
370 for (iterator __it = this->
begin (); __it != __end; ++__it, ++__first) {
371 if (__first == __last) {
372 this->
erase (__it, __end);
378 this->
insert (__end, __first, __last);
380 #else // if defined (_RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE)
391 #endif // _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
396 template <
class _TypeT,
class _Allocator>
397 template <
class _FwdIter>
399 _C_assign_range (_FwdIter __first, _FwdIter __last, std::forward_iterator_tag)
401 _RWSTD_ASSERT_RANGE (__first, __last);
403 #ifndef _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
415 const size_type __size1 = BC__DISTANCE (__first, __last, size_type);
416 const size_type __size2 = this->
size () + __size1;
418 if (this->capacity () < __size2) {
423 __tmp.reserve (__size2);
431 for ( ; !(__first == __last); ++__first)
432 __tmp._C_push_back (*__first);
440 const iterator __end = this->
end ();
442 for (iterator __i = this->
begin (); __i != __end; ++__i, ++__first) {
443 if (__first == __last) {
444 this->
erase (__i, __end);
450 this->
insert (__end, __first, __last);
453 #else // if defined (_RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE)
463 #endif // _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
468 template <
class _TypeT,
class _Allocator>
469 template <
class _InputIter>
472 std::input_iterator_tag)
474 _RWSTD_ASSERT_RANGE (__it,
end ());
475 _RWSTD_ASSERT_RANGE (__first, __last);
477 #ifndef _RWSTD_NO_EXT_VECTOR_INSERT_IN_PLACE
488 const size_type __size = this->
size ();
489 const size_type __inx = BC__DISTANCE (this->
begin (), __it, size_type);
491 _RWSTD_ASSERT (__inx <= __size);
493 for (; !(__first == __last); ++__first)
494 this->push_back (*__first);
496 if (__inx < __size) {
500 const pointer __beg = this->_C_alloc._C_begin + __inx;
501 const pointer __mid = this->_C_alloc._C_begin + __size;
504 for (pointer __p0 = __beg, __p1 = __mid; __p0 < --__p1; ++__p0)
505 std::iter_swap (__p0, __p1);
508 if (__mid < this->_C_alloc._C_end) {
509 for (pointer __p0 = __mid, __p1 = this->_C_alloc._C_end;
510 __p0 < --__p1; ++__p0)
511 std::iter_swap (__p0, __p1);
514 if (__beg < this->_C_alloc._C_end) {
515 for (pointer __p0 = __beg, __p1 = this->_C_alloc._C_end;
516 __p0 < --__p1; ++__p0)
517 std::iter_swap (__p0, __p1);
521 #else // if defined (_RWSTD_NO_EXT_VECTOR_INSERT_IN_PLACE)
538 for ( ; !(__first == __last); ++__first)
539 __tmp.push_back (*__first);
543 this->
insert (__it, __tmp.begin (), __tmp.end ());
545 #endif // _RWSTD_NO_EXT_VECTOR_INSERT_IN_PLACE
550 template <
class _TypeT,
class _Allocator>
551 template <
class _FwdIter>
554 std::forward_iterator_tag)
556 _RWSTD_ASSERT_RANGE (__it,
end ());
557 _RWSTD_ASSERT_RANGE (__first, __last);
563 const size_type __size1 = BC__DISTANCE (this->
begin (), __it, size_type);
564 const size_type __size2 = BC__DISTANCE (__first, __last, size_type);
569 #ifndef _RWSTD_NO_EXT_VECTOR_INSERT_IN_PLACE
570 const bool __insert_in_place =
571 this->
size () + __size2 <= this->capacity ();
572 #else // if defined (_RWSTD_NO_EXT_VECTOR_INSERT_IN_PLACE)
573 const bool __insert_in_place =
false;
574 #endif // _RWSTD_NO_EXT_VECTOR_INSERT_IN_PLACE
576 if (__insert_in_place) {
582 const pointer __movbeg = this->_C_alloc._C_begin + __size1;
583 const pointer __movend = __movbeg + __size2;
585 _RWSTD_ASSERT (this->_C_make_iter (__movbeg) == __it);
587 const pointer __end = this->_C_alloc._C_end;
589 if (__movend <= __end) {
593 const pointer __ucpbeg = __end - __size2;
597 for (pointer __p = __ucpbeg; !(__p == __end); ++__p)
598 this->_C_push_back (*__p);
601 for (pointer __q = __end; __movend < __q; ) {
603 *__q = *(__q - __size2);
610 const size_type __size2a = this->
size () - __size1;
611 _FwdIter __mid = __first;
612 std::advance (__mid, __size2a);
618 for (_FwdIter __m = __mid ; !(__m == __last); ++__m)
619 this->_C_push_back (*__m);
626 for (pointer __p = __movbeg; !(__p == __end); ++__p)
627 this->_C_push_back (*__p);
632 std::copy (__first, __last, __movbeg);
641 __tmp.reserve (this->
size () + __size2);
654 for (__ix = this->
begin (); __ix != __it; ++__ix) {
655 __tmp._C_push_back (*__ix);
661 for (; !(__first == __last); ++__first) {
662 __tmp._C_push_back (*__first);
666 for ( ; __ix != this->
end (); ++__ix) {
667 __tmp._C_push_back (*__ix);
676 NAMESPACE_BENTLEY_BSTDCXX_END
680 #pragma pop_macro("max")
681 #pragma pop_macro("min")
void assign(_InputIter __first, _InputIter __last)
Definition: stdcxx/bvector.h:238
iterator begin()
Definition: stdcxx/bstdmap.h:178
iterator end()
Definition: stdcxx/bstdmap.h:186
void swap(basic_string< _CharT, _Traits, _Allocator > &__a, basic_string< _CharT, _Traits, _Allocator > &__b)
Definition: basic_string.h:1396
iterator begin()
Definition: stdcxx/bvector.h:251
iterator erase(iterator __it)
Definition: stdcxx/bstdmap.h:242
bvector & operator=(bvector &&rhs)
Definition: stdcxx/bvector.h:194
#define max(x, y)
Definition: MathUtils.h:24
size_type size() const
Definition: stdcxx/bvector.h:283
size_type max_size() const
Definition: stdcxx/bstdmap.h:218
A Bentley supplied implementation std::vector.
Definition: stdcxx/bvector.h:77
iterator end()
Definition: stdcxx/bvector.h:259
allocator_type get_allocator() const
Definition: stdcxx/bstdmap.h:174
void clear()
Definition: stdcxx/bstdmap.h:257
size_type size() const
Definition: stdcxx/bstdmap.h:214
allocator_type get_allocator() const
Definition: stdcxx/bvector.h:247
bpair< iterator, bool > insert(const value_type &__x)
Definition: stdcxx/bstdmap.h:228