[libcxx-commits] [PATCH] D102564: [libcxx][iterator] adds `std::ranges::prev`

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 18 15:08:56 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/include/__iterator/prev.h:35
+  template <bidirectional_iterator _Ip>
+  [[nodiscard]] constexpr _Ip operator()(_Ip __x) const {
+    --__x;
----------------
zoecarver wrote:
> FWIW I think it makes sense to have nodiscard here because it might be confusing to users that think `next` behaves like `advance` (`advance` takes a reference, this one doesn't).
Yes, `_LIBCPP_NODISCARD_EXT` plz, being as this is an extension to the Standard. (The Standard doesn't have [[nodiscard]] here: http://eel.is/c++draft/range.iter.op.prev )

@cjdb wrote: "my proposal" — FWIW, I haven't seen anything on the Discord, or the Slack, or libcxx-dev, related to nodiscard. (Maybe I'm not //on// libcxx-dev? I also sent two emails to libcxx-dev about how debug iterators are totally broken, and never received any replies.)  How about you post on the Discord, and/or send an email to the-relevant-people-directly?  I would think at least Louis/Zoe/myself/Mark/EricWF. I'll also go poke the Discord right now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102564/new/

https://reviews.llvm.org/D102564



More information about the libcxx-commits mailing list