serializer::read

Read the next buffer of serialized JSON.

Synopsis

string_view
read(
    char* dest,
    std::size_t size); (1)

template<
    std::size_t N>
string_view
read(
    char (&dest) [N]); (2)

Description

This function attempts to fill the caller provided buffer starting at dest with up to size characters of the serialized JSON that represents the value. If the buffer is not large enough, multiple calls may be required.

If serialization completes during this call; that is, that all of the characters belonging to the serialized value have been written to caller-provided buffers, the function done will return true.

Preconditions

this->done() == false

Complexity

Linear in size.

Exception Safety

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

Return Value

A string_view containing the characters written, which may be less than size.

Return Value

A string_view containing the characters written, which may be less than size.

Parameters

Name Description

dest

A pointer to valid memory of at least size bytes.

size

The maximum number of characters to write to the memory pointed to by dest.