|
Yeah, you're right. I missed the point. I struck my reply's content. Now, turning back to your question:
George_George wrote: 3. I doubt whether it is useful to define a function pointer with empty parameter list -- too restricted.
A lot of class methods usually take 0 arguments and their usefulness is, usually again, out of doubt.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks CPallini,
I want to confirm that, the declaration of variable pmf could be pointed to any member functions of class (type) T which returns type R and no input parameters? Right?
R (T::*pmf)()
regards,
George
|
|
|
|
|
Technically pmf is a member variable of class mem_fun_t whoose type is pointer to a method of class T, accepting zero arguments and returning an instance of class R .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
nevermind. i said a mistake
|
|
|
|
|
I think a day I'll become mad because of a George_George question.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
lol. keep it up, don't let me alone
|
|
|
|
|
I am sorry to make you mad, CPallini. Maybe my question is too hard?
regards,
George
|
|
|
|
|
|
Thanks CPallini,
It is just for fun, technical fun.
regards,
George
|
|
|
|
|
Cool, thanks CPallini!
regards,
George
|
|
|
|
|
1. the code shown here calls a member function in the class T which has no parameters and which returns a variable or type R.
2. as said formerly, the function accepts no parameters.
3. it is certainly useful to have such a function, even though it gets no parameters. the point is that is calls such a function in the class T; that means, every class used MUST have such a function existing, but also it means that every class used so defines its own behavior.
|
|
|
|
|
Thanks toxcct,
1. I do not quite catch your points, why a class must implement a function without any parameters?
<blockquote class="FQ"><div class="FQA">toxcct wrote:</div>that means, every class used MUST have such a function existing, but also it means that every class used so defines its own behavior. </blockquote>
2. I want to confirm that, the declaration of variable pmf could be pointed to any member functions of class (type) T which returns type R and no input parameters? Right?
R (T::*pmf)()
regards,
George
|
|
|
|
|
George_George wrote: 1. I do not quite catch your points, why a class must implement a function without any parameters?
because it does something which doesn't need any further inputs from the caller.
here, the function is used as a functor, that means it is called internally from the STL algorithm you're using, to do a certain action on your class, but the algorithm wouldn't know what to pass it if it had to anyway.
George_George wrote: 2. I want to confirm that, the declaration of variable pmf could be pointed to any member functions of class (type) T which returns type R and no input parameters?
exactly. so, I think the compiler would probably complain (to be verified though) if it canoot determine which function to call if it find more than one.
|
|
|
|
|
Hi toxcct,
Your below description is not true. See my sample and it could compile ok.
toxcct wrote: exactly. so, I think the compiler would probably complain (to be verified though) if it canoot determine which function to call if it find more than one.
class Foo
{
public:
int Foo1() {};
int Foo2() {};
};
class Goo
{
public:
int (Foo::*pmf)();
};
int main()
{
return 0;
}
regards,
George
|
|
|
|
|
I SAID "I think" and "probably" which denotes a not sure at all. so give me my 5 back, dork
|
|
|
|
|
|
|
Done!
regards,
George
|
|
|
|
|
Why you delete your reply?
|
|
|
|
|
because i asked him to. it was a double post.
|
|
|
|
|
Ok but a question did you get notify when someone answer to your reply? I dont know it depends to these changes or no?
|
|
|
|
|
Chris announced it was disabled for some days, but now yes, I do.
|
|
|
|
|
Hi,
Can anybody please tell me the windows messages to capture the events minimize and restore for a dialog based application.
Thanks.
Kishore
|
|
|
|
|
Do you need to SW_MAXIMIZE and SW_MINIMIZE?
|
|
|
|
|
are you asking for WM_MINIMIZE?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|