C++ mutable in D

Paul Backus snarwin at gmail.com
Sun Aug 1 18:25:47 UTC 2021


On Sunday, 1 August 2021 at 18:21:32 UTC, Michael Galuza wrote:
>
> In other words, can we implement method `void S.opAssign(T 
> value) const` of some struct `S` which change internal state of 
> `S` and this method doesn't have UB and doesn't break D's type 
> system.

No. Mutating an object typed as `const` is always UB in D.


More information about the Digitalmars-d mailing list