C++-style mutable members

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 17 13:04:52 PST 2017


On Tuesday, 17 January 2017 at 20:50:34 UTC, Nordlöw wrote:
> On Tuesday, 17 January 2017 at 20:47:35 UTC, ketmar wrote:
>>> Is there a way to mimic C++-style `mutable` members in D?
>> sure: don't use `const`. otherwise — no, there is simply no 
>> way to «mimic» 'em due to completely different meaning of 
>> `const` in D and C++.
>
> I'm aware of the difference. I'm just making sure there are no 
> ways out of the type system ;)

besides brutally raping it with `cast` is accessor methods — no. 
;-)


More information about the Digitalmars-d-learn mailing list