Want reasonable reference counting? Disable automatic sharing of immutable
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Mon Nov 15 08:46:41 UTC 2021
On Monday, 15 November 2021 at 08:38:07 UTC, Ola Fosheim Grøstad
wrote:
> The reason you can cast away const is so that you can call
> C-APIs that actually have const-behaviour, but not a const
> signature.
Also note that objects that are created as const should not be
modified, quoting
[cppreference](https://en.cppreference.com/w/cpp/language/cv):
«const object - an object whose type is const-qualified, or a
non-mutable subobject of a const object. Such object cannot be
modified: attempt to do so directly is a compile-time error, and
attempt to do so indirectly (e.g., by modifying the const object
through a reference or pointer to non-const type) results in
undefined behavior.»
More information about the Digitalmars-d
mailing list