Search code examples
c++templatesusing

Using <name> = ... Does not name a type


The goal is to define a function in a template object with void (void) as prototype. The following code:

template <class T>
using ClassVoidFunctionPointer = void (T::*)(void);

class Scheduler {

public:
        Scheduler(void);
        ~Scheduler(void);
        template <class T>
        void addTask(unsigned short interval, unsigned short delay,T templateClass,ClassVoidFunctionPointer classFunctionPtr );//For newer functions
...
}

This gives me errors:

inc/scheduler.h:18:77: error: 'ClassVoidFunctionPointer' is not a type

Why do I get this error?


Solution

  • You forgot template arguments:

    , ClassVoidFunctionPointer<T> classFunctionPtr,