string::try_at
Return a character with bounds checking.
Synopsis
boost::system::result< char & >
try_at(
std::size_t pos) noexcept; (1)
boost::system::result< char const & >
try_at(
std::size_t pos) const noexcept; (2)
Description
Returns boost::system::result containing a reference to the character specified at location pos, if pos is within the range of the string. Otherwise the result contains an error_code.
Exception Safety
Strong guarantee.
Parameters
| Name | Description |
|---|---|
|
A zero-based index to access. |
Complexity
Constant.