uce/site/doc/pages/2_DValue_is_list.txt
2026-06-15 21:42:50 +00:00

20 lines
558 B
Plaintext

:sig
bool DValue::is_list() const
:params
return value : true when the value is an array with keys 0..n-1
:see
0_DValue
2_DValue_set_array
2_DValue_push
:content
Returns true for map-shaped values that represent a list. An empty map is a list only if it was explicitly put in list mode with `set_array()` or by list operations. Non-empty lists must have canonical numeric string keys from `0` through `size - 1`.
```cpp
DValue first; first = "first";
DValue items; items.set_array(); items.push(first);
if(items.is_list()) print(json_encode(items));
```