@@ -142,8 +142,12 @@ class flat_map {
142142 friend flat_map;
143143
144144 public:
145- using iterator_concept = random_access_iterator_tag;
146- using iterator_category = input_iterator_tag;
145+ using iterator_concept = random_access_iterator_tag;
146+ // `flat_map::iterator` only satisfy "Cpp17InputIterator" named requirements, because
147+ // its `reference` is not a reference type.
148+ // However, to avoid surprising runtime behaviour when it is used with the
149+ // Cpp17 algorithms or operations, iterator_category is set to random_access_iterator_tag.
150+ using iterator_category = random_access_iterator_tag;
147151 using value_type = flat_map::value_type;
148152 using difference_type = flat_map::difference_type;
149153
@@ -482,7 +486,7 @@ class flat_map {
482486 _LIBCPP_HIDE_FROM_ABI flat_map& operator =(flat_map&& __other) noexcept (
483487 is_nothrow_move_assignable_v<_KeyContainer> && is_nothrow_move_assignable_v<_MappedContainer> &&
484488 is_nothrow_move_assignable_v<_Compare>) {
485- auto __clear_other_guard = std::__make_scoped_guard ([&]() noexcept { __other.clear () /* noexcept */ ; });
489+ auto __clear_other_guard = std::__make_scope_guard ([&]() noexcept { __other.clear () /* noexcept */ ; });
486490 auto __clear_self_guard = std::__make_exception_guard ([&]() noexcept { clear () /* noexcept */ ; });
487491 __containers_ = std::move (__other.__containers_ );
488492 __compare_ = std::move (__other.__compare_ );
@@ -660,7 +664,7 @@ class flat_map {
660664 }
661665
662666 _LIBCPP_HIDE_FROM_ABI containers extract () && {
663- auto __guard = std::__make_scoped_guard ([&]() noexcept { clear () /* noexcept */ ; });
667+ auto __guard = std::__make_scope_guard ([&]() noexcept { clear () /* noexcept */ ; });
664668 auto __ret = std::move (__containers_);
665669 return __ret;
666670 }
0 commit comments