I'm having problems ... I'm not sure I understand the STL documentation. Let's say I have this:
#include <set> ... struct foo { int bar; }; struct comp { inline bool operator()(const foo& left,const foo& right) { return left.bar < right.bar; } }; int main() { std::set<foo,comp> fooset; // Uses comparison struct/class object comp to sort the container ... return 0; }
How to insert struct foo into a set using my own comparator structure?
Jay kim
source share