#include "fson/Array.hh"
Element
One array slot with its trivia. Move-only; clone() to copy.
| Member | Behaviour |
|---|---|
Element(std::unique_ptr<Value>) | throws std::invalid_argument on null |
getValue() → Value& / setValue(std::unique_ptr<Value>) | the payload |
getLeadingComments() → CommentList& | comments on their own lines before the element |
getTrailingComment() → std::optional<Comment>& | end-of-line comment after the element |
Array
An ordered element sequence. Index errors throw std::out_of_range.
| Member | Behaviour |
|---|---|
size() → std::size_t / empty() → bool | element count |
at(index) → Value& | value at index |
getElement(index) → Element& | the element, for trivia access |
append(value) → Value& / insert(index, value) → Value& | return the stored value |
erase(index) / clear() | removal |
getDanglingComments() → CommentList& | comments before ] |
ports: [
80, // http
443, // https
]
Array& ports = *doc.getRootObject()->find( "ports" )->asArray();
ports.getElement( 0 ).getTrailingComment(); // "http"
ports.append( std::make_unique<Number>( 8080LL ) );
setPath on a path never creates or grows an array — build arrays through this API.

