Click here to Skip to main content
15,902,299 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: User message Pin
Mircea Puiu29-Sep-05 1:32
Mircea Puiu29-Sep-05 1:32 
GeneralRe: User message Pin
bishbosh0229-Sep-05 12:20
bishbosh0229-Sep-05 12:20 
QuestionHow to get the system volume value using mixer apis Pin
ashwath200529-Sep-05 0:27
ashwath200529-Sep-05 0:27 
AnswerRe: How to get the system volume value using mixer apis Pin
mark novak29-Sep-05 2:21
mark novak29-Sep-05 2:21 
QuestionCreateprocess Issue. Pin
.NetRams29-Sep-05 0:04
.NetRams29-Sep-05 0:04 
AnswerRe: Createprocess Issue. Pin
jeffrey@toad.net29-Sep-05 14:46
sussjeffrey@toad.net29-Sep-05 14:46 
QuestionEnable/Disable Menu items Pin
lavate malllik28-Sep-05 23:50
lavate malllik28-Sep-05 23:50 
QuestionPointer to function and templates Pin
vmaltsev28-Sep-05 23:19
vmaltsev28-Sep-05 23:19 
Greetings, everyone.

I stuck with an error "C2064: term does not evaluate to a function taking 1 arguments" when I try to pass pointer to class method as an argument to some method in template. Let's say I have a template with public method 'UserFunction' and private recursive method 'UserFunctionRecursive'

template <class TxData>
class CxTemplate {
public:
    ...
    template <typename TxFunction>
        void UserFunction(TxFunction pFunction) {
            UserFunctionRecursive<TxFunction>(xData, pFunction);
        }
    ...
private:
    template <typename TxFunction4Recursion>
        void UserFunctionRecursive(TxData xData, TxFunction4Recursion pFunction) {
            if(bla-bla)
                UserFunctionRecursive<TxFunction4Recursion>(xData, pFunction);
            else
!!!!=>          pFunction(xData);
        }
}
and I have a class which has user function and object of that template class

class CxClass {
public:
    ...
    void Foo(int i) { ... }
    CxTemplate<int> m_xObject;
}
When I try to call 'UserFunction' method and pass Foo as an argument, I get the C2064 error (on line marked with !!!!=> above)

CxClass obj;
obj.m_xObject.UserFunction(CxClass::Foo); // error

and it's quite clear why, there is no instance of that function. So we have to make it static and it'll work. But, static function has no access to non-static members, so I can't make it static.

Any ideas how to make it work? Sniff | :^)
AnswerRe: Pointer to function and templates Pin
prasad_som29-Sep-05 0:05
prasad_som29-Sep-05 0:05 
GeneralRe: Pointer to function and templates Pin
vmaltsev29-Sep-05 0:24
vmaltsev29-Sep-05 0:24 
GeneralRe: Pointer to function and templates Pin
prasad_som29-Sep-05 1:29
prasad_som29-Sep-05 1:29 
AnswerRe: Pointer to function and templates Pin
Steen Krogsgaard30-Sep-05 3:00
Steen Krogsgaard30-Sep-05 3:00 
QuestionMFC object CFormView Pin
karmendra_js28-Sep-05 23:11
karmendra_js28-Sep-05 23:11 
AnswerRe: MFC object CFormView Pin
prasad_som29-Sep-05 0:36
prasad_som29-Sep-05 0:36 
QuestionRe: MFC object CFormView Pin
karmendra_js29-Sep-05 0:54
karmendra_js29-Sep-05 0:54 
AnswerRe: MFC object CFormView Pin
Steen Krogsgaard30-Sep-05 3:07
Steen Krogsgaard30-Sep-05 3:07 
QuestionVirtual function Pin
karmendra_js28-Sep-05 23:06
karmendra_js28-Sep-05 23:06 
AnswerRe: Virtual function Pin
Cedric Moonen28-Sep-05 23:43
Cedric Moonen28-Sep-05 23:43 
Questionvtbl question when derived Pin
followait28-Sep-05 22:44
followait28-Sep-05 22:44 
AnswerRe: vtbl question when derived Pin
Steen Krogsgaard30-Sep-05 3:37
Steen Krogsgaard30-Sep-05 3:37 
QuestionDeclare Byte Pin
Member 216100428-Sep-05 22:36
Member 216100428-Sep-05 22:36 
AnswerRe: Declare Byte Pin
kakan28-Sep-05 22:47
professionalkakan28-Sep-05 22:47 
GeneralRe: Declare Byte Pin
Member 216100428-Sep-05 23:20
Member 216100428-Sep-05 23:20 
GeneralRe: Declare Byte Pin
kakan28-Sep-05 23:29
professionalkakan28-Sep-05 23:29 
GeneralRe: Declare Byte Pin
toxcct28-Sep-05 23:38
toxcct28-Sep-05 23:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.