
AMDG Mathias Gaunard wrote:
typedef mpl::map< mpl::pair< mpl::string<'D', 'e', 'r', 'i', 'v', 'e', 'd', '1'>, Derived1 >, mpl::pair< mpl::string<'D', 'e', 'r', 'i', 'v', 'e', 'd', '2'>, Derived2 >, mpl::pair< mpl::string<'D', 'e', 'r', 'i', 'v', 'e', 'd', '3'> Derived3 >
derived_types;
I think that you should associate the name with the types and then specify a list of types. template<> struct name_of<Derived1> : mpl::string<'D', 'e', 'r', 'i', 'v', 'e', 'd', '1'> {}; //... typedef mpl::vector<Derived1, Derived2, Derived3, ..., DerivedN> derived_types; Hmmm... This seems rather reminiscent of Typeof registration.
Is there some interest in such a tool?
Any chance that this could be generalized a bit to dispatching on a type_info object, so it can be used with any, too e.g.? struct Visitor { boost::any& any_; template<typename T> void operator()(wrap<T>) { T& t = boost::any_cast<T&>(any_); } }; In Christ, Steven Watanabe