cheatah
Class

parsers::json::Node

The dynamic JSON value: a thin class wrapping a std::variant over the token types (Null, Boolean, Number, owning/viewing String, Array, Object).

There is no runtime polymorphism — dispatch is compile-time std::visit over variant(); the class exists to be forward-declarable so Array/Object can be templated on their storage type.

Functions

fn Node · 2 overloads
Node()=defaultsource#
Node(T &&value)source#

Construct from any one of the token alternatives (e.g.

Number{3.5}); excludes Node itself so the copy/move constructors are not hidden.

Template parameters
T

one of the variant alternative types.

Parameters
value

the token value to store (forwarded into the variant).

Complexity

O(1) — one move/copy of the token into the variant.

Allocation

none of its own (whatever the moved-in token owns comes along).

fn variant · 2 overloads
variant_type & variant() noexceptsource#
const variant_type & variant() const noexceptsource#

The underlying variant, for dispatch with std::visit / std::get / std::get_if / emplace.

Returns

a mutable reference to the wrapped variant.

Complexity

O(1).

Allocation

none.

Constants & variables

var variant_type data_ source#

Types

type std::variant< Null, Boolean, Number, String< std::string_view >, String< std::string >, ArrayView, OwnedArray, ObjectView, OwnedObject > variant_type source#

The set of JSON value alternatives this Node may hold (null is the first, default state).