On Tuesday, 10 November 2015 at 18:57:31 UTC, Steven Schveighoffer wrote:
IMO, that shouldn't be a forward range. But in any case, the correct mechanism is:

forward range -> a = b works and makes a copy of the iteration.
non-forward range -> a = b fails, you'd have to use a = b.getRef or something like that -or- a = b is a moving operation (a is no longer usable)
Hmm. You mean "b is no longer usable", right?

So, any algorithm requiring a copy should better do something like

static if(isForwardRange!range)
   copy = range;
else
   copy = range.save();

Reply via email to