]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/mkdocs/docs/api/basic_json/array_t.md
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / nlohmann-json / doc / mkdocs / docs / api / basic_json / array_t.md
CommitLineData
1e59de90
TL
1# <small>nlohmann::basic_json::</small>array_t
2
3```cpp
4using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
5```
6
7The type used to store JSON arrays.
8
9[RFC 8259](https://tools.ietf.org/html/rfc8259) describes JSON arrays as follows:
10> An array is an ordered sequence of zero or more values.
11
12To store objects in C++, a type is defined by the template parameters explained below.
13
14## Template parameters
15
16`ArrayType`
17: container type to store arrays (e.g., `std::vector` or `std::list`)
18
19`AllocatorType`
20: the allocator to use for objects (e.g., `std::allocator`)
21
22## Notes
23
24#### Default type
25
26With the default values for `ArrayType` (`std::vector`) and `AllocatorType` (`std::allocator`), the default value for
27`array_t` is:
28
29```cpp
30std::vector<
31 basic_json, // value_type
32 std::allocator<basic_json> // allocator_type
33>
34```
35
36#### Limits
37
38[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies:
39> An implementation may set limits on the maximum depth of nesting.
40
41In this class, the array's limit of nesting is not explicitly constrained. However, a maximum depth of nesting may be
42introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the
43[`max_size`](max_size.md) function of a JSON array.
44
45#### Storage
46
47Arrays are stored as pointers in a `basic_json` type. That is, for any access to array values, a pointer of type
48`#!cpp array_t*` must be dereferenced.
49
50## Examples
51
52??? example
53
54 The following code shows that `array_t` is by default, a typedef to `#!cpp std::vector<nlohmann::json>`.
55
56 ```cpp
57 --8<-- "examples/array_t.cpp"
58 ```
59
60 Output:
61
62 ```json
63 --8<-- "examples/array_t.output"
64 ```
65
66## Version history
67
68- Added in version 1.0.0.