2 ms·
But if some other code gets a non-const reference to an object via another pointer path, that code can mutate the object, even though const pointers to that obj
by pcwalton 9y ago
But if some other code gets a non-const reference to an object via another pointer path, that code can mutate the object, even though const pointers to that object may exist. In Rust, this is not the case.
That difference severely weakens the meaning of the const property in C++.
- frankzinger 9y agoSee my comment below for how to prevent this: https://news.ycombinator.com/item?id=16550209 https://news.ycombinator.com/item?id=16550209