C++ mutable in D
nise at nise.com
Fri Jul 30 21:53:01 UTC 2021
On Friday, 30 July 2021 at 20:09:19 UTC, Tejas wrote:
> 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++).
Thank you D for not having "mutable" as in C++. I don't see
mutable often in C++ and is one of those corners in C++ that I
don't think make much sense.
const is const, easy. In C++ const might not be ROMable. In D
immutable is ROMable and transistive const helps this (unless
there is some escape hatch I don't know about).
More information about the Digitalmars-d