Functor to compare two floats with tolerance
A few remarks:



Seems appropriate to add a default value of 0.0f in the constructor:

Less(const float tolerance = 0.0f)
    : m_tolerance(tolerance)
{

}




This class could most certainly be used as a base class.

For example:

class Less1 : public Less
{
public:
    Less1():Less(1.0f)
    {
        ...
    }
    ...
}


So you may as well make it suitable to serve as such:


Declare virtual ~Less()
Change private to protected where needed




The operation f1 &lt; f2 is most likely less expensive than abs(f2 - f1).

So you may as well check it first:

bool operator()(const float f1, const float f2) const
{
    return f1 &lt; f2 &amp;&amp; std::abs(f2 - f1) &gt;= m_tolerance;
}




You should add an assertion on the value of m_tolerance being non-negative.

Alternatively, you could use std::abs(m_tolerance), but it seems a bit hacky.