This code doesn't compile:
struct R
{
bool empty();
ref int front();
void popFront();
}
ref int popNext(ref R fwdRange)
{
auto result = & fwdRange.front();
fwdRange.popFront;
return *result;
}
void main()
{
R r;
int x = r.popNext;
}
The code should work: popNext should be looked up in R's outer scope if not a member.
Comment #1 by gide — 2009-05-21T10:00:14Z
Added keyword, error message is as follows.
C:> dmd test.d
test.d(18): Error: no property 'popNext' for type 'R'
Comment #2 by georg — 2009-05-21T17:39:39Z
Invisible first paramter? Not with a one-parameter function?
Comment #3 by andrej.mitrovich — 2012-10-28T11:51:15Z