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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 11 11:00:37 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
----------------
ldionne wrote:

Yes, let's do that. In that case, the changes in this file can be removed from this patch.

However, we still have a general bug on `reverse_iterator` since it will mis-behave for types that are `concept bidirectional_iterator` but do not satisfy the `Cpp17BidirectionalIterator` named requirement. Specifically, based on http://eel.is/c++draft/reverse.iterators#reverse.iter.requirements, both should be acceptable for `reverse_iterator`. I think that's a separate bug on its own, and I think resolving that will mean that we don't use `std::prev` anymore from `reverse_iterator`, as your patch here does.

And then there is #109456, which is related but different since we don't even have to use `std::prev` inside `bidirectional_iterator`.

TLDR: let's create another issue to handle fixing `reverse_iterator`.

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


More information about the libcxx-commits mailing list