I want to sort the "mystruct" by the distance variable, what is the fastest way of doing this?
struct MyStruct {
int scale;
bool pass;
float distance;
};
vector<MyStruct> mystruct;
...
sort (mystruct.begin(), mystruct.begin() + mystruct.size());
//this doesn't work since is trying to sort by "MyStruct" and not by a number
if I had a
vector<float> myfloat;
...
sort (myfloat.begin(), myfloat.begin() + myfloat.size());
then will work perfectly.