Naveen
Naveen

Reputation: 407

error in template declaration

I am getting "error: cannot declare pointer to 'void' member" for below code.

 template  <class T>
    DtRequestId Notify(T* pObject, void (T::*callback)(Status*));

can somebody please help?

Upvotes: 0

Views: 171

Answers (1)

Thomas
Thomas

Reputation: 181745

I get this error when I compile this (whole file):

typedef int DtRequestId;
template  <class T>
    DtRequestId Notify(T* pObject, void (T::*callback)(Status*));

But if I also define Status, the error goes away:

typedef int DtRequestId;
typedef int Status;
template  <class T>
    DtRequestId Notify(T* pObject, void (T::*callback)(Status*));

So maybe you forgot to give a definition of Status.

Upvotes: 2

Related Questions