I know that C++ doesn\'t support covariance for containers elements, as in Java or C#. So the following code probably is undefined behavior:
#include
You are invoking the bad spirit of reinterpret_cast<>.
Unless you really know what you do (I mean not proudly and not pedantically) reinterpret_cast is one of the gates of evil.
The only safe use I know of is managing classes and structures between C++ and C functions calls. There maybe some others however.