3 ms·
I should clarify that it is fine in a local context, when you know that originally it is a non-const variable. Otherwise, the result is undefined. But what I m
by zura 13y ago
I should clarify that it is fine in a local context, when you know that originally it is a non-const variable. Otherwise, the result is undefined.
But what I meant in the above comment is that you can't accidentally type "const_cast". So when you type it, you're on your own. And there is nothing wrong with it in C++ world - if you explicitly state that you want to shoot yourself in the foot, the compiler will just listen to your orders (maybe with some warnings).