[libcxx-commits] [libcxx] [libc++] Implement P0429R9 `std::flat_map` (PR #98643)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 29 02:49:44 PDT 2024


================
@@ -136,10 +136,16 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator
   _LIBCPP_HIDE_FROM_ABI constexpr pointer operator->() const
     requires is_pointer_v<_Iter> || requires(const _Iter __i) { __i.operator->(); }
   {
+    // std::prev does not work for bidirectional_iterator && !LegacyBidirectionalIterator
----------------
huixie90 wrote:

I propose that we change `flat_map::iterator`'s `iterator_category` to `random_access_iterator_tag`, so we don't have to make any changes to `reverse_iterator` or `std::prev`. This is what we did for `vector<bool>::iterator`. In all our cpp17 algorithms, we never check if they meeting the "CPP17XXXX" requirements. Instead, we simply check the `iterator_category`. We never make assumptions on whether or not the `reference` type of an iterator is actually a reference. What do you think?

https://github.com/llvm/llvm-project/pull/98643


More information about the libcxx-commits mailing list