This will not work
template<typename T>
struct foo {
T t;
};
bool operator==(const foo &lhs, const foo &rhs) { //error, requires template arg
return lhs.t == rhs.t;
}
Is this the correct way to solve this? I want define also the operators <,>,<=,>=,!= so doing template<typename T>
on all of them would be lengthy.
template<typename T>
struct foo {
T t;
};
template<typename T>
bool operator==(const foo<T> &lhs, const foo<T> &rhs) {
return lhs.t == rhs.t;
}