Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext
value::try_set_at_pointer

Set an element via JSON Pointer.

Synopsis
boost::system::result< value & >
try_set_at_pointer(
    string_view sv,
    value_ref ref,
    set_pointer_options const& opts = {});
Description

This function is used to insert or assign to a potentially nested element of the value using a JSON Pointer string. The function may create intermediate elements corresponding to pointer segments.

The particular conditions when and what kind of intermediate element is created is governed by the ptr parameter.

Each pointer token is considered in sequence. For each token

Complexity

Linear in the sum of size of ptr, size of underlying array, object, or string and opts.max_created_elements.

Exception Safety

Basic guarantee. Calls to memory_resource::allocate may throw.

Parameters

Name

Description

sv

JSON Pointer string.

ref

The value to assign to pointed element.

opts

The options for the algorithm.

Return Value

boost::json::result<value&> containing either a reference to the element identified by ptr or a corresponding error_code.

See Also

set_pointer_options, RFC 6901 - JavaScript Object Notation (JSON) Pointer.


PrevUpHomeNext