File: mapoperators.yo

package info (click to toggle)
c%2B%2B-annotations 10.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,536 kB
  • ctags: 3,247
  • sloc: cpp: 19,157; makefile: 1,521; ansic: 165; sh: 128; perl: 90
file content (18 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
    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();
        )