cppannotations/annotations/yo/containers/mapoperators.yo
Frank B. Brokken 777b182edd Moved all files but 'excluded', 'sf', and 'sourcetar' to ./annotations
This allowed me to standardize the sourcetar and sf/* scripts: the base
    directory (containing ./git) is now empty, except for maintenance scripts,
    while the source files and build scripts of the annotations are stored in
    a subdirectory of their own.
2013-05-29 20:44:08 +02:00

18 lines
877 B
Text

The map supports, in addition to the standard operators for containers,
the i(index operator).
The index operator may be used to retrieve or reassign individual elements of
the map. The argument of the index operator is called a em(key).
If the provided key is not available in the tt(map), a new data element is
automatically added to the tt(map) using the default value or default
constructor to initialize the value part of the new element. This default
value is returned if the index operator is used as an rvalue.
When initializing a new or reassigning another element of the map, the type of
the right-hand side of the assignment operator must be equal to (or promotable
to) the type of the map's value part. E.g., to add or change the value of
element tt("two") in a map, the following statement can be used:
verb(
mapsm["two"] = MyClass();
)