C++ Language/Std/Stl/CollectionClasses/SortedCollections/Map/InsertingItems

From Wikibooks, open books for an open world
Jump to navigation Jump to search

The distinction between a map's insert() and emplace functions is the same as it was for vectors. With a map, you could also use C-array-indexing syntax, which will insert a new item if the map didn't already contain one with that key.

Additional information about inserting items into a map (includes interactive examples)