]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/mkdocs/docs/api/basic_json/get_ref.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 / get_ref.md
1 # <small>nlohmann::basic_json::</small>get_ref
2
3 ```cpp
4 template<typename ReferenceType>
5 ReferenceType get_ref();
6
7 template<typename ReferenceType>
8 const ReferenceType get_ref() const;
9 ```
10
11 Implicit reference access to the internally stored JSON value. No copies are made.
12
13 ## Template parameters
14
15 `ReferenceType`
16 : reference type; must be a reference to [`array_t`](array_t.md), [`object_t`](object_t.md),
17 [`string_t`](string_t.md), [`boolean_t`](boolean_t.md), [`number_integer_t`](number_integer_t.md), or
18 [`number_unsigned_t`](number_unsigned_t.md), [`number_float_t`](number_float_t.md), or [`binary_t`](binary_t.md).
19 Enforced by static assertion.
20
21 ## Return value
22
23 reference to the internally stored JSON value if the requested reference type fits to the JSON value; throws
24 [`type_error.303`](../../home/exceptions.md#jsonexceptiontype_error303) otherwise
25
26 ## Exception safety
27
28 Strong exception safety: if an exception occurs, the original value stays intact.
29
30 ## Exceptions
31
32 Throws [`type_error.303`](../../home/exceptions.md#jsonexceptiontype_error303) if the requested reference type does not
33 match the stored JSON value type; example: `"incompatible ReferenceType for get_ref, actual type is binary"`.
34
35 ## Complexity
36
37 Constant.
38
39 ## Notes
40
41 !!! warning
42
43 Writing data to the referee of the result yields an undefined state.
44
45 ## Examples
46
47 ??? example
48
49 The example shows several calls to `get_ref()`.
50
51 ```cpp
52 --8<-- "examples/get_ref.cpp"
53 ```
54
55 Output:
56
57 ```json
58 --8<-- "examples/get_ref.output"
59 ```
60
61 ## Version history
62
63 - Added in version 1.1.0.
64 - Extended to binary types in version 3.8.0.