Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

irange with a step is not random access #134

Open
dvirtz opened this issue May 2, 2022 · 0 comments
Open

irange with a step is not random access #134

dvirtz opened this issue May 2, 2022 · 0 comments

Comments

@dvirtz
Copy link

dvirtz commented May 2, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant