Is there an actual difference between a const_cast and c style cast (ObjectType) ?
See Question&Answers more detail:osIs there an actual difference between a const_cast and c style cast (ObjectType) ?
See Question&Answers more detail:osA const_cast
conveys specific information about the intent behind the cast that a C cast cannot.
If you accidentally try to use a const_cast
for purposes other than adding or removing const
or volatile
, the compiler will help you with an error message.
Also, const_cast
is searchable, unlike a C-style cast.