|
Sorry, we got caught up in expressing our point and the discussion whent amok!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
No need to apologize, George. I was anything but offended.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Do you have a bee in your bonnet? Italians must have some strange translation issues 'cause you've accused me of being both offensive and arrogant, both of which couldn't be further from reality.
CPallini wrote: But who cares?
I certainly don't. I was just curious as to why you and George insisted on beating a dead horse.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Do you have a bee in your bonnet?
Maybe. Anyway, as you probably guessed I've completely missed your point (I already apoligized about, please see modified post).
DavidCrow wrote: 'cause you've accused me of being both offensive and arrogant, both of which couldn't be further from reality.
I'm happy about.
DavidCrow wrote: Italians must have some strange translation issues
This is at least unpolite (but my reply was really rude so I can't blame about). Anyway it wasn't a translation issue.
Have a nice day and sorry again for the misunderstanding.
DavidCrow wrote: I certainly don't. I was just curious as to why you and George insisted on beating a dead horse.
I think we're two obstinate guys.
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.
|
|
|
|
|
Hi DavidCrow,
It is also my coding style not to use &array.
It is code written by other people.
regards,
George
|
|
|
|
|
Hello everyone,
In the following statements,
<br />
template <class R, class T> class mem_fun_t : public unary_function <T*, R><br />
<br />
{<br />
<br />
R (T::*pmf)()<br />
...<br />
}<br />
1. I think pmf is a type of function pointer, the return type of the function is R and the function is a member function of type (class) T. Is my understanding correct?
2. If yes, what is the parameter list of the function? Empty parameter list?
3. I doubt whether it is useful to define a function pointer with empty parameter list -- too restricted.
thanks in advance,
George
|
|
|
|
|
Read documentation http://msdn2.microsoft.com/en-us/library/c8hzs937(VS.80).aspx[^] and you'll be able to answer all the questions yourself.
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.
|
|
|
|
|
Hi CPallini,
I do not think your reply has anything to do with my question. I am asking function pointer, not how to use unary_function itself.
regards,
George
|
|
|
|
|
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
|
|
|
|
|