Element access
Contents
Element access#
at#
value_type& at( const key_type& key ); const value_type& at( const key_type& key ) const;Returns: a reference to
item.second
, whereitem
is the element with the key equivalent tokey
.Throws:
std::out_of_range
exception if the element with the key equivalent tokey
is not present in the container.
operator[]#
value_type& operator[]( const key_type& key );If the element with the key equivalent to
key
is not present in the container, inserts a new element constructed in-place fromstd::piecewise_construct, std::forward_as_tuple(key), std::tuple<>()
.Requirements: the type
value_type
must meet theEmplaceConstructible
requirements from the [container.requirements] ISO C++ section.Returns: a reference to
item.second
, whereitem
is the element with the key equivalent tokey
.
value_type& operator[]( key_type&& key );If the element with the key equivalent to
key
is not present 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_type
must meet theEmplaceConstructible
requirements from the [container.requirements] ISO C++ section.Returns: a reference to
item.second
, whereitem
is the element with the key equivalent tokey
.