On Sunday, 28 October 2012 at 19:42:30 UTC, Tobias Pankrath wrote:
Given:
void foo(Range)(Range fwdR)
if(isForwardRange!Range)
{
auto tmp = fwdR.save;
assert(tmp == fwdR);
}
May I assume that the assert holds for generic forward range
types?
Reason: I try to write an algorithm, that is easily
implementable with random access ranges, but to make it work
with forward ranges I need a comparison similar to the one
above.
No, you can't compare range contents with "==". You can use the
algorithm "equal", which has a lot of logic to make it optimal
when possible.