I'm told that if I derive my comparison function objects from std::binary_function, I'm "helping the STL." How? What does, std::sort(), for example, deduce from that template? Why is
Code:
class comp_square : public std::binary_function<double,double,bool>
{
bool operator() (const double & left, const double & right)
{
return std::pow(left,2) < std::pow(right,2);
}
// . . . . . .
};
better than
Code:
class comp_square
{
bool operator() (const double & left, const double & right)
{
return std::pow(left,2) < std::pow(right,2);
}
// . . . . . .
};