visit
Invoke a function object with the contents of a value.
Synopsis
Defined in header <boost/json/visit.hpp>.
template<
class Visitor>
decltype(static_cast< Visitor && >(v)(std::declval< std::nullptr_t & >()))
visit(
Visitor&& v,
value& jv); (1)
template<
class Visitor>
decltype(static_cast< Visitor && >(v)(std::declval< std::nullptr_t const & >()))
visit(
Visitor&& v,
value const& jv); (2)
template<
class Visitor>
decltype(static_cast< Visitor && >(v)(std::declval< std::nullptr_t && >()))
visit(
Visitor&& v,
value&& jv); (3)
Description
Invokes v as if by std::forward<Visitor>(v)( X ), where X is
For overloads (1) and (2):
-
jv.get_array()ifjv.is_array(), or -
jv.get_object()ifjv.is_object(), or -
jv.get_string()ifjv.is_string(), or -
jv.get_int64()ifjv.is_int64(), or -
jv.get_uint64()ifjv.is_uint64(), or -
jv.get_double()ifjv.is_double(), or -
jv.get_bool()ifjv.is_bool(), or -
a
const(2) or mutable (1) reference to an object of typestd::nullptr_tifjv.is_null().
For overload (3):
-
std::move( jv.get_array() )ifjv.is_array(), or -
std::move( jv.get_object() )ifjv.is_object(), or -
std::move( jv.get_string() )ifjv.is_string(), or -
std::move( jv.get_int64() )ifjv.is_int64(), or -
std::move( jv.get_uint64() )ifjv.is_uint64(), or -
std::move( jv.get_double() )ifjv.is_double(), or -
std::move( jv.get_bool() )ifjv.is_bool(), or -
std::nullptr_t()ifjv.is_null().
Return Value
The value returned by v.
Parameters
| Name | Description |
|---|---|
|
The visitation function to invoke |
|
The value to visit. |
Convenience header <boost/json.hpp>