Returning a ref to a temporary already possible?

Shriramana Sharma via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 23 04:25:52 PDT 2014


Hi thanks for the reply.

So should I understand that "return this" doesn't really return the
ref but the object actually? Or it does return a reference but since
it's assigned a name, it lives on under that name and so only the
single struct object P is ever created? Otherwise one would wonder how
a temporary can have lifetime beyond the line in which it is created.

I'd really like to know what's exactly happening in that line:

auto P = Pair(1, 2).handle ;

Thanks!


-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा



More information about the Digitalmars-d-learn mailing list