boostorg / range

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

Support rvalues in adaptors::indexed #128

Open FelixDombek opened 3 years ago

FelixDombek commented 3 years ago

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<int> 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.