Konstantin Varlamov
005916de58
[libc++][ranges]Refactor copy{,_backward}
and move{,_backward}
...
Instead of using `reverse_iterator`, share the optimization between the 4 algorithms. The key observation here that `memmove` applies to both `copy` and `move` identically, and to their `_backward` versions very similarly. All algorithms now follow the same pattern along the lines of:
```
if constexpr (can_memmove<InIter, OutIter>) {
memmove(first, last, out);
} else {
naive_implementation(first, last, out);
}
```
A follow-up will delete `unconstrained_reverse_iterator`.
This patch removes duplication and divergence between `std::copy`, `std::move` and `std::move_backward`. It also improves testing:
- the test for whether the optimization is used only applied to `std::copy` and, more importantly, was essentially a no-op because it would still pass if the optimization was not used;
- there were no tests to make sure the optimization is not used when the effect would be visible.
Differential Revision: https://reviews.llvm.org/D130695
2022-10-01 17:35:12 -07:00
..
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-10-01 22:49:36 +02:00
2022-08-04 02:45:32 -07:00
2022-10-01 22:49:36 +02:00
2022-08-19 15:35:02 +02:00
2022-10-01 17:35:12 -07:00
2022-08-19 15:35:02 +02:00
2022-10-01 17:35:12 -07:00
2022-08-19 15:35:02 +02:00
2022-10-01 17:35:12 -07:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-10-01 22:49:36 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-09-06 19:09:42 +02:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-08-19 15:35:02 +02:00
2022-09-06 19:09:42 +02:00
2022-10-01 22:49:36 +02:00
2022-08-19 15:35:02 +02:00
2022-10-01 22:49:36 +02:00
2022-08-18 16:59:58 -04:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-08-18 16:59:58 -04:00
2022-10-01 22:49:36 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-10-01 17:35:12 -07:00
2022-10-01 17:35:12 -07:00
2022-10-01 22:49:36 +02:00
2022-08-19 15:35:02 +02:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-09-06 19:09:42 +02:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-10-01 17:35:12 -07:00
2022-08-18 16:59:58 -04:00
2022-10-01 17:35:12 -07:00
2022-10-01 17:35:12 -07:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-09-05 12:36:41 +02:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-09-05 12:36:41 +02:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-09-06 19:09:42 +02:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-09-06 19:09:42 +02:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-09-05 12:36:41 +02:00
2022-08-18 16:59:58 -04:00
2022-10-01 17:35:12 -07:00
2022-10-01 17:35:12 -07:00
2022-09-05 12:36:41 +02:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-09-05 12:36:41 +02:00
2022-09-05 12:36:41 +02:00
2022-09-06 19:09:42 +02:00
2022-08-18 16:59:58 -04:00
2022-09-06 19:09:42 +02:00
2022-08-18 16:59:58 -04:00
2022-09-05 12:36:41 +02:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-09-05 12:36:41 +02:00
2022-09-05 12:36:41 +02:00
2022-10-01 17:35:12 -07:00
2022-08-18 16:59:58 -04:00
2022-10-01 17:35:12 -07:00
2022-10-01 17:35:12 -07:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-09-06 19:09:42 +02:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-08-18 16:59:58 -04:00
2022-09-05 12:36:41 +02:00
2022-09-05 12:36:41 +02:00
2022-08-18 16:59:58 -04:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-10-01 17:35:12 -07:00
2022-08-02 22:34:23 -07:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-10-01 17:35:12 -07:00
2022-10-01 22:49:36 +02:00
2022-10-01 17:35:12 -07:00
2022-10-01 17:35:12 -07:00
2022-03-01 08:20:24 -05:00
2022-03-01 08:20:24 -05:00
2022-09-02 21:36:36 +02:00
2022-08-19 15:35:02 +02:00
2022-10-01 22:49:36 +02:00
2022-10-01 22:49:36 +02:00
2022-09-06 19:09:42 +02:00
2022-10-01 22:49:36 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-09-06 19:09:42 +02:00
2022-10-01 22:49:36 +02:00
2022-08-19 15:35:02 +02:00
2022-08-19 15:35:02 +02:00
2022-08-18 16:59:58 -04:00
2022-08-19 15:35:02 +02:00