On 5/23/13 11:07 AM, Dicebot wrote:
On Thursday, 23 May 2013 at 14:58:01 UTC, Steven Schveighoffer wrote:
Seems like const qualifier for members is simply ignored inside the
ctor, it should only be ignored until it is set, or until it is used.

I am quite sure I have seen it (mutability of immutable in constructor)
guaranteed either by spec or TDPL. Don't have TDPL with me right now,
need to check later.

TDPL 8.4 discusses a raw/cooked model of construction. The same principle should apply to const/immutable member construction: you get to cook the field, but you can't taste it while raw.

The presence of an initializer with the immutable/const member declaration serves as a default in case the member is not explicitly initialized.


Andrei

Reply via email to