Range Algorithms do not compile with `std::span`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start with the minimal example linked in the issue and reproduce the failure in boost::range::find with std::span. Trace the range iterator handling involved in that entry point; done means the shown std::span call compiles while the existing boost::span and std::ranges cases remain working.
Written by the indexing model from the issue text.
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 <ranges>
#include <span>
#include <boost/core/span.hpp>
#include <boost/range/algorithm/find.hpp>
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<const std::span<const int, 9>, void>'
- Dominant language
- C++
- Stars
- 45
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/range
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
Similar issues
-
prio:medium status:idea type:feat
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
tests
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
kind/bug needs-sig needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
drogonframework/drogon#2605 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
ArthurSonzogni/FTXUI#1363 ·