How to break const

Mehrdad wfunction at hotmail.com
Mon Jun 18 08:28:06 PDT 2012


On Monday, 18 June 2012 at 15:24:31 UTC, Mehrdad wrote:
> On Monday, 18 June 2012 at 15:21:36 UTC, Timon Gehr wrote:
>>> So (**IMHO**) if that's really the case, we should really 
>>> spend some
>>> time fixing the /design/ of const before the implementation...
>>
>> This is mostly about the design of object initialisation.
>>
>>> good idea or no?
>>
>> Certainly.
>
>
> My initial instinct would be to require a "const constructor" 
> in order for an object to be const-able, but I'm not sure if 
> that would work correctly or not..

Come to think of it, that would play REALLY nicely with 'scope' 
-- a reference to a non-const object can be escaped from a 'const 
constructor' if and only if the reference is scope!

Bingo! Does that work??


More information about the Digitalmars-d mailing list