boostorg / range

Boost.org range module
http://boost.org/libs/range
43 stars 104 forks source link

Specialize range_const_iterator_helper for std::span #122

Open ecatmur opened 3 years ago

ecatmur commented 3 years ago

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.

Kojoley commented 3 years ago

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

timblechmann commented 2 years ago

any update on this?

glenfe commented 2 years ago

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 commented 2 years ago

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.