I've been looking at the std::set, or at least the SGI version of it, and I'm a bit confused.
According to the main set
page, if you're generating a set of objects that don't have an operator< defined, you need to provide a class that allows you to compare the objects, in order to implement the strict weak ordering that set requires.
However, according to, for example, the set_intersection()
page says that when using an algorithm such as set_intersection, if there is no operator< available, you need to provide a function object that allows comparison between the objects.
My question is basically: why in one case is a class required, and in the other a function object? Am I missing something fundamental?
Thanks to anyone who can shed any light on this!