Reputation: 260
I need to chose a container which will store only a few elements and also no duplicates. I will need later to search after the elements. I thought about set and unordered_set, which will be the best option ? The set will get its elements one by one.
Upvotes: 1
Views: 95
Reputation: 10936
Just use std::vector. and std::find(...)
before inserting. If it's already there, don't. If you need it to be sorted, call std::sort
after successful insert.
Upvotes: 1