boostorg / boostorg/range

irange with a step is not random access

Open
#134 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
45
Forks
104
PR merge metrics
No merged PRs in 30d

Description

The [docs](https://www.boost.org/doc/libs/1_78_0/libs/range/doc/html/range/reference/ranges/irange.html) say that `irange` produces a random access range but that's not true for the strided version.

The following code fails to compile:
```cpp
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept ));
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); // 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.