How do I overload an operator to work with a struct?
I have a struct called Readings and I want to overload the < operator to work开发者_Python百科 with it. It's to compare two readings and determine which one is larger.
Here's my struct:
struct Reading {
int hour;
double temperature;
Reading(int h, double t): hour(h), temperature(t) { }
};
精彩评论