Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
value::try_as_array (1 of 2 overloads)

Return result with a reference to the underlying array.

Synopsis
boost::system::result< array & >
try_as_array() noexcept;
Description

If is_array() is true, the result contains a reference to the underlying array, otherwise it contains an error_code.

Example

The return value can be used in both a boolean context and to assign a variable:

if( auto r = jv.try_as_array() )
    return *r;

But can also be used to throw an exception on error:

return jv.try_as_array().value();
Complexity

Constant.

Exception Safety

No-throw guarantee.


PrevUpHomeNext