@@ -409,41 +409,45 @@ class flat_map {
409409 }
410410
411411 // iterators
412- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin () noexcept {
412+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin () noexcept {
413413 return iterator (__containers_.keys .begin (), __containers_.values .begin ());
414414 }
415415
416- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin () const noexcept {
416+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin () const noexcept {
417417 return const_iterator (__containers_.keys .begin (), __containers_.values .begin ());
418418 }
419419
420- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end () noexcept {
420+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end () noexcept {
421421 return iterator (__containers_.keys .end (), __containers_.values .end ());
422422 }
423423
424- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end () const noexcept {
424+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end () const noexcept {
425425 return const_iterator (__containers_.keys .end (), __containers_.values .end ());
426426 }
427427
428- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin () noexcept {
428+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin () noexcept {
429429 return reverse_iterator (end ());
430430 }
431- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin () const noexcept {
431+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin () const noexcept {
432432 return const_reverse_iterator (end ());
433433 }
434- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend () noexcept {
434+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend () noexcept {
435435 return reverse_iterator (begin ());
436436 }
437- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend () const noexcept {
437+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend () const noexcept {
438438 return const_reverse_iterator (begin ());
439439 }
440440
441- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin () const noexcept { return begin (); }
442- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend () const noexcept { return end (); }
443- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin () const noexcept {
441+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin () const noexcept {
442+ return begin ();
443+ }
444+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend () const noexcept {
445+ return end ();
446+ }
447+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin () const noexcept {
444448 return const_reverse_iterator (end ());
445449 }
446- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend () const noexcept {
450+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend () const noexcept {
447451 return const_reverse_iterator (begin ());
448452 }
449453
@@ -452,22 +456,22 @@ class flat_map {
452456 return __containers_.keys .empty ();
453457 }
454458
455- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size () const noexcept {
459+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size () const noexcept {
456460 return __containers_.keys .size ();
457461 }
458462
459- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size () const noexcept {
463+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size () const noexcept {
460464 return std::min<size_type>(__containers_.keys .max_size (), __containers_.values .max_size ());
461465 }
462466
463467 // [flat.map.access], element access
464- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator [](const key_type& __x)
468+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator [](const key_type& __x)
465469 requires is_constructible_v<mapped_type>
466470 {
467471 return try_emplace (__x).first ->second ;
468472 }
469473
470- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator [](key_type&& __x)
474+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator [](key_type&& __x)
471475 requires is_constructible_v<mapped_type>
472476 {
473477 return try_emplace (std::move (__x)).first ->second ;
@@ -480,15 +484,15 @@ class flat_map {
480484 return try_emplace (std::forward<_Kp>(__x)).first ->second ;
481485 }
482486
483- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at (const key_type& __x) {
487+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at (const key_type& __x) {
484488 auto __it = find (__x);
485489 if (__it == end ()) {
486490 std::__throw_out_of_range (" flat_map::at(const key_type&): Key does not exist" );
487491 }
488492 return __it->second ;
489493 }
490494
491- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at (const key_type& __x) const {
495+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at (const key_type& __x) const {
492496 auto __it = find (__x);
493497 if (__it == end ()) {
494498 std::__throw_out_of_range (" flat_map::at(const key_type&) const: Key does not exist" );
@@ -498,7 +502,7 @@ class flat_map {
498502
499503 template <class _Kp >
500504 requires __is_compare_transparent
501- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at (const _Kp& __x) {
505+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at (const _Kp& __x) {
502506 auto __it = find (__x);
503507 if (__it == end ()) {
504508 std::__throw_out_of_range (" flat_map::at(const K&): Key does not exist" );
@@ -508,7 +512,7 @@ class flat_map {
508512
509513 template <class _Kp >
510514 requires __is_compare_transparent
511- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at (const _Kp& __x) const {
515+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at (const _Kp& __x) const {
512516 auto __it = find (__x);
513517 if (__it == end ()) {
514518 std::__throw_out_of_range (" flat_map::at(const K&) const: Key does not exist" );
@@ -753,116 +757,121 @@ class flat_map {
753757 }
754758
755759 // observers
756- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp () const { return __compare_; }
757- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp () const {
760+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp () const { return __compare_; }
761+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp () const {
758762 return value_compare (__compare_);
759763 }
760764
761- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const key_container_type& keys () const noexcept {
765+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const key_container_type& keys () const noexcept {
762766 return __containers_.keys ;
763767 }
764- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_container_type& values () const noexcept {
768+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_container_type&
769+ values () const noexcept {
765770 return __containers_.values ;
766771 }
767772
768773 // map operations
769- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find (const key_type& __x) {
774+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find (const key_type& __x) {
770775 return __find_impl (*this , __x);
771776 }
772777
773- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find (const key_type& __x) const {
778+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find (const key_type& __x) const {
774779 return __find_impl (*this , __x);
775780 }
776781
777782 template <class _Kp >
778783 requires __is_compare_transparent
779- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find (const _Kp& __x) {
784+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find (const _Kp& __x) {
780785 return __find_impl (*this , __x);
781786 }
782787
783788 template <class _Kp >
784789 requires __is_compare_transparent
785- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find (const _Kp& __x) const {
790+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find (const _Kp& __x) const {
786791 return __find_impl (*this , __x);
787792 }
788793
789- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count (const key_type& __x) const {
794+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count (const key_type& __x) const {
790795 return contains (__x) ? 1 : 0 ;
791796 }
792797
793798 template <class _Kp >
794799 requires __is_compare_transparent
795- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count (const _Kp& __x) const {
800+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count (const _Kp& __x) const {
796801 return contains (__x) ? 1 : 0 ;
797802 }
798803
799- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains (const key_type& __x) const {
804+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains (const key_type& __x) const {
800805 return find (__x) != end ();
801806 }
802807
803808 template <class _Kp >
804809 requires __is_compare_transparent
805- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains (const _Kp& __x) const {
810+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains (const _Kp& __x) const {
806811 return find (__x) != end ();
807812 }
808813
809- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound (const key_type& __x) {
814+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound (const key_type& __x) {
810815 return __lower_bound<iterator>(*this , __x);
811816 }
812817
813- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound (const key_type& __x) const {
818+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
819+ lower_bound (const key_type& __x) const {
814820 return __lower_bound<const_iterator>(*this , __x);
815821 }
816822
817823 template <class _Kp >
818824 requires __is_compare_transparent
819- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound (const _Kp& __x) {
825+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound (const _Kp& __x) {
820826 return __lower_bound<iterator>(*this , __x);
821827 }
822828
823829 template <class _Kp >
824830 requires __is_compare_transparent
825- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound (const _Kp& __x) const {
831+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound (const _Kp& __x) const {
826832 return __lower_bound<const_iterator>(*this , __x);
827833 }
828834
829- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound (const key_type& __x) {
835+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound (const key_type& __x) {
830836 return __upper_bound<iterator>(*this , __x);
831837 }
832838
833- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound (const key_type& __x) const {
839+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
840+ upper_bound (const key_type& __x) const {
834841 return __upper_bound<const_iterator>(*this , __x);
835842 }
836843
837844 template <class _Kp >
838845 requires __is_compare_transparent
839- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound (const _Kp& __x) {
846+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound (const _Kp& __x) {
840847 return __upper_bound<iterator>(*this , __x);
841848 }
842849
843850 template <class _Kp >
844851 requires __is_compare_transparent
845- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound (const _Kp& __x) const {
852+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound (const _Kp& __x) const {
846853 return __upper_bound<const_iterator>(*this , __x);
847854 }
848855
849- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range (const key_type& __x) {
856+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
857+ equal_range (const key_type& __x) {
850858 return __equal_range_impl (*this , __x);
851859 }
852860
853- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
861+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
854862 equal_range (const key_type& __x) const {
855863 return __equal_range_impl (*this , __x);
856864 }
857865
858866 template <class _Kp >
859867 requires __is_compare_transparent
860- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range (const _Kp& __x) {
868+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator>
869+ equal_range (const _Kp& __x) {
861870 return __equal_range_impl (*this , __x);
862871 }
863872 template <class _Kp >
864873 requires __is_compare_transparent
865- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
874+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
866875 equal_range (const _Kp& __x) const {
867876 return __equal_range_impl (*this , __x);
868877 }
0 commit comments