value::if_array

## `value::if_array`

Return a pointer to the underlying `array`.

### Synopsis

    array const*
    if_array() const noexcept; (1)

    array*
    if_array() noexcept; (2)

### Description

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

### Example

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

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

### Complexity

Constant.

### Exception Safety

No-throw guarantee.

Edit this page