value::try_as_null
Return engaged result
if the value
is null.
Synopsis
boost::system::result< std::nullptr_t >
try_as_null() const noexcept;
Description
If is_null()
is true
, the result is engaged, 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_null() )
return *r;
But can also be used to throw an exception on error:
return jv.try_as_null().value();
Complexity
Constant.
Exception Safety
No-throw guarantee.