This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: help with STL needed


Hi Martin,

The key in your set is the POINTER, not the object. The pointer is different between obj1 and obj3, so they are different objects.

Use a std::map, not a std::set. For the key in your std::map, use the public key of the object you are sticking in the std::map.

Or make your classes monostate or singleton. But that's not really what you'd want, I'd think.

--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]