<algorithm>: investigate sharing code between std and ranges algorithms
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
There's an enormous amount of overlap in implementations of the "same" algorithm in namespaces std and std::ranges. For example, std::copy:
vs. ranges::copy:
There are substantial differences in the interface, but eventually they boil down to identical or nearly identical loops. It would be nice if we could reduce the total amount of code we must maintain by using a common back-end for such algorithms.
Note that in doing so we absolutely must not regress performance or codesize, and should not regress compile throughput or increase the complexity of the overall code.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the std::copy implementation in stl/inc/xutility and the ranges::copy implementation in stl/inc/algorithm. First determine which shared backend opportunities preserve both interfaces, then measure performance, code size, compile throughput, and overall complexity to establish whether the work is complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- developer-experience
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100