35 lines
805 B
Plaintext
35 lines
805 B
Plaintext
:sig
|
|
bool DValue::is_array() const
|
|
|
|
:params
|
|
return value : true when the node is map-shaped
|
|
|
|
:see
|
|
>types
|
|
0_DValue
|
|
is_list
|
|
has
|
|
each
|
|
|
|
:content
|
|
Tests whether a `DValue` node is map-shaped, i.e. holds nested child values rather than a scalar. This is a read accessor: it is `const`, never creates or modifies nodes, and dereferences internal references automatically.
|
|
|
|
`is_array()` is true for both list-like and keyed containers; use `is_list()` to distinguish the two:
|
|
|
|
```cpp
|
|
DValue rows = sqlite_query(db, "select * from notes");
|
|
if(rows.is_array())
|
|
{
|
|
rows.each([&](const DValue& row, String key) {
|
|
// ...
|
|
});
|
|
}
|
|
```
|
|
|
|
Scalar values (strings, numbers, booleans, pointers) return `false`, as do unresolvable references.
|
|
|
|
## Related Concepts
|
|
|
|
- PHP: `is_array()`
|
|
- JavaScript: `typeof value === "object"`
|