get a pointer value (explicit)

Synopsis

Declared in <nlohmann/json.hpp>

template<typename PointerType>
requires std::is_pointer<PointerType>::value
decltype(std::declval<basic_json_t&>().template get_ptr<PointerType>())
get() noexcept;

Description

Explicit pointer access to the internally stored JSON value. No copies are made.

Warning
The pointer becomes invalid if the underlying JSON object changes.

Constant.

{The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr is returned if the value and the requested pointer type does not match.,get_PointerType}

Return Value

pointer to the internally stored JSON value if the requested pointer type PointerType fits to the JSON value; nullptr otherwise

Template Parameters

Name

Description

PointerType

pointer type; must be a pointer to array_t, object_t, string_t, boolean_t, number_integer_t, number_unsigned_t, or number_float_t.

Created with MrDocs