I have a struct which has a unique key. I want to insert instances of these structs into a set. I know that to do this the < operator has to be overloaded so that set can mak
The problem isn't in your set; it's in your test object. You're using Java style there. In C++, we just write:
test
set bar; int main() { foo test; // Local variable, goes out of scope at } test.key = 0; bar.insert(test); // Insert _a copy of test_ in bar. }