Element access¶
at¶
value_type& at( const key_type& key ); const value_type& at( const key_type& key ) const;Returns: a reference to
item.secondwhereitemis the element with the key equal tokey.Throws:
std::out_of_rangeexception if the element with the key equal tokeyis not presented in the container.
operator[]¶
value_type& operator[]( const key_type& key );If the element with the key equal to
keyis not presented in the container, inserts a new element, constructed in-place fromstd::piecewise_construct, std::forward_as_tuple(key), std::tuple<>().Requirements: the type
value_typeshall meet theEmplaceConstructiblerequirements from [container.requirements] ISO C++ section.Returns: a reference to
item.secondwhereitemis the element with the key equal tokey.
value_type& operator[]( key_type&& key );If the element with the key equal to
keyis not presented in the container, inserts a new element, constructed in-place fromstd::piecewise_construct, std::forward_as_tuple(std::move(key)), std::tuple<>().Requirements: the type
value_typeshall meet theEmplaceConstructiblerequirements from [container.requirements] ISO C++ section.Returns: a reference to
item.secondwhereitemis the element with the key equal tokey.