It seems to be stupid question but I have never seen something like this!
int operator() (const std::string& s1, const std::string& s2) const
to me operator is a const member function that return an intger and no variable argument! but need two const variables s1 and s2?!?! I can't get the point of this!
class str_dist_ :
public std::binary_function<std::string, std::string, int> {
public:
int op() (const std::string& s1, const std::string& s2) const
{
if (s1 == s2)
return 0;
else if (s1.empty())
return std::max(s2.size()/2, 1u);
else if (s2.empty())
return std::max(s1.size()/2, 1u);
else
return min_edit_distance(s1, s2, zero_one_cost<char>(' '));
}
std::string empty() const { return std::string(); }
};