boostorg / boostorg/range

Range Algorithms do not compile with `std::span`

Open
#142 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
45
Forks
104
PR merge metrics
No merged PRs in 30d

Description

Algorithms like `find_if` do not compile when used on instances of `std::span`. They work with `boost::span`.

You can try this code on https://godbolt.org/z/Mq4GhqMYn:

```
#include
#include

#include
#include

constexpr int a[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
boost::span boost_span{a};
std::span std_span{a};

auto foo0() {
return boost::range::find(boost_span, 2); // ok
}

auto foo1() {
return boost::range::find(std_span, 2); // fails
}

auto foo2() {
return std::ranges::find(boost_span, 2); // ok
}

auto foo3() {
return std::ranges::find(std_span, 2); // ok
}
```

The error message is something like

`error: no type named 'type' in 'struct boost::range_iterator, void>'`

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.