I'm a little confused about which is better or correct to declare a function in "for" & "member function" in a class. I think the best way is trying not to make these cases...
Here are some examples.
template<typename K> class Bigger {
public:
bool operator()(const K& a, const K& b) const {
int aa = a.getValueJ() * a.getValueK();
int bb = b.getValueJ() * b.getValueK();
return aa > bb;
}
};
template<typename K> class Bigger {
public:
bool operator()(const K& a, const K& b) const {
return (a.getValueJ() * a.getValueK()) > (b.getValueJ() * b.getValueK());
}
};
=======================================
for (auto i : time1) {
int t = t.getValueJ() / t.getValueK();
cout << t << " ";
}
for (auto i : time1) {
cout << t.getValueJ() / t.getValueK() << " ";
}
It seems like a very novice question.
Could you give me a little advice for them?
Have a nice day~