@@ -341,59 +341,67 @@ class vector {
341
341
}
342
342
#endif
343
343
344
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator () const _NOEXCEPT {
344
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator () const _NOEXCEPT {
345
345
return this ->__alloc_ ;
346
346
}
347
347
348
348
//
349
349
// Iterators
350
350
//
351
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin () _NOEXCEPT {
351
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin () _NOEXCEPT {
352
352
return __make_iter (__add_alignment_assumption (this ->__begin_ ));
353
353
}
354
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin () const _NOEXCEPT {
354
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin () const _NOEXCEPT {
355
355
return __make_iter (__add_alignment_assumption (this ->__begin_ ));
356
356
}
357
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end () _NOEXCEPT {
357
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end () _NOEXCEPT {
358
358
return __make_iter (__add_alignment_assumption (this ->__end_ ));
359
359
}
360
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end () const _NOEXCEPT {
360
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end () const _NOEXCEPT {
361
361
return __make_iter (__add_alignment_assumption (this ->__end_ ));
362
362
}
363
363
364
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin () _NOEXCEPT {
364
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin () _NOEXCEPT {
365
365
return reverse_iterator (end ());
366
366
}
367
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin () const _NOEXCEPT {
367
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator
368
+ rbegin () const _NOEXCEPT {
368
369
return const_reverse_iterator (end ());
369
370
}
370
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend () _NOEXCEPT {
371
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend () _NOEXCEPT {
371
372
return reverse_iterator (begin ());
372
373
}
373
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend () const _NOEXCEPT {
374
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend () const _NOEXCEPT {
374
375
return const_reverse_iterator (begin ());
375
376
}
376
377
377
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin () const _NOEXCEPT { return begin (); }
378
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cend () const _NOEXCEPT { return end (); }
379
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin () const _NOEXCEPT {
378
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin () const _NOEXCEPT {
379
+ return begin ();
380
+ }
381
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator cend () const _NOEXCEPT {
382
+ return end ();
383
+ }
384
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator
385
+ crbegin () const _NOEXCEPT {
380
386
return rbegin ();
381
387
}
382
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend () const _NOEXCEPT { return rend (); }
388
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend () const _NOEXCEPT {
389
+ return rend ();
390
+ }
383
391
384
392
//
385
393
// [vector.capacity], capacity
386
394
//
387
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size () const _NOEXCEPT {
395
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size () const _NOEXCEPT {
388
396
return static_cast <size_type>(this ->__end_ - this ->__begin_ );
389
397
}
390
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity () const _NOEXCEPT {
398
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity () const _NOEXCEPT {
391
399
return static_cast <size_type>(this ->__cap_ - this ->__begin_ );
392
400
}
393
401
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty () const _NOEXCEPT {
394
402
return this ->__begin_ == this ->__end_ ;
395
403
}
396
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size () const _NOEXCEPT {
404
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size () const _NOEXCEPT {
397
405
return std::min<size_type>(__alloc_traits::max_size (this ->__alloc_ ), numeric_limits<difference_type>::max ());
398
406
}
399
407
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve (size_type __n);
@@ -402,50 +410,51 @@ class vector {
402
410
//
403
411
// element access
404
412
//
405
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator [](size_type __n) _NOEXCEPT {
413
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator [](size_type __n) _NOEXCEPT {
406
414
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (__n < size (), " vector[] index out of bounds" );
407
415
return this ->__begin_ [__n];
408
416
}
409
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference operator [](size_type __n) const _NOEXCEPT {
417
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference
418
+ operator [](size_type __n) const _NOEXCEPT {
410
419
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (__n < size (), " vector[] index out of bounds" );
411
420
return this ->__begin_ [__n];
412
421
}
413
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at (size_type __n) {
422
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at (size_type __n) {
414
423
if (__n >= size ())
415
424
this ->__throw_out_of_range ();
416
425
return this ->__begin_ [__n];
417
426
}
418
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at (size_type __n) const {
427
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at (size_type __n) const {
419
428
if (__n >= size ())
420
429
this ->__throw_out_of_range ();
421
430
return this ->__begin_ [__n];
422
431
}
423
432
424
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front () _NOEXCEPT {
433
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front () _NOEXCEPT {
425
434
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (!empty (), " front() called on an empty vector" );
426
435
return *this ->__begin_ ;
427
436
}
428
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front () const _NOEXCEPT {
437
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front () const _NOEXCEPT {
429
438
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (!empty (), " front() called on an empty vector" );
430
439
return *this ->__begin_ ;
431
440
}
432
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back () _NOEXCEPT {
441
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back () _NOEXCEPT {
433
442
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (!empty (), " back() called on an empty vector" );
434
443
return *(this ->__end_ - 1 );
435
444
}
436
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back () const _NOEXCEPT {
445
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back () const _NOEXCEPT {
437
446
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (!empty (), " back() called on an empty vector" );
438
447
return *(this ->__end_ - 1 );
439
448
}
440
449
441
450
//
442
451
// [vector.data], data access
443
452
//
444
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI value_type* data () _NOEXCEPT {
453
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI value_type* data () _NOEXCEPT {
445
454
return std::__to_address (this ->__begin_ );
446
455
}
447
456
448
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const value_type* data () const _NOEXCEPT {
457
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const value_type* data () const _NOEXCEPT {
449
458
return std::__to_address (this ->__begin_ );
450
459
}
451
460
0 commit comments