0

I have to order by discovery date an Artefact and print the content .

I have this class :

class Artifact{
protected:
    int discoveryDate_;
    int estimatedDateOfOrigin_;
    Artifact::artifactType _artifactType;
    Artifact::condition_ _condition;
};

I also have 2 derived class GreekArtifact and Egypteam artifact and i created 5 object of GreekArtifact and 5 objects of Egypteam artifact and i added them in a list

std::list<Artifact> artifacts;

And i tried to sort this list by discovery date and i did this :

 std::sort(artifacts.begin(),artifacts.end(),[](auto &a, auto &b){
        return a->getDiscoveryDate() > b->getDiscoveryDate();
   });

and this sort doesnt work and i dont know why and i really dont understand the error that sounds like this :

error: no match for 'operator-' (operand types are 'std::_List_iterator<Artifact>' and 'std::_List_iterator<Artifact>')
     std::__lg(__last - __first) * 2,

Can you please help me to figure out what i did wrong??

0 Answers0