getNext
Mehrdad
wfunction at hotmail.com
Mon Jul 9 07:07:23 PDT 2012
On Monday, 9 July 2012 at 14:03:17 UTC, Andrei Alexandrescu wrote:
> On 7/9/12 5:14 AM, Mehrdad wrote:
>> Really, doing something simple should be simple.
>>
>> I don't have any brilliant ideas, but one guess would be
>> nullable
>> types... if you can return a nullable value, your interface
>> for an
>> interface could just be:
>>
>> T? next();
>>
>> and that's it... it would return null if nothing is left.
>
> What if you want to return a reference so the user can change
> it?
>
> Andrei
Huh? You don't... it's an input iterator, not an output iterator!
What would you be changing, exactly?
D's return-by-reference doesn't work the way you expect anyway,
so it's kinda pointless worrying about it....
@property ref int foo() { }
@property void foo(int v) { }
foo = 2; // huh?
More information about the Digitalmars-d
mailing list