Rainer Deyke wrote:
Andrei Alexandrescu wrote:
If the implementor of consume() forgets to call save(), the situation is
unpleasant albeit not catastrophic: for most struct ranges things will
continue to work, but for class ranges the function will fail to perform
to spec. I don't know how to improve on that.

Require that all ranges are structs.  If you want to implement a range
as a class, use a wrapper struct that creates a new object in its
postblit function.  The wrapper struct can be made generic and placed in
the standard library.

That's a good idea, but it doesn't work with covariant return types. Those are needed for the container hierarchy that I'm working on.


Andrei

Reply via email to