value::if_string

## `value::if_string`

Return a pointer to the underlying `string`.

### Synopsis

    string const*
    if_string() const noexcept; (1)

    string*
    if_string() noexcept; (2)

### Description

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

### Example

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

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

### Complexity

Constant.

### Exception Safety

No-throw guarantee.

Edit this page