@@ -108,12 +108,6 @@ public:
108
108
109
109
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~__split_buffer ();
110
110
111
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __alloc_rr& __alloc () _NOEXCEPT { return __alloc_; }
112
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const __alloc_rr& __alloc () const _NOEXCEPT { return __alloc_; }
113
-
114
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer& __end_cap () _NOEXCEPT { return __end_cap_; }
115
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const pointer& __end_cap () const _NOEXCEPT { return __end_cap_; }
116
-
117
111
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin () _NOEXCEPT { return __begin_; }
118
112
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin () const _NOEXCEPT { return __begin_; }
119
113
@@ -129,15 +123,15 @@ public:
129
123
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty () const { return __end_ == __begin_; }
130
124
131
125
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity () const {
132
- return static_cast <size_type>(__end_cap () - __first_);
126
+ return static_cast <size_type>(__end_cap_ - __first_);
133
127
}
134
128
135
129
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __front_spare () const {
136
130
return static_cast <size_type>(__begin_ - __first_);
137
131
}
138
132
139
133
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __back_spare () const {
140
- return static_cast <size_type>(__end_cap () - __end_);
134
+ return static_cast <size_type>(__end_cap_ - __end_);
141
135
}
142
136
143
137
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front () { return *__begin_; }
@@ -196,7 +190,7 @@ public:
196
190
private:
197
191
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc (__split_buffer& __c, true_type)
198
192
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
199
- __alloc () = std::move (__c.__alloc () );
193
+ __alloc_ = std::move (__c.__alloc_ );
200
194
}
201
195
202
196
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc (__split_buffer&, false_type) _NOEXCEPT {}
@@ -225,14 +219,14 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __split_buffer<_Tp, _Allocator>::__invariants
225
219
return false ;
226
220
if (__end_ != nullptr )
227
221
return false ;
228
- if (__end_cap () != nullptr )
222
+ if (__end_cap_ != nullptr )
229
223
return false ;
230
224
} else {
231
225
if (__begin_ < __first_)
232
226
return false ;
233
227
if (__end_ < __begin_)
234
228
return false ;
235
- if (__end_cap () < __end_)
229
+ if (__end_cap_ < __end_)
236
230
return false ;
237
231
}
238
232
return true ;
@@ -247,7 +241,7 @@ template <class _Tp, class _Allocator>
247
241
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) {
248
242
_ConstructTransaction __tx (&this ->__end_ , __n);
249
243
for (; __tx.__pos_ != __tx.__end_ ; ++__tx.__pos_ ) {
250
- __alloc_traits::construct (this -> __alloc () , std::__to_address (__tx.__pos_ ));
244
+ __alloc_traits::construct (__alloc_ , std::__to_address (__tx.__pos_ ));
251
245
}
252
246
}
253
247
@@ -262,7 +256,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void
262
256
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) {
263
257
_ConstructTransaction __tx (&this ->__end_ , __n);
264
258
for (; __tx.__pos_ != __tx.__end_ ; ++__tx.__pos_ ) {
265
- __alloc_traits::construct (this -> __alloc () , std::__to_address (__tx.__pos_ ), __x);
259
+ __alloc_traits::construct (__alloc_ , std::__to_address (__tx.__pos_ ), __x);
266
260
}
267
261
}
268
262
@@ -277,14 +271,14 @@ template <class _Tp, class _Allocator>
277
271
template <class _Iterator , class _Sentinel >
278
272
_LIBCPP_CONSTEXPR_SINCE_CXX20 void
279
273
__split_buffer<_Tp, _Allocator>::__construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last) {
280
- __alloc_rr& __a = this -> __alloc () ;
274
+ __alloc_rr& __a = __alloc_ ;
281
275
for (; __first != __last; ++__first) {
282
- if (__end_ == __end_cap () ) {
283
- size_type __old_cap = __end_cap () - __first_;
276
+ if (__end_ == __end_cap_ ) {
277
+ size_type __old_cap = __end_cap_ - __first_;
284
278
size_type __new_cap = std::max<size_type>(2 * __old_cap, 8 );
285
279
__split_buffer __buf (__new_cap, 0 , __a);
286
280
for (pointer __p = __begin_; __p != __end_; ++__p, (void )++__buf.__end_ )
287
- __alloc_traits::construct (__buf.__alloc () , std::__to_address (__buf.__end_ ), std::move (*__p));
281
+ __alloc_traits::construct (__buf.__alloc_ , std::__to_address (__buf.__end_ ), std::move (*__p));
288
282
swap (__buf);
289
283
}
290
284
__alloc_traits::construct (__a, std::__to_address (this ->__end_ ), *__first);
@@ -304,15 +298,15 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void
304
298
__split_buffer<_Tp, _Allocator>::__construct_at_end_with_size(_ForwardIterator __first, size_type __n) {
305
299
_ConstructTransaction __tx (&this ->__end_ , __n);
306
300
for (; __tx.__pos_ != __tx.__end_ ; ++__tx.__pos_ , (void )++__first) {
307
- __alloc_traits::construct (this -> __alloc () , std::__to_address (__tx.__pos_ ), *__first);
301
+ __alloc_traits::construct (__alloc_ , std::__to_address (__tx.__pos_ ), *__first);
308
302
}
309
303
}
310
304
311
305
template <class _Tp , class _Allocator >
312
306
_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
313
307
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) {
314
308
while (__begin_ != __new_begin)
315
- __alloc_traits::destroy (__alloc () , std::__to_address (__begin_++));
309
+ __alloc_traits::destroy (__alloc_ , std::__to_address (__begin_++));
316
310
}
317
311
318
312
template <class _Tp , class _Allocator >
@@ -325,7 +319,7 @@ template <class _Tp, class _Allocator>
325
319
_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void
326
320
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT {
327
321
while (__new_last != __end_)
328
- __alloc_traits::destroy (__alloc () , std::__to_address (--__end_));
322
+ __alloc_traits::destroy (__alloc_ , std::__to_address (--__end_));
329
323
}
330
324
331
325
template <class _Tp , class _Allocator >
@@ -341,19 +335,19 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
341
335
if (__cap == 0 ) {
342
336
__first_ = nullptr ;
343
337
} else {
344
- auto __allocation = std::__allocate_at_least (__alloc () , __cap);
338
+ auto __allocation = std::__allocate_at_least (__alloc_ , __cap);
345
339
__first_ = __allocation.ptr ;
346
340
__cap = __allocation.count ;
347
341
}
348
342
__begin_ = __end_ = __first_ + __start;
349
- __end_cap () = __first_ + __cap;
343
+ __end_cap_ = __first_ + __cap;
350
344
}
351
345
352
346
template <class _Tp , class _Allocator >
353
347
_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::~__split_buffer () {
354
348
clear ();
355
349
if (__first_)
356
- __alloc_traits::deallocate (__alloc () , __first_, capacity ());
350
+ __alloc_traits::deallocate (__alloc_ , __first_, capacity ());
357
351
}
358
352
359
353
template <class _Tp , class _Allocator >
@@ -364,30 +358,30 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(__
364
358
__end_(std::move(__c.__end_)),
365
359
__end_cap_(std::move(__c.__end_cap_)),
366
360
__alloc_(std::move(__c.__alloc_)) {
367
- __c.__first_ = nullptr ;
368
- __c.__begin_ = nullptr ;
369
- __c.__end_ = nullptr ;
370
- __c.__end_cap () = nullptr ;
361
+ __c.__first_ = nullptr ;
362
+ __c.__begin_ = nullptr ;
363
+ __c.__end_ = nullptr ;
364
+ __c.__end_cap_ = nullptr ;
371
365
}
372
366
373
367
template <class _Tp , class _Allocator >
374
368
_LIBCPP_CONSTEXPR_SINCE_CXX20
375
369
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
376
370
: __end_cap_(nullptr ), __alloc_(__a) {
377
- if (__a == __c.__alloc () ) {
378
- __first_ = __c.__first_ ;
379
- __begin_ = __c.__begin_ ;
380
- __end_ = __c.__end_ ;
381
- __end_cap () = __c.__end_cap () ;
382
- __c.__first_ = nullptr ;
383
- __c.__begin_ = nullptr ;
384
- __c.__end_ = nullptr ;
385
- __c.__end_cap () = nullptr ;
371
+ if (__a == __c.__alloc_ ) {
372
+ __first_ = __c.__first_ ;
373
+ __begin_ = __c.__begin_ ;
374
+ __end_ = __c.__end_ ;
375
+ __end_cap_ = __c.__end_cap_ ;
376
+ __c.__first_ = nullptr ;
377
+ __c.__begin_ = nullptr ;
378
+ __c.__end_ = nullptr ;
379
+ __c.__end_cap_ = nullptr ;
386
380
} else {
387
- auto __allocation = std::__allocate_at_least (__alloc () , __c.size ());
381
+ auto __allocation = std::__allocate_at_least (__alloc_ , __c.size ());
388
382
__first_ = __allocation.ptr ;
389
383
__begin_ = __end_ = __first_;
390
- __end_cap () = __first_ + __allocation.count ;
384
+ __end_cap_ = __first_ + __allocation.count ;
391
385
typedef move_iterator<iterator> _Ip;
392
386
__construct_at_end (_Ip (__c.begin ()), _Ip (__c.end ()));
393
387
}
@@ -401,12 +395,12 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
401
395
!__alloc_traits::propagate_on_container_move_assignment::value) {
402
396
clear ();
403
397
shrink_to_fit ();
404
- __first_ = __c.__first_ ;
405
- __begin_ = __c.__begin_ ;
406
- __end_ = __c.__end_ ;
407
- __end_cap () = __c.__end_cap () ;
398
+ __first_ = __c.__first_ ;
399
+ __begin_ = __c.__begin_ ;
400
+ __end_ = __c.__end_ ;
401
+ __end_cap_ = __c.__end_cap_ ;
408
402
__move_assign_alloc (__c, integral_constant<bool , __alloc_traits::propagate_on_container_move_assignment::value>());
409
- __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap () = nullptr ;
403
+ __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap_ = nullptr ;
410
404
return *this ;
411
405
}
412
406
@@ -416,19 +410,19 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::swap(__split
416
410
std::swap (__first_, __x.__first_ );
417
411
std::swap (__begin_, __x.__begin_ );
418
412
std::swap (__end_, __x.__end_ );
419
- std::swap (__end_cap () , __x.__end_cap () );
420
- std::__swap_allocator (__alloc () , __x.__alloc () );
413
+ std::swap (__end_cap_ , __x.__end_cap_ );
414
+ std::__swap_allocator (__alloc_ , __x.__alloc_ );
421
415
}
422
416
423
417
template <class _Tp , class _Allocator >
424
418
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::reserve(size_type __n) {
425
419
if (__n < capacity ()) {
426
- __split_buffer<value_type, __alloc_rr&> __t (__n, 0 , __alloc () );
420
+ __split_buffer<value_type, __alloc_rr&> __t (__n, 0 , __alloc_ );
427
421
__t .__construct_at_end (move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
428
422
std::swap (__first_, __t .__first_ );
429
423
std::swap (__begin_, __t .__begin_ );
430
424
std::swap (__end_, __t .__end_ );
431
- std::swap (__end_cap () , __t .__end_cap () );
425
+ std::swap (__end_cap_ , __t .__end_cap_ );
432
426
}
433
427
}
434
428
@@ -438,13 +432,13 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fi
438
432
#if _LIBCPP_HAS_EXCEPTIONS
439
433
try {
440
434
#endif // _LIBCPP_HAS_EXCEPTIONS
441
- __split_buffer<value_type, __alloc_rr&> __t (size (), 0 , __alloc () );
435
+ __split_buffer<value_type, __alloc_rr&> __t (size (), 0 , __alloc_ );
442
436
__t .__construct_at_end (move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
443
437
__t .__end_ = __t .__begin_ + (__end_ - __begin_);
444
438
std::swap (__first_, __t .__first_ );
445
439
std::swap (__begin_, __t .__begin_ );
446
440
std::swap (__end_, __t .__end_ );
447
- std::swap (__end_cap () , __t .__end_cap () );
441
+ std::swap (__end_cap_ , __t .__end_cap_ );
448
442
#if _LIBCPP_HAS_EXCEPTIONS
449
443
} catch (...) {
450
444
}
@@ -456,45 +450,45 @@ template <class _Tp, class _Allocator>
456
450
template <class ... _Args>
457
451
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_front (_Args&&... __args) {
458
452
if (__begin_ == __first_) {
459
- if (__end_ < __end_cap () ) {
460
- difference_type __d = __end_cap () - __end_;
453
+ if (__end_ < __end_cap_ ) {
454
+ difference_type __d = __end_cap_ - __end_;
461
455
__d = (__d + 1 ) / 2 ;
462
456
__begin_ = std::move_backward (__begin_, __end_, __end_ + __d);
463
457
__end_ += __d;
464
458
} else {
465
- size_type __c = std::max<size_type>(2 * static_cast <size_t >(__end_cap () - __first_), 1 );
466
- __split_buffer<value_type, __alloc_rr&> __t (__c, (__c + 3 ) / 4 , __alloc () );
459
+ size_type __c = std::max<size_type>(2 * static_cast <size_t >(__end_cap_ - __first_), 1 );
460
+ __split_buffer<value_type, __alloc_rr&> __t (__c, (__c + 3 ) / 4 , __alloc_ );
467
461
__t .__construct_at_end (move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
468
462
std::swap (__first_, __t .__first_ );
469
463
std::swap (__begin_, __t .__begin_ );
470
464
std::swap (__end_, __t .__end_ );
471
- std::swap (__end_cap () , __t .__end_cap () );
465
+ std::swap (__end_cap_ , __t .__end_cap_ );
472
466
}
473
467
}
474
- __alloc_traits::construct (__alloc () , std::__to_address (__begin_ - 1 ), std::forward<_Args>(__args)...);
468
+ __alloc_traits::construct (__alloc_ , std::__to_address (__begin_ - 1 ), std::forward<_Args>(__args)...);
475
469
--__begin_;
476
470
}
477
471
478
472
template <class _Tp , class _Allocator >
479
473
template <class ... _Args>
480
474
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_back (_Args&&... __args) {
481
- if (__end_ == __end_cap () ) {
475
+ if (__end_ == __end_cap_ ) {
482
476
if (__begin_ > __first_) {
483
477
difference_type __d = __begin_ - __first_;
484
478
__d = (__d + 1 ) / 2 ;
485
479
__end_ = std::move (__begin_, __end_, __begin_ - __d);
486
480
__begin_ -= __d;
487
481
} else {
488
- size_type __c = std::max<size_type>(2 * static_cast <size_t >(__end_cap () - __first_), 1 );
489
- __split_buffer<value_type, __alloc_rr&> __t (__c, __c / 4 , __alloc () );
482
+ size_type __c = std::max<size_type>(2 * static_cast <size_t >(__end_cap_ - __first_), 1 );
483
+ __split_buffer<value_type, __alloc_rr&> __t (__c, __c / 4 , __alloc_ );
490
484
__t .__construct_at_end (move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
491
485
std::swap (__first_, __t .__first_ );
492
486
std::swap (__begin_, __t .__begin_ );
493
487
std::swap (__end_, __t .__end_ );
494
- std::swap (__end_cap () , __t .__end_cap () );
488
+ std::swap (__end_cap_ , __t .__end_cap_ );
495
489
}
496
490
}
497
- __alloc_traits::construct (__alloc () , std::__to_address (__end_), std::forward<_Args>(__args)...);
491
+ __alloc_traits::construct (__alloc_ , std::__to_address (__end_), std::forward<_Args>(__args)...);
498
492
++__end_;
499
493
}
500
494
0 commit comments