Custom Class for std::set

When we want to use custom classes for the STL set data structure, which way do you guys do it?

I look around and see people passing comparators, overloading operator(), and also overloading operator< in the class itself.

Which one's the idiomatic c++ way?
They are all idiomatic, this is more of a question of class design.

If a class has an ordering relation that makes sense for its values, provide operator<

When it doesn't (or perhaps when it has multiple ways in which it can be ordered), then create a comparison predicate.
Topic archived. No new replies allowed.