Why in range for loop do begin/end need to be copyable?
Solution 1:
Is there a reason the begin/end are taken like that, or is it an oversight? Wouldn't it be better to either move them:
In general no, because such specification could potentially prohibit copy elision.
Why in range for loop do begin/end need to be copyable?
The initialisation that you quote doesn't generally necessitate the iterators to be copyable, except in an unusual case where begin
/ end
return an lvalue reference. I'm not sure if anyone cares about such case, given that would violate concept requirements.