I
inquisitive
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, methodOne> numberMethod;
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
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, methodOne> numberMethod;
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