On Sun, 30 May 2010 01:45:54 +0900, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> wrote:
I plan to make two more (hopefully the last two) changes to the range
abstraction this morning.
1. First, I want to define this:
// inside range type SomeRange
@property SomeRange save();
That simply returns a copy of the range. Most implementations look like
this:
// inside range type SomeRange
@property SomeRange save() { return this; }
If SomeRange is a class or interface, you'd write:
// inside range type SomeRange
@property SomeRange save() { return this->clone(); }
The idea is that save() provides a guaranteed means to take a snapshot
in a range's state. The notable absents are input ranges - they are
unable to define save(), and therefore some algorithms won't apply to
them.
I also want save.
It allows you to treat some ranges in a unified way.
Masahiro