]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/mkdocs/docs/api/basic_json/max_size.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 / max_size.md
1 # <small>nlohmann::basic_json::</small>max_size
2
3 ```cpp
4 size_type max_size() const noexcept;
5 ```
6
7 Returns the maximum number of elements a JSON value is able to hold due to system or library implementation limitations,
8 i.e. `std::distance(begin(), end())` for the JSON value.
9
10 ## Return value
11
12 The return value depends on the different types and is defined as follows:
13
14 | Value type | return value |
15 |------------|-------------------------------------------|
16 | null | `0` (same as [`size()`](size.md)) |
17 | boolean | `1` (same as [`size()`](size.md)) |
18 | string | `1` (same as [`size()`](size.md)) |
19 | number | `1` (same as [`size()`](size.md)) |
20 | binary | `1` (same as [`size()`](size.md)) |
21 | object | result of function `object_t::max_size()` |
22 | array | result of function `array_t::max_size()` |
23
24 ## Exception safety
25
26 No-throw guarantee: this function never throws exceptions.
27
28 ## Complexity
29
30 Constant, as long as [`array_t`](array_t.md) and [`object_t`](object_t.md) satisfy the
31 [Container](https://en.cppreference.com/w/cpp/named_req/Container) concept; that is, their `max_size()` functions have
32 constant complexity.
33
34 ## Notes
35
36 This function does not return the maximal length of a string stored as JSON value -- it returns the maximal number of
37 string elements the JSON value can store which is `1`.
38
39 ## Examples
40
41 ??? example
42
43 The following code calls `max_size()` on the different value types. Note the output is implementation specific.
44
45 ```cpp
46 --8<-- "examples/max_size.cpp"
47 ```
48
49 Output:
50
51 ```json
52 --8<-- "examples/max_size.output"
53 ```
54
55 ## Version history
56
57 - Added in version 1.0.0.
58 - Extended to return `1` for binary types in version 3.8.0.