Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2024. The current version is 1.90.0.
Return engaged result
if the value is null.
boost::system::result<std::nullptr_t> try_as_null() const noexcept;
If is_null() is true,
the result is engaged, otherwise it contains an error_code.
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();
Constant.
No-throw guarantee.