In C++11, the items in a std::set
or std::unordered_set
are all const
. You can't insert into one of them, you have to remove it and re-add.
This is because you're determining the position in the parent set by its hash value, which might change if you add a new item to it. It's analogous to the keys in a std::map
being const
.