__traits(isRef, this) cannot distinguish l-value- from r-value-passed this
Nordlöw via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jan 18 17:44:10 PST 2017
On Thursday, 19 January 2017 at 00:44:51 UTC, Nordlöw wrote:
> Any clues on how to retrieve this information?
Another much more common use case:
Chained property setters could be optimized iff the property
setter is called on an r-value, that is when
`__traits(isRef,this)` is `false`
Typically usages such as
f(S.init.setX(2).setY(3))
and
auto s = S.init.setX(2).setY(3)
should all result in only *one* single construction of `S` (in
the `S.init` expression).
More information about the Digitalmars-d-learn
mailing list