get a (pointer) value (explicit)

Synopsis

Declared in <nlohmann/json.hpp>

template<
    typename ValueTypeCV,
    typename ValueType = /* implementation-defined */::uncvref_t<ValueTypeCV>>
constexpr
decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))
get() const noexcept(/* see-below */);

Description

Performs explicit type conversion between the JSON value and a compatible value if required.

  • If the requested type is a pointer to the internally stored JSON value that pointer is returned. No copies are made.

  • If the requested type is the current basic_json, or a different basic_json convertible from the current basic_json.

  • Otherwise the value is converted by calling the json_serializer<ValueType> from_json() method.

Note

Throws whatever json_serializer<ValueType> from_json() method throws if conversion is required

Exception specification

This function is potentially-throwing unless noexcept(std::declval<const basic_json_t &>().template get_impl<ValueType>(detail::priority_tag<4>{})).

Return Value

copy of the JSON value, converted to

Template Parameters

Name

Description

ValueTypeCV

the provided value type

ValueType

the returned value type

ValueType

if necessary

Created with MrDocs