11.3.4. Subscripting a map
The map
and unordered_map
containers provide the subscript operator and a corresponding at
function (§ 9.3.2, p. 348), which are described in Table 11.6 (overleaf). The set
types do not support subscripting because there is no “value” associated with a key in a set
. The elements are themselves keys, so the operation of “fetching the value associated with a key” is meaningless. We cannot subscript a multimap
or an unordered_multimap
because there may be more than one value associated with a given key.
Like the other subscript operators we’ve used, the map
subscript ...
Get C++ Primer, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.