value::try_at
Access an element, with bounds checking.
Synopsis
boost::system::result< value & >
try_at(
string_view key) noexcept; (1)
boost::system::result< value const & >
try_at(
string_view key) const noexcept; (2)
boost::system::result< value & >
try_at(
std::size_t pos) noexcept; (3)
boost::system::result< value const & >
try_at(
std::size_t pos) const noexcept; (4)
Description
Returns boost::system::result
containing a reference to the element of the underlying object, if pos
is within its range. If pos
is outside of that range, or the underlying value is not an object the result contains an error_code
.
Exception Safety
No-throw guarantee.
Parameters
Name | Description |
---|---|
|
The key of the element to find. |
|
A zero-based array index. |
Complexity
Constant.