Function get_array_element

Synopsis

#include <include/sajson.h>

value get_array_element(size_t index) const

Description

Returns the nth element of an array. Calling with an out-of-bound index is undefined behavior. Only legal if get_type() is TYPE_ARRAY.

Mentioned in

Source

Lines 514-522 in include/sajson.h.

value get_array_element(size_t index) const {
    using namespace internal;
    assert_tag(tag::array);
    size_t element = payload[1 + index];
    return value(
        get_element_tag(element),
        payload + get_element_value(element),
        text);
}





Add Discussion as Guest

Log in