On Wed, 11 Nov 2009 20:08:52 +0300, Philippe Sigaud <[email protected]> wrote:

Denis:
BTW, save() is already implemented and used throughout the Phobos under a
different name - opSlice
(i.e. auto copy = range[]). It's a bikeshed discussion, but why save() and
not opSlice(), or even clone()?

2009/11/11 Andrei Alexandrescu <[email protected]>

It can't be clone() because it doesn't clone. For example say you have a
T[] - one would expect clone() actually copies the content. But using
opSlice is a good idea.


I don't get it. Shouldn't save() copy the content?

Do you mean we could use opSlice() (the parameterless version) as a save
function and write "auto r2 = r1[];"?
But, again maybe I don't get something: for dyn. arrays (aka the range
archetype) opSlice is not a save, it's just an alias. So using opSlice
doesn't work for remembering positions with arrays.

   Philippe

It remembers array bounds, not contents.

Reply via email to