Correct usage(s) of const_cast<>

Posted by ereOn on Stack Overflow See other posts from Stack Overflow or by ereOn
Published on 2010-04-20T08:02:29Z Indexed on 2010/04/20 8:13 UTC
Read the original article Hit count: 110

Filed under:
|
|

Hi,

As a common rule, it is very often considered a bad practice to use const_cast<>() in C++ code as it reveals (most of the time) a flaw in the design.

While I totally agree with this, I however wonder what are the cases were using const_cast<>() is ok and the only solution.

Could you guys please give me some examples you know/you encountered ?

Thank you very much.

© Stack Overflow or respective owner

Related posts about best-practices

Related posts about c++