c++ - C++11 Vector of Pointers to Templated Static Member Function -


say have class goes this:

struct mystruct {     template<typename t>     static int func()     {         // template parameter.     } }; 

now want create vector of pointers functions func's prototype. since prototype not depend on template parameter, should possible. and, sure enough, can explicitly typedef pointer func, so:

typedef int (* funcptr)(mystruct * pointer); 

and then, creating vector easy as:

std::vector<funcptr> funcvector; 

however, avoid declaring func's prototype twice. possible so?

use decltype:

std::vector<decltype(&mystruct::func<void>)> funcvector; 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -