[defns.projection] The example isn't demonstrating the effects of customized projection
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
In the current example
std::pair<int, std::string_view> pairs[] = {{2, "foo"}, {1, "bar"}, {0, "baz"}};
std::ranges::sort(pairs, std::ranges::less{}, [](auto const& p) { return p.first; });
the result of sorting is same of that using default std::identity.
It might make more sense to use [](auto const& p) { return p.second; } as the projection.
Moreover, std::format("{}", pairs) (after sorting) gives [(0, "baz"), (1, "bar"), (2, "foo")] or [(1, "bar"), (0, "baz"), (2, "foo")] since C++23. Should we change the result in the example to match std::format?
Contributor guide
No contributing guide indexed for this repository
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
Find the [defns.projection] example in the C++ standards draft and compare its current projection with the proposed string projection. Check the documented sorting result against the stated std::format output, then update the example and its result consistently; no specific source file or test is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100