flâneur — a map of the web's best reading

unordered_map::operator[] - C++ Reference

cplusplus.com · 808 words · saved by 1 readers

Search: Reference unordered_map operator[] Not logged in register log in public member function std::unordered_map::operator[] mapped_type& operator[] ( const key_type& k ); mapped_type& operator[] ( key_type&& k ); Access element If k matches the key of an element in the container, the function returns a reference to its mapped value. If k does not match the key of any element in the container, the function inserts a new element with that key and returns a reference to its mapped value. Notice that this always increases the container size by one, even if no mapped value is assigned to the element (the element is constructed using its default constructor). A similar member function, unordered_map::at, has the same behavior when an element with the key exists, but throws an exception when it does not. Parameters k Key value of the element whose mapped value is accessed. Member type key_type is the type of the keys for the elements stored in the con

TUTORIALS REFERENCE ARTICLES FORUM C++ Tutorials Reference Articles Forum Reference C library: <cassert> (assert.h) <cctype> (ctype.h) <cerrno> (errno.h) C++11 <cfenv> (fenv.h) <cfloat> (float.h) C++11 <cinttypes> (inttypes.h) <ciso646> (iso646.h) <climits> (limits.h) <clocale> (locale.h) <cmath> (math.h) <csetjmp> (setjmp.h) <csignal> (signal.h) <cstdarg> (stdarg.h) C++11 <cstdbool> (stdbool.h) <cstddef> (stddef.h) C++11 <cstdint> (stdint.h) <cstdio> (stdio.h) <cstdlib> (stdlib.h) <cstring> (string.h) C++11 <ctgmath> (tgmath.h) <ctime> (time.h) C++11 <cuchar> (uchar.h) <cwchar> (wchar.h) <cwc

Explore this link on the map →

related reading