[libcxx-commits] [PATCH] D130197: [libc++] Fix `_IterOps::__iter_move` to support proxy iterators.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 20 13:00:29 PDT 2022


ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

LGTM, please ship this if it passes locally under `--param std=X` for all standards.



================
Comment at: libcxx/include/__algorithm/iterator_operations.h:69-71
   // Declaring the return type is necessary for the C++03 mode (which doesn't support placeholder return types).
-  static typename iterator_traits<__uncvref_t<_Iter> >::value_type&& __iter_move(_Iter&& __i) {
+  // Note that for proxy iterators, `reference` might be different from `value_type&` -- returning `value_type&&` might
+  // result in a dangling temporary in that case.
----------------
In particular, I think the comment about dangling references is not super useful here since we have a test for that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130197



More information about the libcxx-commits mailing list