Class member calls function template with callback function?

In C++ you cannot initialize class-members in-place. You need to do that in the constructor initializer list.

In C++ you cannot initialize class-members in-place. You need to do that in the constructor initializer list class Game { public: Game():list(highScore) {}; ~Game() {}; //compare function static int highScore(Player one, Player two); private: SortedList list; }; The function needs to be declared as static in the class definition as SortedList calls it without a *this pointer, like an ordinary function. Performance is really unnecessary bad of the comparison function because you always copy the two items to be compared when passing them as arguments.

Better make the comparison function's type to receive const-references and change highScore's signature appropriately int (*compare)(ElemType const& a, ElemType const& b).

. In C++, it would probably be more common to use std::sort or std::stable_sort, and use predicates that determine "less-than" relationship (bool compare_scores(const Player& a, const Player& b) { return a. Score topten() ... I can't use the constructor, because topten is not a member.

– Luciano Jun 21 '10 at 15:07.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions