On Mon, 6 Sep 2010 17:49:41 +0200, Tang Jiang Jun
I agree with you that void* just support polymorphism for single inheritance. However I think maybe it is possible to make boost::any to support full polymorphic behavior, because, for boost::any, there still has accurate type information when casting happens. With some tricks, maybe we can use dynamic_cast to help boost::any to cast the internal pointer to correct child class object.
Thanks! Tang Jiang Jun
void* does NOT officially support polymorphism. If you look at the standard you can cast from T* to void* to T* (with allowed variation in const and volatile) but not from A* to void* to B*, even if there is a inheritance relationship between A and B. It may work for many platforms (for single inheritance), but officially it is Undefined Behavior. Richard Damon