I have made an class called Person made up by other classes as Name and Adress. Objects of the Person class is stored in a vector called personList. Everything works fine but my method for sorting!
I need to be able to sort the vector alphabetically, first by name & if the names are similar, by address. My issue right now is That I cant think of anyway to make the search case-insensitive.
Would apreciate any kind of help! Ive just started Learning C++.
This is the code for my function for sorting:
bool sortByName(const Person & lhs, const Person & rhs)
{
if (lhs.getName() == rhs.getName())
return lhs.getAdress() < rhs.getAdress();
else
return lhs.getName() < rhs.getName();
}