c++ - Function pointer type not recognized inside template class -
i have typedef define function pointer.
typedef script*(*createobjectfn)(tixmlelement* node);
i've created generic container purpose acts map. it's called dictionary, i've created dictionary of createobjectfn inside class this:
class scriptbank { public: ~scriptbank(); static dictionary<createobjectfn>& getinstance() { static dictionary<createobjectfn>& registry = m_registry; return registry; } private: static dictionary<createobjectfn> m_registry; scriptbank(); };
i have various type of script in dictionary want put inside function of derived script.
now template class:
template <class t> class register { public: register() { scriptbank::getinstance().insert("some string", t::create); } ~register() { } };
inside derived script have like:
static script* create(tixmlelement* node); static register<doorchstatescript> m_registry;
my purpose insert function pointer @ compilation time, compiler seems not recognize right type. in register class got error: cannot convert parameter 2 'script *(tixmlelement *)' 'createobjectfn *'
any ideas?
Comments
Post a Comment