Possible optimization opportunity when assigning to a member in the constructor

Ali Çehreli acehreli at yahoo.com
Fri Mar 15 17:19:45 PDT 2013


On 03/14/2013 09:54 PM, deadalnix wrote:
 > On Friday, 15 March 2013 at 04:09:25 UTC, Ali Çehreli wrote:

 >> Something like "If an rvalue is assigned to a
 >> member in a constructor, do not call opAssign() of the member".
 >>
 >> Ali
 >
 > Yes, in general, first assignment in a constructor should be considered
 > as a declaration if the value is not read before.
 >
 > This allow for the mentioned optimization, but many very other important
 > stuff as well, like the construction of immutable objects.

Thank you! Opened an enhancement request:

   http://d.puremagic.com/issues/show_bug.cgi?id=9732

Ali



More information about the Digitalmars-d mailing list