boost::span cannot be constructed with iterators
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with boost/core/span.hpp and reproduce the iterator construction example from the issue using the linked Godbolt case. Compare the supported boost::span constructors with the std::span behavior described in the cppreference link; done means the reported iterator form is supported without the pointer workaround.
Written by the indexing model from the issue text.
Description
std::span constructors 2 and 3 of cppreference.com documentation support generic iterators, while boost::span accepts only pointers. A possible workaround is to apply the operators &* to the iterators.
https://godbolt.org/z/sjEozr6M5
#include <span>
#include <boost/core/span.hpp>
#include <vector>
void foo(const std::vector<int>& v) {
const auto std_span = std::span<const int>(v.begin(), v.end()); // fine
// const auto boost_span = boost::span<const int>(v.begin(), v.end()); // broken
const auto boost_span = boost::span<const int>(&*v.begin(), &*v.end()); // fine with hack
}
- Dominant language
- C++
- Stars
- 156
- Forks
- 116
- 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/core
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 1/5 Under an hour Newbie friendliness 55/100
-
saturate_cast Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·