I have a vector, in which I save objects. I need to convert it to set. I have been reading about sets, 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, likeset<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 a specific object (for example, an object which has a named variable in it, which is equal to "ben") from the set?
I have to convert the vector itself to be a set (a.k.a. I have to use a set rather than a vector).