Copy instead of reference?
Artur Skawina
art.08.09 at gmail.com
Thu May 23 04:24:54 PDT 2013
On 05/23/13 11:47, Namespace wrote:
> I get this output:
>
> ====
>
> ----
> CTor 42
> DTor 0
> Return A
> Postblit 42
> ----
> DTor 84
> DTor 42
>
> ====
>
> with the following code. I'm a bit confused about the Postblit. I return by ref so I thought that I get a const ref of the original A.
> ref const(A) getA() const {
> writeln("Return A");
> return this._a;
> }
> A a = b.getA();
You do, but you then assign to another 'A'...
artur
More information about the Digitalmars-d-learn
mailing list