I am trying to implement a callback mechanism based on gotw #83:
http://gotw.ca/gotw/083.htm
---------------------
class CallbackBase
{
public:
virtual void operator()(const TCHAR*) const { };
virtual ~CallbackBase() = 0;
};
template<typename T>
class Callback : public CallbackBase
{
public:
typedef void (T::*F)(const TCHAR*);
Callback( T& t, F f ) : t_(&t), f_(f) { }
void operator()(const TCHAR*) const { (t_->*f_)(const TCHAR*); }
private:
T* t_;
F f_;
};
-------------------------
I've been staring at it for a while now and I can't figure out why the line:
void operator()(const TCHAR*) const { (t_->*f_)(const TCHAR*); }
gives the following errors:
error C2143: syntax error : missing ')' before 'const'
error C2198: 'const Callback<T>::F' : too few actual parameters
error C2059: syntax error : ')'