getNext
Michel Fortin
michel.fortin at michelf.com
Tue Jul 13 05:52:58 PDT 2010
On 2010-07-12 23:48:05 -0400, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> said:
> T* getNext(R, T)(ref R range, ref T item);
>
> Semantics: if the range wants to expose addresses of its elements, it
> returns a pointer to the current element and also advances to the next
> element. Otherwise (i.e. the range does not have or does not want to
> expose addresses of its elements), the range fills "item" with the
> current value, again moves on to the next value, and returns &item.
>
> In all cases, when there are no more elements in the range, getNext
> returns null.
This can't be @safe. getNext would need to take a pointer out of the
item reference, which isn't allowed in SafeD.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list