@@ -47,7 +47,7 @@ _LIBCPP_PUSH_MACROS
47
47
_LIBCPP_BEGIN_NAMESPACE_STD
48
48
49
49
// __split_buffer allocates a contiguous chunk of memory and stores objects in the range [__begin_, __end_).
50
- // It has uninitialized memory in the ranges [__first_, __begin_) and [__end_, __end_cap_.first() ). That allows
50
+ // It has uninitialized memory in the ranges [__first_, __begin_) and [__end_, __cap_ ). That allows
51
51
// it to grow both in the front and back without having to move the data.
52
52
53
53
template <class _Tp , class _Allocator = allocator<_Tp> >
@@ -78,20 +78,20 @@ public:
78
78
pointer __first_;
79
79
pointer __begin_;
80
80
pointer __end_;
81
- _LIBCPP_COMPRESSED_PAIR (pointer, __end_cap_ , allocator_type, __alloc_);
81
+ _LIBCPP_COMPRESSED_PAIR (pointer, __cap_ , allocator_type, __alloc_);
82
82
83
83
__split_buffer (const __split_buffer&) = delete ;
84
84
__split_buffer& operator =(const __split_buffer&) = delete ;
85
85
86
86
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer ()
87
87
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
88
- : __first_(nullptr ), __begin_(nullptr ), __end_(nullptr ), __end_cap_ (nullptr ) {}
88
+ : __first_(nullptr ), __begin_(nullptr ), __end_(nullptr ), __cap_ (nullptr ) {}
89
89
90
90
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer (__alloc_rr& __a)
91
- : __first_(nullptr ), __begin_(nullptr ), __end_(nullptr ), __end_cap_ (nullptr ), __alloc_(__a) {}
91
+ : __first_(nullptr ), __begin_(nullptr ), __end_(nullptr ), __cap_ (nullptr ), __alloc_(__a) {}
92
92
93
93
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer (const __alloc_rr& __a)
94
- : __first_(nullptr ), __begin_(nullptr ), __end_(nullptr ), __end_cap_ (nullptr ), __alloc_(__a) {}
94
+ : __first_(nullptr ), __begin_(nullptr ), __end_(nullptr ), __cap_ (nullptr ), __alloc_(__a) {}
95
95
96
96
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
97
97
__split_buffer (size_type __cap, size_type __start, __alloc_rr& __a);
@@ -123,15 +123,15 @@ public:
123
123
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty () const { return __end_ == __begin_; }
124
124
125
125
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity () const {
126
- return static_cast <size_type>(__end_cap_ - __first_);
126
+ return static_cast <size_type>(__cap_ - __first_);
127
127
}
128
128
129
129
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __front_spare () const {
130
130
return static_cast <size_type>(__begin_ - __first_);
131
131
}
132
132
133
133
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __back_spare () const {
134
- return static_cast <size_type>(__end_cap_ - __end_);
134
+ return static_cast <size_type>(__cap_ - __end_);
135
135
}
136
136
137
137
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front () { return *__begin_; }
@@ -215,14 +215,14 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __split_buffer<_Tp, _Allocator>::__invariants
215
215
return false ;
216
216
if (__end_ != nullptr )
217
217
return false ;
218
- if (__end_cap_ != nullptr )
218
+ if (__cap_ != nullptr )
219
219
return false ;
220
220
} else {
221
221
if (__begin_ < __first_)
222
222
return false ;
223
223
if (__end_ < __begin_)
224
224
return false ;
225
- if (__end_cap_ < __end_)
225
+ if (__cap_ < __end_)
226
226
return false ;
227
227
}
228
228
return true ;
@@ -262,8 +262,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void
262
262
__split_buffer<_Tp, _Allocator>::__construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last) {
263
263
__alloc_rr& __a = __alloc_;
264
264
for (; __first != __last; ++__first) {
265
- if (__end_ == __end_cap_ ) {
266
- size_type __old_cap = __end_cap_ - __first_;
265
+ if (__end_ == __cap_ ) {
266
+ size_type __old_cap = __cap_ - __first_;
267
267
size_type __new_cap = std::max<size_type>(2 * __old_cap, 8 );
268
268
__split_buffer __buf (__new_cap, 0 , __a);
269
269
for (pointer __p = __begin_; __p != __end_; ++__p, (void )++__buf.__end_ )
@@ -320,7 +320,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type
320
320
template <class _Tp , class _Allocator >
321
321
_LIBCPP_CONSTEXPR_SINCE_CXX20
322
322
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
323
- : __end_cap_ (nullptr ), __alloc_(__a) {
323
+ : __cap_ (nullptr ), __alloc_(__a) {
324
324
if (__cap == 0 ) {
325
325
__first_ = nullptr ;
326
326
} else {
@@ -329,7 +329,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
329
329
__cap = __allocation.count ;
330
330
}
331
331
__begin_ = __end_ = __first_ + __start;
332
- __end_cap_ = __first_ + __cap;
332
+ __cap_ = __first_ + __cap;
333
333
}
334
334
335
335
template <class _Tp , class _Allocator >
@@ -345,32 +345,32 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(__
345
345
: __first_(std::move(__c.__first_)),
346
346
__begin_(std::move(__c.__begin_)),
347
347
__end_(std::move(__c.__end_)),
348
- __end_cap_ (std::move(__c.__end_cap_ )),
348
+ __cap_ (std::move(__c.__cap_ )),
349
349
__alloc_(std::move(__c.__alloc_)) {
350
- __c.__first_ = nullptr ;
351
- __c.__begin_ = nullptr ;
352
- __c.__end_ = nullptr ;
353
- __c.__end_cap_ = nullptr ;
350
+ __c.__first_ = nullptr ;
351
+ __c.__begin_ = nullptr ;
352
+ __c.__end_ = nullptr ;
353
+ __c.__cap_ = nullptr ;
354
354
}
355
355
356
356
template <class _Tp , class _Allocator >
357
357
_LIBCPP_CONSTEXPR_SINCE_CXX20
358
358
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
359
- : __end_cap_ (nullptr ), __alloc_(__a) {
359
+ : __cap_ (nullptr ), __alloc_(__a) {
360
360
if (__a == __c.__alloc_ ) {
361
- __first_ = __c.__first_ ;
362
- __begin_ = __c.__begin_ ;
363
- __end_ = __c.__end_ ;
364
- __end_cap_ = __c.__end_cap_ ;
365
- __c.__first_ = nullptr ;
366
- __c.__begin_ = nullptr ;
367
- __c.__end_ = nullptr ;
368
- __c.__end_cap_ = nullptr ;
361
+ __first_ = __c.__first_ ;
362
+ __begin_ = __c.__begin_ ;
363
+ __end_ = __c.__end_ ;
364
+ __cap_ = __c.__cap_ ;
365
+ __c.__first_ = nullptr ;
366
+ __c.__begin_ = nullptr ;
367
+ __c.__end_ = nullptr ;
368
+ __c.__cap_ = nullptr ;
369
369
} else {
370
370
auto __allocation = std::__allocate_at_least (__alloc_, __c.size ());
371
371
__first_ = __allocation.ptr ;
372
372
__begin_ = __end_ = __first_;
373
- __end_cap_ = __first_ + __allocation.count ;
373
+ __cap_ = __first_ + __allocation.count ;
374
374
typedef move_iterator<iterator> _Ip;
375
375
__construct_at_end (_Ip (__c.begin ()), _Ip (__c.end ()));
376
376
}
@@ -384,12 +384,12 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
384
384
!__alloc_traits::propagate_on_container_move_assignment::value) {
385
385
clear ();
386
386
shrink_to_fit ();
387
- __first_ = __c.__first_ ;
388
- __begin_ = __c.__begin_ ;
389
- __end_ = __c.__end_ ;
390
- __end_cap_ = __c.__end_cap_ ;
387
+ __first_ = __c.__first_ ;
388
+ __begin_ = __c.__begin_ ;
389
+ __end_ = __c.__end_ ;
390
+ __cap_ = __c.__cap_ ;
391
391
__move_assign_alloc (__c, integral_constant<bool , __alloc_traits::propagate_on_container_move_assignment::value>());
392
- __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap_ = nullptr ;
392
+ __c.__first_ = __c.__begin_ = __c.__end_ = __c.__cap_ = nullptr ;
393
393
return *this ;
394
394
}
395
395
@@ -399,7 +399,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::swap(__split
399
399
std::swap (__first_, __x.__first_ );
400
400
std::swap (__begin_, __x.__begin_ );
401
401
std::swap (__end_, __x.__end_ );
402
- std::swap (__end_cap_ , __x.__end_cap_ );
402
+ std::swap (__cap_ , __x.__cap_ );
403
403
std::__swap_allocator (__alloc_, __x.__alloc_ );
404
404
}
405
405
@@ -415,7 +415,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fi
415
415
std::swap (__first_, __t .__first_ );
416
416
std::swap (__begin_, __t .__begin_ );
417
417
std::swap (__end_, __t .__end_ );
418
- std::swap (__end_cap_ , __t .__end_cap_ );
418
+ std::swap (__cap_ , __t .__cap_ );
419
419
#if _LIBCPP_HAS_EXCEPTIONS
420
420
} catch (...) {
421
421
}
@@ -427,19 +427,19 @@ template <class _Tp, class _Allocator>
427
427
template <class ... _Args>
428
428
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_front (_Args&&... __args) {
429
429
if (__begin_ == __first_) {
430
- if (__end_ < __end_cap_ ) {
431
- difference_type __d = __end_cap_ - __end_;
430
+ if (__end_ < __cap_ ) {
431
+ difference_type __d = __cap_ - __end_;
432
432
__d = (__d + 1 ) / 2 ;
433
433
__begin_ = std::move_backward (__begin_, __end_, __end_ + __d);
434
434
__end_ += __d;
435
435
} else {
436
- size_type __c = std::max<size_type>(2 * static_cast <size_t >(__end_cap_ - __first_), 1 );
436
+ size_type __c = std::max<size_type>(2 * static_cast <size_t >(__cap_ - __first_), 1 );
437
437
__split_buffer<value_type, __alloc_rr&> __t (__c, (__c + 3 ) / 4 , __alloc_);
438
438
__t .__construct_at_end (move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
439
439
std::swap (__first_, __t .__first_ );
440
440
std::swap (__begin_, __t .__begin_ );
441
441
std::swap (__end_, __t .__end_ );
442
- std::swap (__end_cap_ , __t .__end_cap_ );
442
+ std::swap (__cap_ , __t .__cap_ );
443
443
}
444
444
}
445
445
__alloc_traits::construct (__alloc_, std::__to_address (__begin_ - 1 ), std::forward<_Args>(__args)...);
@@ -449,20 +449,20 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_fron
449
449
template <class _Tp , class _Allocator >
450
450
template <class ... _Args>
451
451
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_back (_Args&&... __args) {
452
- if (__end_ == __end_cap_ ) {
452
+ if (__end_ == __cap_ ) {
453
453
if (__begin_ > __first_) {
454
454
difference_type __d = __begin_ - __first_;
455
455
__d = (__d + 1 ) / 2 ;
456
456
__end_ = std::move (__begin_, __end_, __begin_ - __d);
457
457
__begin_ -= __d;
458
458
} else {
459
- size_type __c = std::max<size_type>(2 * static_cast <size_t >(__end_cap_ - __first_), 1 );
459
+ size_type __c = std::max<size_type>(2 * static_cast <size_t >(__cap_ - __first_), 1 );
460
460
__split_buffer<value_type, __alloc_rr&> __t (__c, __c / 4 , __alloc_);
461
461
__t .__construct_at_end (move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
462
462
std::swap (__first_, __t .__first_ );
463
463
std::swap (__begin_, __t .__begin_ );
464
464
std::swap (__end_, __t .__end_ );
465
- std::swap (__end_cap_ , __t .__end_cap_ );
465
+ std::swap (__cap_ , __t .__cap_ );
466
466
}
467
467
}
468
468
__alloc_traits::construct (__alloc_, std::__to_address (__end_), std::forward<_Args>(__args)...);
0 commit comments