mutable keyword
QAston via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu May 19 14:13:29 PDT 2016
On Thursday, 19 May 2016 at 20:44:54 UTC, ciechowoj wrote:
> Is there D equivalent of C++'s mutable keyword? Like the one
> that allows to modify a field of struct from constant method.
> Or some alternative solution?
There isn't an equivalent of mutable keyword because D const
differs from C++ const. D const has stronger guarantees (nothing
reachable from const object will be mutable) so you'll use it
less often compared to C++.
There's a talk on usage of const in D and I think its author also
wrote on the subject:
https://www.youtube.com/watch?v=mPr2UspS0fE
More information about the Digitalmars-d-learn
mailing list