[libcxx-commits] [PATCH] D117660: [libc++] Fix a typo in reverse_iterator::operator=
Casey Carter via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jan 19 11:54:23 PST 2022
CaseyCarter added a comment.
> We should be checking is_assignable<It&, ...>. is_assignable<It, ...> checks for an rvalue left-hand side, which is basically never assignable-to.
On the contrary, `is_assignable<T, U>` is almost always equal to `is_assignable<T&, U>` when `T` is a class type since assignment operators for class types are rarely `&`-qualified. I assume that's how this constraint slipped through testing, which indicates lack of test coverage for e.g. `reverse_iterator<int*>`.
> this is going to be an extra mess as soon as we need to support move-only iterators in reverse_iterator
forward_iterator requires copyable. Move-only iterators are necessarily single-pass, and therefore never valid parameters for `reverse_iterator`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117660/new/
https://reviews.llvm.org/D117660
More information about the libcxx-commits
mailing list