This is an archive of the discontinued LLVM Phabricator instance.

Optimizing std::copy and related algorithms for std::reverse_iterator.
Needs ReviewPublic

Authored by dyaroshev on Oct 6 2017, 4:20 PM.

Details

Reviewers
mclow.lists
Summary

This patch makes std::copy/std::copy_backward/std::move/std::move_backward to unwrap 3 revesre_iterators call corresponding reverted algorithm.

The SFINAE magic was getting too complicated to read and to get right. Therefor I used regular if in "if constexpr" manner and relied on the dead code elimination optimization. (Compiler explorer: https://godbolt.org/g/kiHDjW). Is this OK?

My editor removed quite a few trailing whitespaces in the iterator header. Restore them?

I don't have the clang-format set up for libcxx, sorry for the formatting mistakes.

Bug: https://bugs.llvm.org/show_bug.cgi?id=34339

Diff Detail

Event Timeline

dyaroshev created this revision.Oct 6 2017, 4:20 PM
dyaroshev edited the summary of this revision. (Show Details)
dyaroshev edited the summary of this revision. (Show Details)