Initializing const member post-construction?

Steven Schveighoffer schveiguy at
Tue Oct 28 21:18:56 PDT 2008

"Jerry Quinn" wrote
> Steven Schveighoffer Wrote:
>> I was unaware you could even set a in the constructor.  I don't think
>> there's any general 'set once' type modifier.
> No, I didn't see one either.  In fact what I was asking for is not a set 
> once.  It's to allow a reference to a const object to be reassigned, since 
> it wasn't obvious to me that the reference itself should be kept const.

Oh, for this there is std.typecons.Rebindable:

Rebindable!(const(A)) a;

Not sure how close it is to the real thing, I haven't used it.


More information about the Digitalmars-d-learn mailing list