value::if_double

## `value::if_double`

Return a pointer to the underlying `double`.

### Synopsis

    double const*
    if_double() const noexcept; (1)

    double*
    if_double() noexcept; (2)

### Description

If `this->kind() == kind::double_`, returns a pointer to the underlying double. Otherwise, returns `nullptr`.

### Example

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

    if( auto p = jv.if_double() )
        return *p;

### Complexity

Constant.

### Exception Safety

No-throw guarantee.

Edit this page