array::try_at

Access an element, with bounds checking.

Synopsis

boost::system::result< value & >
try_at(
    std::size_t pos) noexcept; (1)

boost::system::result< value const & >
try_at(
    std::size_t pos) const noexcept; (2)

Description

Returns boost::system::result containing a reference to the element specified at location pos, if pos is within the range of the container. Otherwise the result contains an error_code.

Exception Safety

No-throw guarantee.

Parameters

Name Description

pos

A zero-based index.

Complexity

Constant.