What inherent advantages do boost::any
and boost::any_cast
offer over using void*
and dynamic_cast
?
This is what boost's reference says:
It supports copying of any value type and safe checked extraction of that value strictly against its type.
Neither of those can be done with a void*
. There are no checks for you and you have to know yourself what you can cast it to.
I don't think dynamic_cast
enters the picture at all, as it hasn't directly anything to do with either.