A simplification of the RvalueRef idiom
Jonathan M Davis via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Nov 24 06:24:24 PST 2016
On Thursday, November 24, 2016 00:35:39 TheGag96 via Digitalmars-d-learn
wrote:
> On Tuesday, 22 November 2016 at 13:06:27 UTC, Nordlöw wrote:
> > On Monday, 21 November 2016 at 20:04:51 UTC, Ali Çehreli wrote:
> >> mixin template RvalueRef() // <-- DOES NOT TAKE A PARAMETER
> >> ANY MORE
> >> {
> >>
> >> alias T = typeof(this);
> >> static assert (is(T == struct));
> >>
> >> @nogc @safe
> >> ref const(T) byRef() const pure nothrow return
> >
> > Why do you need to qualify `byRef` as pure nothrow when it's a
> > template?
>
> The thing that gets me more is "return" as a function attribute.
> I see it under "MemberFunctionAttribute" in the grammar but I
> can't find an explanation for its use anywhere...
I believe that that has to do with DIP 25, which is enabled with the -dip25
compiler switch:
http://wiki.dlang.org/DIP25
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list