1 #ifndef C4_YML_STD_VECTOR_HPP_
2 #define C4_YML_STD_VECTOR_HPP_
11 C4_SUPPRESS_WARNING_GCC_WITH_PUSH(
"-Wuseless-cast")
18 template<class T, class Alloc>
22 for(T
const& val : vec)
23 tree->set_serialized(tree->append_child(
id), val);
27 template<
class T,
class Alloc>
38 for(T
const& val : vec)
51 template<
class T,
class Alloc>
54 if C4_UNLIKELY(!tree->
is_seq(
id))
57 #if C4_CPP < 17 // prior to C++17, emplace_back() does not return a reference
63 T &val = vec->emplace_back();
66 T &val = (*vec)[pos++];
78 template<
class T,
class Alloc>
88 if C4_UNLIKELY(!node.
is_seq())
91 #if C4_CPP < 17 // prior to C++17, emplace_back() does not return a reference
97 T &val = vec->emplace_back();
100 T &val = (*vec)[pos++];
105 if(!child.deserialize(&val))
118 template<
class Alloc>
121 if C4_UNLIKELY(!tree->
is_seq(
id))
135 template<
class Alloc>
144 C4_SUPPRESS_WARNING_GCC_POP
149 #endif // C4_YML_STD_VECTOR_HPP_
csubstr const & val(id_type node) const
id_type first_child(id_type node) const
A lightweight truthy type, used to enable reporting the offending node when a deserializing error hap...
bool is_seq() const RYML_NOEXCEPT
Forward to Tree::is_seq().
id_type id() const noexcept
bool from_chars(csubstr buf, uint8_t *v) noexcept
A reference to a node in an existing yaml tree, offering a more convenient API than the index-based A...
RYML_ID_TYPE id_type
The type of a node id in the YAML tree; to override the default type, define the macro RYML_ID_TYPE t...
void write(NodeRef *n, T const &v)
bool is_seq(id_type node) const
ReadResult deserialize(id_type node, T *v) const
(1) deserialize a node's contents to a variable
Holds a pointer to an existing tree, and a node id.
Tree const * tree() const noexcept
id_type next_sibling(id_type node) const
const_children_view children() const RYML_NOEXCEPT
get an iterable view over children
ReadResult read(ConstNodeRef const &n, T *v)