it seems that overloading operators is not working for me, I am probably doing something wrong.
I've got this structure
typedef void (*fptr)(void);
struct Mystruct
{
int id;
int priority;
double timeSaved;
double aktivationTime;
fptr eventPointer;
MystructnextPtr;
Mystruct(int id, int priority, double timeSaved, double aktivationTime, fptr eventPointer);
};
This operator:
bool operator <(const Mystruct& x, const Mystruct& y)
{
return std::tie(x.aktivationTime, x.priority, x.timeSaved) < std::tie(y.aktivationTime, y.priority, y.timeSaved);
}
And am trying to execute this code:
Mystruct* struct1 = new Mystruct(5, 10, 0, 15.3, f1);
Mystruct* struct2 = new Mystruct(5, 10, 0, 14.3, fi);
if (struct1 < struct2)
{
cout << "struct1 is smaller!" << endl;
}
else
{
cout << "struct2 is smaller!" << endl;
}
It ALWAYS says to me that struct1 is smaller, regardless of what is in those structures. What am doing wrong?