By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,024 Members | 2,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,024 IT Pros & Developers. It's quick & easy.

vector of generic function pointers

P: n/a
Is it possible to have a vector of generic function pointers?

I am able to devise a generic function pointer, this way:

template <typename elemType, elemType (*function)(std::string&)>
struct Method
{
inline elemType operator()(std::string & property)
{
return function(property);
}
};

It is instantiated as:
Method <int, methodOnenumberMethod;

Now I want to create a vector of these generic function pointers, how
do I declare such a vector and how do I initialize its elements:

I found this Scott Meyer's link, which maybe helpful - it is giving me
hint but I am not able to gain my solution from it: http://www.ddj.com/cpp/184401580
Feb 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.