SinglePassRangeConcept should support non-const range
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with include/boost/range/concepts.hpp, especially the const_constraints requirement linked in the issue, and compare it with the single-pass range semantics shown by the boost coroutine example. Verify the transformed coroutine range case and determine whether removing that requirement lets the example compile without violating the concept’s intended guarantees.
Written by the indexing model from the issue text.
Description
A single pass range often can be consumed only once which implies mutability and negates constness, on the first consumption it becomes empty. SinglePassRangeConcept asserts const_constraints which is a requirement that cannot be met by many or most single pass ranges.
I will demonstrate using a boost coroutine with a range adaptor:
#include <boost/range/adaptor/transformed.hpp>
#include <boost/coroutine2/coroutine.hpp>
using boost::adaptors::transformed;
using boost::coroutines2::coroutine;
int main() {
using generator = coroutine<int>;
generator::pull_type g([](auto &yield) {
for (int i = 0; i < 10; i++) {
yield(i);
}
});
for (auto i: g | transformed([](int i) { return i + 10; })) {
}
return 0;
}
This code snippet does not compile because SinglePassRangeConcept asserts const_constraints which boost coroutine does not satisfy.
I propose to drop the const requirement for SinglePassRangeConcept because in simple terms, a single pass range isn't required to have a const iterator.
- Dominant language
- C++
- Stars
- 45
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from boostorg/range
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
-
Bad is_sorted docsOpen
Difficulty 1/5 Under an hour Newbie friendliness 55/100
Similar issues
-
upstream update
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conan-io/conan-center-index#31098 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
ml-explore/mlx-c#136 ·
-
bug chart-audit
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 1 day