object::at
Access the specified element, with bounds checking.
Synopsis
value&
at(
string_view key,
boost::source_location const& loc = BOOST_CURRENT_LOCATION) &; (1)
value&&
at(
string_view key,
boost::source_location const& loc = BOOST_CURRENT_LOCATION) &&; (2)
value const&
at(
string_view key,
boost::source_location const& loc = BOOST_CURRENT_LOCATION) const&; (3)
Description
Returns a reference to the mapped value of the element that matches key, otherwise throws.
Complexity
Constant on average, worst case linear in size().
Exception Safety
Strong guarantee.
Return Value
A reference to the mapped value.
Parameters
| Name | Description |
|---|---|
|
The key of the element to find. |
|
|
Exceptions
| Type | Thrown On |
|---|---|
|
if no such element exists. |
|
if no such element exists. |
|
if no such element exists. |
See Also
xref:ref_object_operator_lb_rb[``operator[``\]], try_at.