Windows Dev Center

The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

concurrent_unordered_map::operator[] Operator

Finds or inserts an element with the specified key. This method is concurrency-safe.

mapped_type& operator[](
   const key_type& _Keyval

mapped_type& operator[](
   key_type && _Keyval


The key value to

find or insert.

A reference to the data value of the found or inserted element.

If the argument key value is not found, then it is inserted along with the default value of the data type.

operator[] may be used to insert elements into a map m using m[_Key] = DataValue;, where DataValue is the value of the mapped_type of the element with a key value of _Key.

When using operator[] to insert elements, the returned reference does not indicate whether an insertion is changing a pre-existing element or creating a new one. The member functions find and insert can be used to determine whether an element with a specified key is already present before an insertion.

Header: concurrent_unordered_map.h

Namespace: concurrency

© 2015 Microsoft