I have a class that has a few variables and getters / setters. I set these variables and then place the node into a vector.
Code:
vehicle.setLicensePlate(plate);
vehicle.setCamera(camera);
vehicle.setTime(time);
VectorVehicle.push_back(vehicle);
Here is the issue, I am using std::sort and want to sort by the licensePlates like this:
Code:
class Calculate {
private:
std::string line;
std::vector<std::string> readerVector;
Vehicle vehicle;
struct{
inline bool operator() (std::vector<Vehicle> v1, std::vector<Vehicle> v2)
{
return v1.getLicensePlate == v2.getLicensePlate;
};
}licensePlateObject;
public:
Calculate();
void readFile();
void calculateSpeed();
int verifyOutFile(std::istream &reader);
void sortVector(std::vector<Vehicle> v);
};
In Calculate Class:
Then sort this vector by license plates
Code:
void Calculate::sortVector(std::vector<Vehicle> v){
std::sort(v->getLicensePlate.begin(), v.getLicensePlate.end(),licensePlateObject);
}
I know my sort method is incorrect, I have tried a few different ways but it is not working. Just looking for some advice.