Sets/Multisets
A set is an associative container just like a map, and, just like a map, every key is unique; it cannot have multiples of the same key. The difference with a set is that it is not a container for key-value pairs. It is essentially a container of unique keys, like a vector in which each element in the vector is unique. Once an element is added to a set, it cannot be modified; but it can be removed from the set. A multiset behaves just like a set except for allowing multiple non-unique keys.
Constructors
When constructing a set, we can also pass in the comparator used to sort the set. A comparator is a function that's used to decide how elements are to be ordered in the set. The following are a selection of constructors to use for sets and multisets (only sets are shown, for brevity):
set();
: Default empty setset(const key_compare& comp);
: Empty set with the chosen comparison objectset(const set& x);
: Copy constructortemplate...