Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

SinglePassRangeConcept should support non-const range

Open
#133 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
tooling

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/range

All issues in boostorg/range

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.