casting - C++ What's the named cast equivalent -
what's named cast equivalent following old-style cast?
const string *ps; void *pv; pv = (void*)ps; // <--- is pv = static_cast<void*>(const_cast<string*>(ps)); ?
pv = const_cast<string *>(ps); is enough - void * implicitly assignable from (non-qualified) data (object) pointer type.
(of course, same reason, direct assignment const void * without casting work.)
Comments
Post a Comment