Sorenson: in your post
Code:
class s
{
public:
bool operator()(const Sstring* a, const Sstring* b){
return *a < *b;
}
};
class Holder{
private:
list<Sstring *> theList;
public:
void addMe(Sstring *IN){
theList.push_front(IN);
}
void dsp_all(){
list<Sstring *>::iterator i = theList.begin();
cout<<endl<<"--TOP--"<<endl<<endl;
while(i != theList.end()){
(*i)->dsp();//toStr;
cout<<endl;
i++;
}
cout<<endl<<"--END--"<<endl;
}
void ListSort(){
cout<<"Holder::ListSort()"<<endl;
theList.sort(s());
}
what if you declared an instance of type s to send to list::sort() rather than trying to send the class name itself? Something like this:
Code:
void ListSort(){
cout<<"Holder::ListSort()"<<endl;
s functionObject;
theList.sort(functionObject());
}
Sorry, don't have compiler capable of using STL so can't compile the code myself.