vector of generic function pointers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • inquisitive

    #1

    vector of generic function pointers

    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(proper ty);
    }
    };

    It is instantiated as:
    Method <int, methodOnenumber Method;

    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
Working...