On 2010-07-12 23:48:05 -0400, Andrei Alexandrescu
<[email protected]> 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
[email protected]
http://michelf.com/