C++, function pointer to the template function pointer

Posted by Ian on Stack Overflow See other posts from Stack Overflow or by Ian
Published on 2011-01-01T11:43:24Z Indexed on 2011/01/01 11:54 UTC
Read the original article Hit count: 247

Filed under:
|
|

I am having a pointer to the common static method

class MyClass
{
  private:
    static double ( *pfunction ) ( const Object *, const Object *);
    ...
};

pointing to the static method

 class SomeClass
 {
  public:
    static double getA ( const Object *o1, const Object *o2);
    ...
 };

Initialization:

double ( *MyClass::pfunction ) ( const Object *o1, const Object *o2 )  = &SomeClass::getA;

I would like to convert this pointer to the static template function pointer:

template <class T>
static T ( *pfunction ) ( const Object <T> *, const Object <T> *); //Compile error

where:

 class SomeClass
 {
  public:
    template <class T>
    static double getA ( const Object <T> *o1, const Object <T> *o2);
    ...
 };

But there is some error... Thanks for your help...

© Stack Overflow or respective owner

Related posts about c++

Related posts about templates