So I have a simple class that I want to take a functor:
Code:
template<typename T>
class CMyMFCEditBrowseCtrl: public CMFCEditBrowseCtrl
{
public:
CMyMFCEditBrowseCtrl(T OnAfterUpdateFunc): m_OnAfterUpdateFunc(OnAfterUpdateFunc) {}
virtual void OnAfterUpdate() { m_OnAfterUpdateFunc(); }
protected:
T m_OnAfterUpdateFunc;
};
Now, since this is a derived class that merely overrides a virtual function, it must be in my header:
Code:
class CVideoEncoderforN8Dlg : public CDialogEx
{
...
CMyMFCEditBrowseCtrl<?> m_VideoCtrl;
...
};
But there is the problem. I need to put in a functor, so I don't know the type. And since I cannot define the functor inside the header, I cannot deduce the type.
So I need to hide or post-pone the type in some way. So this is what I wanted to ask. What is good solution for this kind of situation? What are some good techniques?