C++ mutable in D

Tejas notrealemail at gmail.com
Fri Jul 30 20:09:19 UTC 2021


On Friday, 30 July 2021 at 19:17:55 UTC, Michael Galuza wrote:
> Is there any analogue of C++ `mutable` in D? As far as I 
> understand, this is impossible due to transitive constness, but 
> maybe some variation of `Rebindable` will be useful?
>
> P.S. Of course I mean 'fair' mutable, not qualifier-away 
> `cast()`.

Nope. No logical const, head const, or tail const in D; just pure 
transitive const.

Also remember that casting away const is undefined behaviour in D 
(unlike being defined and supported in C++).


More information about the Digitalmars-d mailing list