@@ -341,59 +341,67 @@ class vector {
341341 }
342342#endif
343343
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 {
345345 return this ->__alloc_ ;
346346 }
347347
348348 //
349349 // Iterators
350350 //
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 {
352352 return __make_iter (__add_alignment_assumption (this ->__begin_ ));
353353 }
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 {
355355 return __make_iter (__add_alignment_assumption (this ->__begin_ ));
356356 }
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 {
358358 return __make_iter (__add_alignment_assumption (this ->__end_ ));
359359 }
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 {
361361 return __make_iter (__add_alignment_assumption (this ->__end_ ));
362362 }
363363
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 {
365365 return reverse_iterator (end ());
366366 }
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 {
368369 return const_reverse_iterator (end ());
369370 }
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 {
371372 return reverse_iterator (begin ());
372373 }
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 {
374375 return const_reverse_iterator (begin ());
375376 }
376377
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 {
380386 return rbegin ();
381387 }
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+ }
383391
384392 //
385393 // [vector.capacity], capacity
386394 //
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 {
388396 return static_cast <size_type>(this ->__end_ - this ->__begin_ );
389397 }
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 {
391399 return static_cast <size_type>(this ->__cap_ - this ->__begin_ );
392400 }
393401 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty () const _NOEXCEPT {
394402 return this ->__begin_ == this ->__end_ ;
395403 }
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 {
397405 return std::min<size_type>(__alloc_traits::max_size (this ->__alloc_ ), numeric_limits<difference_type>::max ());
398406 }
399407 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve (size_type __n);
@@ -402,50 +410,51 @@ class vector {
402410 //
403411 // element access
404412 //
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 {
406414 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (__n < size (), " vector[] index out of bounds" );
407415 return this ->__begin_ [__n];
408416 }
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 {
410419 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (__n < size (), " vector[] index out of bounds" );
411420 return this ->__begin_ [__n];
412421 }
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) {
414423 if (__n >= size ())
415424 this ->__throw_out_of_range ();
416425 return this ->__begin_ [__n];
417426 }
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 {
419428 if (__n >= size ())
420429 this ->__throw_out_of_range ();
421430 return this ->__begin_ [__n];
422431 }
423432
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 {
425434 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (!empty (), " front() called on an empty vector" );
426435 return *this ->__begin_ ;
427436 }
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 {
429438 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (!empty (), " front() called on an empty vector" );
430439 return *this ->__begin_ ;
431440 }
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 {
433442 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (!empty (), " back() called on an empty vector" );
434443 return *(this ->__end_ - 1 );
435444 }
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 {
437446 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS (!empty (), " back() called on an empty vector" );
438447 return *(this ->__end_ - 1 );
439448 }
440449
441450 //
442451 // [vector.data], data access
443452 //
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 {
445454 return std::__to_address (this ->__begin_ );
446455 }
447456
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 {
449458 return std::__to_address (this ->__begin_ );
450459 }
451460
0 commit comments