Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
value::try_as_int64 (2 of 2 overloads)

Return result with the underlying std::int64_t

Synopsis
boost::system::result< std::int64_t >
try_as_int64() const noexcept;
Description

If is_int64() is true, the result contains a copy of the underlying std::int64_t, 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_int64() )
    return *r;

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

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

Constant.

Exception Safety

No-throw guarantee.


PrevUpHomeNext