Skip to content

irange with a step is not random access #134

@dvirtz

Description

@dvirtz

The docs say that irange produces a random access range but that's not true for the strided version.

The following code fails to compile:

BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<decltype(boost::irange(0, 10))> ));
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<decltype(boost::irange(0, 10, 1))> )); // fails here

See https://gcc.godbolt.org/z/n4hqjj5bf

The reason is that random access (in fact, even forward) concept requires the iterator to be default constructible which integer_iterator_with_step is not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions