Magnum::Math::StrictWeakOrdering struct

A functor which implements strict weak ordering.

A strict weak ordering enables a comparison operator between two elements of a set. With it an ordering can be achieved between the elements. This is useful mainly for interoperability with ordering containers from the C++ standard library, like std::map and std::set:

std::set<Vector2, Math::StrictWeakOrdering> mySet;
std::map<Vector4, Int, Math::StrictWeakOrdering> myMap;

The implementation is done for all types in the Math library, check the source for defails if you want to create an implementation for your own types.

Public functions

template<class T>
auto operator()(const T& a, const T& b) const -> bool
Compares two items.

Function documentation

template<class T>
bool Magnum::Math::StrictWeakOrdering::operator()(const T& a, const T& b) const

Compares two items.

Returns true if a is less than b, returns false if a is equivalent to b or greater. For scalar types this is equivalent to operator<.