![]() |
Home | Libraries | People | FAQ | More |
Convert a value
to an object of type T.
Defined in header <boost/json/value_to.hpp>
template< class T> T value_to( const value& jv);
This function attempts to convert a value to T
using
value's
accessors, or
tag_invoke.
Out of the box the function supports types satisfying SequenceContainer,
arrays, arithmetic types, bool,
std::tuple, std::pair,
std::variant, std::optional,
std::monostate, and std::nullopt_t.
Conversion of other types 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.
! std::is_reference< T >::value
Strong guarantee.
|
Type |
Description |
|---|---|
|
|
The type to convert to. |
jv converted to T.
|
Name |
Description |
|---|---|
|
|
The |
value_to_tag,
value_from,
tag_invoke:
A general pattern for supporting customisable functions
Convenience header <boost/json.hpp>