다음을 통해 공유


CMap::operator

A convenient substitute for the SetAt member function.

VALUE& operator[]( 
   ARG_KEY key  
);

Parameters

  • VALUE
    Template parameter specifying the type of the map value.

  • ARG_KEY
    Template parameter specifying the type of the key value.

  • key
    The key used to retrieve the value from the map.

Remarks

Thus it can be used only on the left side of an assignment statement (an l-value). If there is no map element with the specified key, then a new element is created.

There is no "right side" (r-value) equivalent to this operator because there is a possibility that a key may not be found in the map. Use the Lookup member function for element retrieval.

Example

See the example for CMap::Lookup.

Requirements

Header: afxtempl.h

See Also

Reference

CMap Class

Hierarchy Chart

CMap::SetAt

CMap::Lookup