value::as_string

Return a reference to the underlying string, or throw an exception.

Synopsis

string&&
as_string(
    boost::source_location const& loc = BOOST_CURRENT_LOCATION) &&; (1)

string const&
as_string(
    boost::source_location const& loc = BOOST_CURRENT_LOCATION) const&; (2)

string&
as_string(
    boost::source_location const& loc = BOOST_CURRENT_LOCATION) &; (3)

Description

If is_string() is true, returns a reference to the underlying string, otherwise throws an exception.

Exception Safety

Strong guarantee.

Parameters

Name Description

loc

source_location to use in thrown exception; the source location of the call site by default.

Exceptions

Type Thrown On

boost::system::system_error

! this->is_string().

Complexity

Constant.