If you want to convert from a
const to a nonconst or from a
volatile to a nonvolatile, you use
const_cast. This is the only conversion allowed with
const_cast; if any other conversion is involved it must be done using a
separate expression or you’ll get a compile-time error.
If you take the address of a const
object, you produce a pointer to a
const, and this cannot be assigned to a nonconst pointer without a
cast. The old-style cast will accomplish this, but the const_cast is the
appropriate one to use. The same holds true for
volatile.