cheatah
Class

parsers::json::Array

A JSON array token, templated on its backing storage S: Array<std::vector<Node>> (OwnedArray) owns its elements, Array<std::span<const Node>> (ArrayView) views elements stored elsewhere with no copy.

Move-only; both backings read uniformly via value().

Template parameters
S

the element storage: std::vector<Node> (owning) or std::span<const Node> (viewing).

Functions

fn Array · 3 overloads
Array(S value)source#
Array(const Array &)=deletesource#
Array(Array &&other) noexcept=defaultsource#

Construct from the backing storage (moved in).

Parameters
value

the element storage (an owning vector or a non-owning span).

Complexity

O(1) — a vector move or a span copy; the elements are never copied.

Allocation

none.

fn ~Array()=default source#
fn operator= · 2 overloads
Array & operator=(const Array &)=deletesource#
Array & operator=(Array &&other) noexcept=defaultsource#

Move-assign, taking over the other array's storage.

Parameters
other

the array to move from.

Returns

reference to this array.

fn std::span< const Node > value() const noexcept source#

Read the elements uniformly as a view, whether owned or viewed (no setter).

Returns

a std::span<const Node> over the array's elements.

Complexity

O(1).

Allocation

none.

Constants & variables

var S value_ source#