class QString { public:inline QString(const int i); }; class object {}; template < class T > struct rvalue_from_python_data { ~rvalue_from_python_data(); }; template < class T > struct extract_rvalue { typedef const T & result_type; mutable rvalue_from_python_data < T > m_data; }; template < class T > struct extract:extract_rvalue < T > { private:typedef extract_rvalue < T > base; public:typedef typename base::result_type result_type; operator result_type() const {} extract(object const &); }; template < class Key, class T > class QHash { public:inline QHash() {} T & operator[](const Key & key); }; class type_details { typedef object(*func_python_to_cpp_type) (const object &); public: template < typename T > static type_details *create_value_type_details() { type_details *self = new type_details(); self->m_func_python_to_cpp = &python_to_value_type < T >; } func_python_to_cpp_type m_func_python_to_cpp; template < class T > static object python_to_value_type(const object & obj) { T *val = new T(extract < T > (obj)); } }; class type_manager { public: static type_manager & instance(); template < typename T > void register_value_type() { m_type_map[0] = type_details::create_value_type_details < T > (); } QHash < QString, type_details * >m_type_map; }; void foo() { type_manager::instance().register_value_type < object > (); }