[libcxx-commits] [PATCH] D116489: [libc++] [API BREAK] Change `fs::path::iterator::iterator_category` to `input_iterator_tag`.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jan 1 17:02:48 PST 2022
Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, EricWF, CaseyCarter, libc++.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.
This essentially reverts e02ed1c255d71 and puts in a new fix, which makes `path::iterator` a true C++20 `bidirectional_iterator`, but downgrades it to an `input_iterator` in C++17.
Fixes https://github.com/llvm/llvm-project/issues/37852
However, notice that this makes `*it` do a copy (of a hopefully short string), rather than just returning a reference; that might have perf implications.
And notice that a `for`-loop like `for (auto& elt : path)` will no longer compile (but this is just more evidence that `auto&&` Always Works ;)).
On the plus side, after this patch there is no downside to using `std::reverse_iterator<fs::path::iterator>`... unless I've missed something.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116489
Files:
libcxx/include/__filesystem/path_iterator.h
libcxx/include/__iterator/reverse_iterator.h
libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/reverse_iterator_produces_diagnostic.verify.cpp
libcxx/test/std/input.output/filesystems/class.path/path.itr/iterator.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116489.396887.patch
Type: text/x-patch
Size: 5496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220102/db7e0a0b/attachment-0001.bin>
More information about the libcxx-commits
mailing list