Skip to content

Specialize range_const_iterator_helper for std::span #122

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

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

ecatmur
Copy link

@ecatmur ecatmur commented Feb 4, 2021

std::span does not have const_iterator member type, so this fails:

#include <span>
#include <boost/range/iterator.hpp>
boost::range_iterator<std::span<int> const>::type i;
//                                           ^~~~
// error: 'type' in 'struct boost::range_iterator<const std::span<int> >' does not name a type

also boost::begin() and boost::end() fail, and anything that calls them (e.g. boost::size()).

Demo.

I'm using 201902 as the feature test value on the basis that an implementation may have removed const_iterator (fixing LWG 3320) but not yet applied P1976R2 which updates the feature test to 202002L.

std::span does not have const_iterator member type, so this fails:

    #include <span>
    #include <boost/range/iterator.hpp>
    using X = boost::range_iterator<std::span<int, 3> const>::type;
@Kojoley
Copy link
Contributor

Kojoley commented Feb 9, 2021

FYI: it was caused by http://wg21.link/lwg3320 resolution and a subject of P2276.

@timblechmann
Copy link
Contributor

any update on this?

@glenfe
Copy link
Member

glenfe commented Dec 30, 2021

I think we need to fix up the CI for testing this i.e. Appveyor and Github Actions (Travis is dead to us now). On top of that, this PR will need unit tests.

@ecatmur
Copy link
Author

ecatmur commented Dec 30, 2021

FYI: it was caused by http://wg21.link/lwg3320 resolution and a subject of P2276.

Thanks, yeah this is tricky - and also const_iterator could be added back in future, it looks like.

I've taken the approach that we want the simplest possible solution that could work, which for now is ignoring const on top of std::span, and added enough tests that we'll find out if the Standard breaks us in future.

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

Successfully merging this pull request may close these issues.

4 participants