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 the documentation for a snapshot of the master branch, built from commit a2b80500d6.
PrevUpHomeNext
value::try_as_double (1 of 2 overloads)

Return result with a reference to the underlying double

Synopsis
boost::system::result< double & >
try_as_double() noexcept;
Description

If is_double() is true, the result contains a reference to the underlying double, 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_double() )
    return *r;

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

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

Constant.

Exception Safety

No-throw guarantee.


PrevUpHomeNext