c++ - Template meta programming inside template class -
i'm trying pre create template member functions in array, , index array using run time determined values. array array of pointers template functions within manager specialize. call 1 of these functions process::send function. example.
template<typename matcht> class manager { public: template <int p> void do(); template<int p, int ...ps> struct table : table<p-1, p-1, ps... >{}; template<int... ps> struct table <0, ps...> { static constexpr void(*fns[])()={do<ps>...}; }; }; template <typename matcht> template<int... ps> constexpr void(*manager<matcht>::table<0,ps...>::fns[sizeof...(ps)])(); //process.h #include "manager.h" template<typename matcht> class process { public: void send(manager<matcht>& mgr ); private: typename manager<matcht>::template table<5> _processtable; }; //process.c template<typename matcht> void process<matcht>::send(manager<matcht>& mgr) { error here: mgr.*_processtable::fns[1](); }
error " _processtable not class, namespace , or enumeration".
Comments
Post a Comment