Linked list as a bidirectional range? I have some questions...

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 13 13:25:50 PDT 2014


On Wed, Aug 13, 2014 at 07:58:49PM +0000, Gary Willoughby via Digitalmars-d-learn wrote:
> On Wednesday, 13 August 2014 at 19:43:20 UTC, H. S. Teoh via
> Digitalmars-d-learn wrote:
> >On Wed, Aug 13, 2014 at 07:37:09PM +0000, Gary Willoughby via
> >Digitalmars-d-learn wrote:
> >>On Wednesday, 13 August 2014 at 18:58:59 UTC, H. S. Teoh via
> >>Digitalmars-d-learn wrote:
[...]
> >>>You need to put @property on .save.
[...]
> >>Gah! Thanks, i need sleep. :)
> >
> >No worries, the only reason I could pinpoint this almost immediately was
> >because I got bitten by exactly the same problem before, and it took me
> >*hours* to figure out what was wrong. :-/
> >
> >
> >T
> 
> Thinking about it why should that matter when not compiled using
> -property?  I'm guessing the template enforces it should be a
> property?

The problem is that this test is used in isForwardRange:

        static assert (is(typeof(r1.save) == R));

where R is the type of the range. So if .save is not @property, then
typeof(r1.save) would be a function pointer, rather than the type of the
function's return value, and so the test will fail.


T

-- 
What do you mean the Internet isn't filled with subliminal messages? What about all those buttons marked "submit"??


More information about the Digitalmars-d-learn mailing list