Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

value_to

Convert a value to an object of type T.

Synopsis

Defined in header <boost/json/value_to.hpp>

template<
    class T>
T
value_to(
    const value& jv);
Description

This function attempts to convert a value to T using

In all cases, the conversion is done by calling an overload of tag_invoke found by argument-dependent lookup. Its signature should be similar to:

T tag_invoke( value_to_tag<T>, value );

The object returned by the function call is returned by value_to as the result of the conversion.

Constraints
! std::is_reference< T >::value
Exception Safety

Strong guarantee.

Template Parameters

Type

Description

T

The type to convert to.

Return Value

jv converted to T.

Parameters

Name

Description

jv

The value to convert.

See Also

value_to_tag, value_from, tag_invoke: A general pattern for supporting customisable functions

Convenience header <boost/json.hpp>


PrevUpHomeNext