Accessing Values in a Class Similar to boost::any
问题 I'm making a simple boost::any -like class for educational purposes, but I can't figure out how to access the stored value. I can set the value perfectly, but when I try to access any member in the "holder" class the compiler just complains that the member wasn't found in the class it was derived from. I can't declare the members as virtual because of the templates. Here's the relevant code: class Element { struct ValueStorageBase { }; template <typename Datatype> struct ValueStorage: public