cheatah
Class

parsers::json::String

A decoded (un-escaped) JSON string token, storing its characters either owned (String<std::string>) or as a zero-copy view (String<std::string_view>), chosen by the storage type S via the deduction guides below.

Template parameters
S

the backing storage: std::string (owning) or std::string_view (viewing).

Functions

fn String(S value) source#

Construct from the backing storage.

Owning S=std::string moves the rvalue in; viewing S=std::string_view just stores the (cheap) view — the characters are never copied here.

Parameters
value

the string storage (moved in).

Complexity

O(1) — a std::string move or a std::string_view copy; characters are never copied.

Allocation

none.

fn ~String()=default source#
fn std::string_view value() const noexcept source#

Read the characters uniformly as a view, whether owning or viewing (no setter).

Returns

a std::string_view over the stored characters.

Complexity

O(1).

Allocation

none.

Constants & variables

var S value_ source#