I have these two classes and I want to sort the list but it shows a lot of errors what is the problem?
class Especie {
private:
string gen;
string id;
map<string,int> k_meros;
public:
string Especie::consultar_id() const{
return id;
}
class Cjt_especies {
private:
list<Especie> cjt_especies;
Taula tab;/*ANOTHER CLASS*/
public:
bool comp (const Especie& ex,const Especie& ex2){
return (ex.consultar_id() < ex2.consultar_id());
}
void Cjt_especies::something(){
/*code that makes some push_back at the list*/
sort(cjt_especies.begin(),cjt_especies.end(),comp);
}
Why does it not compile? I want to sort the list of Cjt_especies increasingly by id. Thanks.