main.cpp
// Give your class a < operator and define a vector of HasPtrs. Give that vector
// some element and then sort the vector.
std::vector<HasPtr> vecHP;
std::string val;
while (std::cin >> val) {
HasPtr temp(val);
vecHP.push_back(temp);
}
std::sort(vecHP.begin(), vecHP.end());
HasPtr.h
bool operator<(const HasPtr& rhs) {
return (*this->ps < *rhs.ps);
}
private:
std::string *ps;
int i;
i could've used supplementary compare function for the third param of sort, but I'm sure the question aimed to use the default sort's compare function which mean that I need to adjust the operator< to perform the appropriate task. So, how I can access both value, returned the appropriate binary value and then process the sorting without getting this error?