[libcxx-commits] [PATCH] D117327: [libc++] Fix LWG3390: move_iterator now handles move-only iterators.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 19 03:52:28 PST 2022


Quuxplusone updated this revision to Diff 401162.
Quuxplusone added a comment.

@ldionne: I've uploaded my proposed test now, but as it turns out, it fails because `move_it.base()` returns by-value in C++17; actually pulling out the `.base()` of a move-only move_iterator requires the C++20 changes to make `.base()` return by-const-ref.

I'd still prefer to land this as-is (without that test for now), but I guess I could also abandon this. My original rationale for opening this individually was that this is a (minor) change to the pre-C++20 behavior — it now moves instead of copying. I think everything else I'm doing affects our behavior only in C++20-and-later.

(Okay, so technically this behavior is observable and therefore testable pre-C++20; I'd just have to make a local iterator type that is both copy-ctable and move-ctable, but its copy-ctor counts the number of times it's called, and verify that `make_move_iterator(CountingItType())` never calls the copy-ctor. But that seems like overkill, IMVHO.)


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

https://reviews.llvm.org/D117327

Files:
  libcxx/docs/Status/Cxx20Issues.csv
  libcxx/include/__iterator/move_iterator.h
  libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117327.401162.patch
Type: text/x-patch
Size: 5354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220119/6c1ea27f/attachment.bin>


More information about the libcxx-commits mailing list