@@ -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_; }
@@ -219,14 +219,14 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __split_buffer<_Tp, _Allocator>::__invariants
219
219
return false ;
220
220
if (__end_ != nullptr )
221
221
return false ;
222
- if (__end_cap_ != nullptr )
222
+ if (__cap_ != nullptr )
223
223
return false ;
224
224
} else {
225
225
if (__begin_ < __first_)
226
226
return false ;
227
227
if (__end_ < __begin_)
228
228
return false ;
229
- if (__end_cap_ < __end_)
229
+ if (__cap_ < __end_)
230
230
return false ;
231
231
}
232
232
return true ;
@@ -273,8 +273,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void
273
273
__split_buffer<_Tp, _Allocator>::__construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last) {
274
274
__alloc_rr& __a = __alloc_;
275
275
for (; __first != __last; ++__first) {
276
- if (__end_ == __end_cap_ ) {
277
- size_type __old_cap = __end_cap_ - __first_;
276
+ if (__end_ == __cap_ ) {
277
+ size_type __old_cap = __cap_ - __first_;
278
278
size_type __new_cap = std::max<size_type>(2 * __old_cap, 8 );
279
279
__split_buffer __buf (__new_cap, 0 , __a);
280
280
for (pointer __p = __begin_; __p != __end_; ++__p, (void )++__buf.__end_ )
@@ -331,7 +331,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type
331
331
template <class _Tp , class _Allocator >
332
332
_LIBCPP_CONSTEXPR_SINCE_CXX20
333
333
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
334
- : __end_cap_ (nullptr ), __alloc_(__a) {
334
+ : __cap_ (nullptr ), __alloc_(__a) {
335
335
if (__cap == 0 ) {
336
336
__first_ = nullptr ;
337
337
} else {
@@ -340,7 +340,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
340
340
__cap = __allocation.count ;
341
341
}
342
342
__begin_ = __end_ = __first_ + __start;
343
- __end_cap_ = __first_ + __cap;
343
+ __cap_ = __first_ + __cap;
344
344
}
345
345
346
346
template <class _Tp , class _Allocator >
@@ -356,32 +356,32 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(__
356
356
: __first_(std::move(__c.__first_)),
357
357
__begin_(std::move(__c.__begin_)),
358
358
__end_(std::move(__c.__end_)),
359
- __end_cap_ (std::move(__c.__end_cap_ )),
359
+ __cap_ (std::move(__c.__cap_ )),
360
360
__alloc_(std::move(__c.__alloc_)) {
361
361
__c.__first_ = nullptr ;
362
362
__c.__begin_ = nullptr ;
363
363
__c.__end_ = nullptr ;
364
- __c.__end_cap_ = nullptr ;
364
+ __c.__cap_ = nullptr ;
365
365
}
366
366
367
367
template <class _Tp , class _Allocator >
368
368
_LIBCPP_CONSTEXPR_SINCE_CXX20
369
369
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
370
- : __end_cap_ (nullptr ), __alloc_(__a) {
370
+ : __cap_ (nullptr ), __alloc_(__a) {
371
371
if (__a == __c.__alloc_ ) {
372
372
__first_ = __c.__first_ ;
373
373
__begin_ = __c.__begin_ ;
374
374
__end_ = __c.__end_ ;
375
- __end_cap_ = __c.__end_cap_ ;
375
+ __cap_ = __c.__cap_ ;
376
376
__c.__first_ = nullptr ;
377
377
__c.__begin_ = nullptr ;
378
378
__c.__end_ = nullptr ;
379
- __c.__end_cap_ = nullptr ;
379
+ __c.__cap_ = nullptr ;
380
380
} else {
381
381
auto __allocation = std::__allocate_at_least (__alloc_, __c.size ());
382
382
__first_ = __allocation.ptr ;
383
383
__begin_ = __end_ = __first_;
384
- __end_cap_ = __first_ + __allocation.count ;
384
+ __cap_ = __first_ + __allocation.count ;
385
385
typedef move_iterator<iterator> _Ip;
386
386
__construct_at_end (_Ip (__c.begin ()), _Ip (__c.end ()));
387
387
}
@@ -398,9 +398,9 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
398
398
__first_ = __c.__first_ ;
399
399
__begin_ = __c.__begin_ ;
400
400
__end_ = __c.__end_ ;
401
- __end_cap_ = __c.__end_cap_ ;
401
+ __cap_ = __c.__cap_ ;
402
402
__move_assign_alloc (__c, integral_constant<bool , __alloc_traits::propagate_on_container_move_assignment::value>());
403
- __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap_ = nullptr ;
403
+ __c.__first_ = __c.__begin_ = __c.__end_ = __c.__cap_ = nullptr ;
404
404
return *this ;
405
405
}
406
406
@@ -410,7 +410,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::swap(__split
410
410
std::swap (__first_, __x.__first_ );
411
411
std::swap (__begin_, __x.__begin_ );
412
412
std::swap (__end_, __x.__end_ );
413
- std::swap (__end_cap_ , __x.__end_cap_ );
413
+ std::swap (__cap_ , __x.__cap_ );
414
414
std::__swap_allocator (__alloc_, __x.__alloc_ );
415
415
}
416
416
@@ -422,7 +422,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::reserve(size
422
422
std::swap (__first_, __t .__first_ );
423
423
std::swap (__begin_, __t .__begin_ );
424
424
std::swap (__end_, __t .__end_ );
425
- std::swap (__end_cap_ , __t .__end_cap_ );
425
+ std::swap (__cap_ , __t .__cap_ );
426
426
}
427
427
}
428
428
@@ -438,7 +438,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fi
438
438
std::swap (__first_, __t .__first_ );
439
439
std::swap (__begin_, __t .__begin_ );
440
440
std::swap (__end_, __t .__end_ );
441
- std::swap (__end_cap_ , __t .__end_cap_ );
441
+ std::swap (__cap_ , __t .__cap_ );
442
442
#if _LIBCPP_HAS_EXCEPTIONS
443
443
} catch (...) {
444
444
}
@@ -450,19 +450,19 @@ template <class _Tp, class _Allocator>
450
450
template <class ... _Args>
451
451
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_front (_Args&&... __args) {
452
452
if (__begin_ == __first_) {
453
- if (__end_ < __end_cap_ ) {
454
- difference_type __d = __end_cap_ - __end_;
453
+ if (__end_ < __cap_ ) {
454
+ difference_type __d = __cap_ - __end_;
455
455
__d = (__d + 1 ) / 2 ;
456
456
__begin_ = std::move_backward (__begin_, __end_, __end_ + __d);
457
457
__end_ += __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 + 3 ) / 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 (__begin_ - 1 ), std::forward<_Args>(__args)...);
@@ -472,20 +472,20 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_fron
472
472
template <class _Tp , class _Allocator >
473
473
template <class ... _Args>
474
474
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_back (_Args&&... __args) {
475
- if (__end_ == __end_cap_ ) {
475
+ if (__end_ == __cap_ ) {
476
476
if (__begin_ > __first_) {
477
477
difference_type __d = __begin_ - __first_;
478
478
__d = (__d + 1 ) / 2 ;
479
479
__end_ = std::move (__begin_, __end_, __begin_ - __d);
480
480
__begin_ -= __d;
481
481
} else {
482
- size_type __c = std::max<size_type>(2 * static_cast <size_t >(__end_cap_ - __first_), 1 );
482
+ size_type __c = std::max<size_type>(2 * static_cast <size_t >(__cap_ - __first_), 1 );
483
483
__split_buffer<value_type, __alloc_rr&> __t (__c, __c / 4 , __alloc_);
484
484
__t .__construct_at_end (move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
485
485
std::swap (__first_, __t .__first_ );
486
486
std::swap (__begin_, __t .__begin_ );
487
487
std::swap (__end_, __t .__end_ );
488
- std::swap (__end_cap_ , __t .__end_cap_ );
488
+ std::swap (__cap_ , __t .__cap_ );
489
489
}
490
490
}
491
491
__alloc_traits::construct (__alloc_, std::__to_address (__end_), std::forward<_Args>(__args)...);
0 commit comments