Support rvalues in adaptors::indexed
- Dominant language
- C++
- Stars
- 45
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
Using a normal ranged for with an rvalue is supported in C++, so adaptors::indexed should support it too.
Currently it is too easy to get a segfault:
```
std::vector getVec();
for (const auto& i : boost::adaptors::index(getVec())) { std::cout << i; }
```
This should have a move constructor and be able to store the temporary object.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the adaptors::indexed implementation and use the rvalue example in the issue as the reproduction case. Trace how the temporary range is stored, then verify that indexed iteration remains valid for getVec() and that the existing lvalue behavior is unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100