Just to hijack yet another thread :-) may I ask if there’s a method to determine which of these two options is faster (or let’s say more efficient) without testing them?
std::set<int> + size()
vs std::unordered_set<int> + bucket_count()
unordered_set should generally be faster since it uses a hash table instead of a balanced binary tree.
But you should still use size() if you want the number of elements it contains.