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 develop branch, built from commit f8e2c77510.
PrevUpHomeNext
value::if_string (1 of 2 overloads)

Return a string pointer if this is a string, else return nullptr

Synopsis
string const*
if_string() const noexcept;
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.


PrevUpHomeNext