I have a vector, in which I save objects. I need to convert it to set. I have been reading about set, but I still have a couple of questions:
How to correctly initialize it? Honestly, some tutorials say it is fine to initialize it like set<ObjectName> something
. Others say that you need an iterator there too, like set<Iterator, ObjectName> something
.
How to insert them correctly. Again, is it enough to just write something.insert(object)
and that's all?
How to get specific object (for example object, which has name variable in it, which is equal to "ben") from set?
P.S. I have convert vector it self to be as a set (a.k.a. I have to use set rather then vector). Only set can be in my code.