[libcxx-commits] [PATCH] D130695: [libc++][ranges]Refactor `copy{, _backward}` and `move{, _backward}`

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Sep 24 01:29:50 PDT 2022


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

> By the way, are there any C++11-and-later features that you feel would *really* make a difference if they were available in C++03? I gave it some thought, and `if constexpr` seemed to be number one (and number 2 would be `auto` and `decltype(auto)` as the return type of a function).

Other than concepts (would probably a bit too much to ask), lambdas would definitely be my number one. It would just be so much nicer to use algorithms instead of raw loops everywhere. C++11 attributes would also be quite nice.

>> AFAICT this was a language bug that will get fixed.
>
> I mean the wrong return value for `ranges::{copy,move}_backward` (see D130968 <https://reviews.llvm.org/D130968>). We even had wrong tests for those (i.e., the tests were testing for the *wrong* value). This sort of confusion of whether we are talking about the begin/end of the actual range or the reversed range is inherent when using reverse iterators. I take it as empirical evidence that using reverse iterators in the implementation adds complexity and potential to introduce bugs.

Yeah, I don't think this was because of `reverse_iterator`s. My intuition about what `{copy, move}_backward` should return is just backwards.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130695



More information about the libcxx-commits mailing list