You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A single pass range often can be consumed only once which implies mutability and negates constness, on the first consumption it becomes empty. SinglePassRangeConcept asserts const_constraints which is a requirement that cannot be met by many or most single pass ranges.
I will demonstrate using a boost coroutine with a range adaptor:
#include<boost/range/adaptor/transformed.hpp>
#include<boost/coroutine2/coroutine.hpp>using boost::adaptors::transformed;
using boost::coroutines2::coroutine;
intmain() {
using generator = coroutine<int>;
generator::pull_type g([](auto &yield) {
for (int i = 0; i < 10; i++) {
yield(i);
}
});
for (auto i: g | transformed([](int i) { return i + 10; })) {
}
return0;
}
This code snippet does not compile because SinglePassRangeConcept asserts const_constraints which boost coroutine does not satisfy.
I propose to drop the const requirement for SinglePassRangeConcept because in simple terms, a single pass range isn't required to have a const iterator.
The text was updated successfully, but these errors were encountered:
A single pass range often can be consumed only once which implies mutability and negates constness, on the first consumption it becomes empty. SinglePassRangeConcept asserts
const_constraints
which is a requirement that cannot be met by many or most single pass ranges.I will demonstrate using a boost coroutine with a range adaptor:
This code snippet does not compile because SinglePassRangeConcept asserts
const_constraints
which boost coroutine does not satisfy.I propose to drop the const requirement for SinglePassRangeConcept because in simple terms, a single pass range isn't required to have a const iterator.
The text was updated successfully, but these errors were encountered: