ArbolOne <arbol...@gmail.com> schrieb: > Does STL have a container that would allow me to story only one copy > of whatever data I am storing? For instance, in a data pool where > there are several people named Mike, the container will only allow me > to story the first person named Mike.
Ordinary sets and a maps behave like this. Which element remains in the container depends on the input method: a set stores always the last added element, previously stored elements with the same key are removed if you add a new one. A map shows the same behavior using the [] operator, but the insert method of a map refuses the insertion if an element with that key already exists, so the first added element remains in the container. Note: inserting values in large sets or maps can get very slow because it's the most expensive operation on those containers. T.M. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org https://lists.gnu.org/mailman/listinfo/help-gplusplus