[libcxx-commits] [PATCH] D129390: [lib++][ranges][NFC] Refactor `iterator_operations.h` to use tags.
Konstantin Varlamov via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 12 02:40:41 PDT 2022
var-const marked 2 inline comments as done.
var-const added inline comments.
================
Comment at: libcxx/include/__algorithm/iterator_operations.h:67
+ // Declaring the return type is necessary for the C++03 mode (which doesn't support placeholder return types).
+ static typename iterator_traits<typename remove_reference<_Iter>::type>::value_type&& __iter_move(_Iter&& __i) {
+ return std::move(*std::forward<_Iter>(__i));
----------------
huixie90 wrote:
> huixie90 wrote:
> > I think you need to remove all the cv_ref instead of just the `reference`
> I thought I've commented somewhere I don't seem to find it anymore. Just be aware that the type of ` std::move(*std::forward<_Iter>(__i));` does not always match
> `typename iterator_traits<typename remove_reference<_Iter>::type>::value_type&&`. e.g. `vector<bool>::itertor`. But I think the code you've written is fine because most of the time the users do want the conversion (except for the new c++20 stuff which is not meant to be usable for classic algorithms)
Thanks, this is a very good point. I also think it should be okay given how it's used.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129390/new/
https://reviews.llvm.org/D129390
More information about the libcxx-commits
mailing list