On Fri, 07 Sep 2012 11:04:36 -0400, Jonathan M Davis <jmdavisp...@gmx.com>
wrote:
On Friday, September 07, 2012 10:52:07 Steven Schveighoffer wrote:
We have three situations:
1. input range is a ref type already (i.e. a class or a pImpl struct),
no
need to pass this by ref, just wastes cycles doing double dereference.
2. input range is a value type, and you want to preserve the original.
3. input range is a value type, and you want to update the original.
I'd like to see the library automatically make the right decision for 1,
and give you some mechanism to choose between 2 and 3. To preserve
existing code, 3 should be the default.
Does it _ever_ make sense for a range to be an input range and not a
forward
range and _not_ have it be a reference type?
No it doesn't. That is case 1.
However, it's quite easy to forget to define "save" when your range really
is a forward range. I don't really know a good way to fix this. To
assume that an input-and-not-forward range has reference semantics is
prone to inappropriate code compiling just fine.
Clearly we can say classes are easily defined as not needing ref.
-Steve