Copy instead of reference?
Maxim Fomin
maxim at maxim-fomin.ru
Thu May 23 05:07:39 PDT 2013
On Thursday, 23 May 2013 at 11:57:04 UTC, Namespace wrote:
> I know that D has (sadly) no C++ references, but I still think
> that
>
> A a = some_existing_A;
>
> should call opAssign.
Now I see what has you confused. Whether postblit or opAssign is
called, depend on left, not right side of assignment. Object 'a'
didn't exists prior, so postblit is called, and copy ctor is
called with respect of 'a' as 'this' argument.
More information about the Digitalmars-d-learn
mailing list