getNext
Steven Schveighoffer
schveiguy at yahoo.com
Mon Jul 16 14:51:46 PDT 2012
On Mon, 09 Jul 2012 12:17:49 -0400, Mehrdad <wfunction at hotmail.com> wrote:
> On Monday, 9 July 2012 at 16:06:57 UTC, Timon Gehr wrote:
>>
>> Consider the possibility that this electrical engineer might be a
>> plumber as well.
>
> Yes, so if you expect him to be, then you should ask him "are you a
> plumber?" (i.e. output range?)
>
>
> But what you're asking him right now is, "hey, can you do clear this
> pipe for me with copper wires??" which is downright silly. Being able to
> write to an output range does NOT require you to have 'ref' members. The
> only thing 'ref' ever buys you is performance, not any new capabilities.
> Depending on it doesn't make sense.
import std.range;
struct inputrange
{
int x;
@property ref int front() { return x;}
void popFront() {}
enum empty = false;
}
static assert(isOutputRange!(inputrange, int));
-Steve
More information about the Digitalmars-d
mailing list