Return a modifiable reference to the mapped value for key.

Synopsis

Declared in <bslstl_map.h>

add_lvalue_reference<VALUE>::type
operator[](key_type const& key);

Description

Return a modifiable reference to the mapped‐value for key.

Return a reference providing modifiable access to the mapped‐value associated with the specified key; if this map does not already contain a value_type object having an equivalent key, first insert a new value_type object having key and a default‐constructed VALUE object, and return a reference to the newly mapped (default) value. This method requires that the (template parameter) type KEY be copy‐insertable into this map and the (template parameter) type VALUE be default‐insertable into this map (see {Requirements on KEY and VALUE}).

Return Value

modifiable reference to the mapped value

Parameters

Name

Description

key

key whose mapped value is accessed or inserted

Created with MrDocs