Renato Araujo wrote:
I had the same problem as you in my binding implementation, then I solve the problem using this function:// // a generator with an execute() function which, given a source type // and a pointer to an object of that type, returns its most-derived // /reachable/ type identifier and object pointer. // // first, the case where T has virtual functions template <class T> struct polymorphic_id_generator { static dynamic_id_t execute(void* p_) { T* p = static_cast<T*>(p_); return std::make_pair(dynamic_cast<void*>(p), class_id(typeid(*p))); } }; I use this function to get a pointer to most-derived type and use this as key in my hash table.
Cool -- how do you clean the table when an object is destroyed? Alex _______________________________________________ Cplusplus-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/cplusplus-sig
