1#ifndef SIMDJSON_GENERIC_ONDEMAND_ARRAY_H
3#ifndef SIMDJSON_CONDITIONAL_INCLUDE
4#define SIMDJSON_GENERIC_ONDEMAND_ARRAY_H
5#include "simdjson/generic/ondemand/base.h"
6#include "simdjson/generic/implementation_simdjson_result_base.h"
7#include "simdjson/generic/ondemand/value_iterator.h"
11namespace SIMDJSON_IMPLEMENTATION {
24 simdjson_inline
array() noexcept = default;
135#if SIMDJSON_SUPPORTS_CONCEPTS
143 template <
typename T>
144 simdjson_warn_unused simdjson_inline
error_code get(T &out)
145 noexcept(custom_deserializable<T, array> ? nothrow_custom_deserializable<T, array> :
true) {
146 static_assert(custom_deserializable<T, array>);
147 return deserialize(*
this, out);
155 template <
typename T>
157 noexcept(custom_deserializable<T,
value> ? nothrow_custom_deserializable<T,
value> : true)
159 static_assert(std::is_default_constructible<T>::value,
"The specified type is not default constructible.");
161 SIMDJSON_TRY(get<T>(out));
205 simdjson_inline
array(const value_iterator &
iter) noexcept;
243#if SIMDJSON_SUPPORTS_CONCEPTS
249 if constexpr (std::is_same_v<T, SIMDJSON_IMPLEMENTATION::ondemand::array>) {
252 return first.get<T>();
255 simdjson_warn_unused simdjson_inline
error_code get(T& out)
noexcept {
257 if constexpr (std::is_same_v<T, SIMDJSON_IMPLEMENTATION::ondemand::array>) {
260 SIMDJSON_TRY( first.get<T>(out) );
A forward-only JSON array.
A forward-only JSON array.
simdjson_inline simdjson_result< value > at(size_t index) noexcept
Get the value at the given index.
value_iterator iter
Iterator marking current position.
simdjson_inline simdjson_result< bool > is_empty() &noexcept
This method scans the beginning of the array and checks whether the array is empty.
simdjson_result< value > at_pointer(std::string_view json_pointer) noexcept
Get the value associated with the given JSON pointer.
static simdjson_inline simdjson_result< array > start(value_iterator &iter) noexcept
Begin array iteration.
simdjson_inline simdjson_result< array_iterator > begin() noexcept
Begin array iteration.
simdjson_inline array() noexcept=default
Create a new invalid array.
simdjson_inline simdjson_result< size_t > count_elements() &noexcept
This method scans the array and counts the number of elements.
simdjson_result< value > at_path(std::string_view json_path) noexcept
Get the value associated with the given JSONPath expression.
static simdjson_inline simdjson_result< array > start_root(value_iterator &iter) noexcept
Begin array iteration from the root.
static simdjson_inline simdjson_result< array > started(value_iterator &iter) noexcept
Begin array iteration.
simdjson_warn_unused simdjson_inline error_code consume() noexcept
Go to the end of the array, no matter where you are right now.
simdjson_inline simdjson_result< std::string_view > raw_json() noexcept
Consumes the array and returns a string_view instance corresponding to the array as represented in JS...
simdjson_inline simdjson_result< array_iterator > end() noexcept
Sentinel representing the end of the array.
simdjson_result< bool > reset() &noexcept
Reset the iterator so that we are pointing back at the beginning of the array.
An ephemeral JSON value returned during iteration.
The top level simdjson namespace, containing everything the library provides.
error_code
All possible errors returned by simdjson.
The result of a simdjson operation that could fail.
The result of a simdjson operation that could fail.
simdjson_inline error_code error() const noexcept
The error.
simdjson_warn_unused simdjson_inline error_code get(T &value) &&noexcept
Move the value to the provided variable.