| 1 |
|
|
1 |
|
|
| 2 |
|
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
|
2 |
|
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
|
| 3 |
|
// Copyright (c) 2020 Krystian Stasiowski (sdkrystian@gmail.com)
|
3 |
|
// Copyright (c) 2020 Krystian Stasiowski (sdkrystian@gmail.com)
|
| 4 |
|
|
4 |
|
|
| 5 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
5 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
| 6 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
6 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
| 7 |
|
|
7 |
|
|
| 8 |
|
// Official repository: https://github.com/boostorg/json
|
8 |
|
// Official repository: https://github.com/boostorg/json
|
| 9 |
|
|
9 |
|
|
| 10 |
|
|
10 |
|
|
| 11 |
|
#ifndef BOOST_JSON_VALUE_HPP
|
11 |
|
#ifndef BOOST_JSON_VALUE_HPP
|
| 12 |
|
#define BOOST_JSON_VALUE_HPP
|
12 |
|
#define BOOST_JSON_VALUE_HPP
|
| 13 |
|
|
13 |
|
|
| 14 |
|
#include <boost/core/detail/static_assert.hpp>
|
14 |
|
#include <boost/core/detail/static_assert.hpp>
|
| 15 |
|
#include <boost/json/detail/config.hpp>
|
15 |
|
#include <boost/json/detail/config.hpp>
|
| 16 |
|
#include <boost/json/array.hpp>
|
16 |
|
#include <boost/json/array.hpp>
|
| 17 |
|
#include <boost/json/kind.hpp>
|
17 |
|
#include <boost/json/kind.hpp>
|
| 18 |
|
#include <boost/json/object.hpp>
|
18 |
|
#include <boost/json/object.hpp>
|
| 19 |
|
#include <boost/json/pilfer.hpp>
|
19 |
|
#include <boost/json/pilfer.hpp>
|
| 20 |
|
#include <boost/json/set_pointer_options.hpp>
|
20 |
|
#include <boost/json/set_pointer_options.hpp>
|
| 21 |
|
#include <boost/json/storage_ptr.hpp>
|
21 |
|
#include <boost/json/storage_ptr.hpp>
|
| 22 |
|
#include <boost/json/string.hpp>
|
22 |
|
#include <boost/json/string.hpp>
|
| 23 |
|
#include <boost/json/string_view.hpp>
|
23 |
|
#include <boost/json/string_view.hpp>
|
| 24 |
|
#include <boost/json/value_ref.hpp>
|
24 |
|
#include <boost/json/value_ref.hpp>
|
| 25 |
|
#include <boost/json/detail/except.hpp>
|
25 |
|
#include <boost/json/detail/except.hpp>
|
| 26 |
|
#include <boost/json/detail/value.hpp>
|
26 |
|
#include <boost/json/detail/value.hpp>
|
| 27 |
|
|
27 |
|
|
| 28 |
|
|
28 |
|
|
| 29 |
|
#include <initializer_list>
|
29 |
|
#include <initializer_list>
|
| 30 |
|
|
30 |
|
|
| 31 |
|
|
31 |
|
|
| 32 |
|
|
32 |
|
|
| 33 |
|
|
33 |
|
|
| 34 |
|
|
34 |
|
|
| 35 |
|
|
35 |
|
|
| 36 |
|
|
36 |
|
|
| 37 |
|
|
37 |
|
|
| 38 |
|
|
38 |
|
|
| 39 |
|
//----------------------------------------------------------
|
39 |
|
//----------------------------------------------------------
|
| 40 |
|
|
40 |
|
|
| 41 |
|
/** The type used to represent any JSON value
|
41 |
|
/** The type used to represent any JSON value
|
| 42 |
|
|
42 |
|
|
| 43 |
|
This is a [Regular](https://en.cppreference.com/w/cpp/concepts/regular)
|
43 |
|
This is a [Regular](https://en.cppreference.com/w/cpp/concepts/regular)
|
| 44 |
|
type which works like a variant of the basic JSON data types: array,
|
44 |
|
type which works like a variant of the basic JSON data types: array,
|
| 45 |
|
object, string, number, boolean, and null.
|
45 |
|
object, string, number, boolean, and null.
|
| 46 |
|
|
46 |
|
|
| 47 |
|
|
47 |
|
|
| 48 |
|
Distinct instances may be accessed concurrently. Non-const member
|
48 |
|
Distinct instances may be accessed concurrently. Non-const member
|
| 49 |
|
functions of a shared instance may not be called concurrently with any
|
49 |
|
functions of a shared instance may not be called concurrently with any
|
| 50 |
|
other member functions of that instance.
|
50 |
|
other member functions of that instance.
|
| 51 |
|
|
51 |
|
|
| 52 |
|
|
52 |
|
|
| 53 |
|
|
53 |
|
|
| 54 |
|
|
54 |
|
|
| 55 |
|
using scalar = detail::scalar;
|
55 |
|
using scalar = detail::scalar;
|
| 56 |
|
|
56 |
|
|
| 57 |
|
|
57 |
|
|
| 58 |
|
|
58 |
|
|
| 59 |
|
storage_ptr sp_; // must come first
|
59 |
|
storage_ptr sp_; // must come first
|
| 60 |
|
|
60 |
|
|
| 61 |
|
|
61 |
|
|
| 62 |
|
|
62 |
|
|
| 63 |
|
|
63 |
|
|
| 64 |
|
|
64 |
|
|
| 65 |
|
|
65 |
|
|
| 66 |
|
|
66 |
|
|
| 67 |
|
|
67 |
|
|
| 68 |
|
|
68 |
|
|
| 69 |
|
|
69 |
|
|
| 70 |
|
// VFALCO doc toolchain incorrectly treats this as public
|
70 |
|
// VFALCO doc toolchain incorrectly treats this as public
|
| 71 |
|
friend struct detail::access;
|
71 |
|
friend struct detail::access;
|
| 72 |
|
|
72 |
|
|
| 73 |
|
|
73 |
|
|
| 74 |
|
|
74 |
|
|
| 75 |
|
|
75 |
|
|
| 76 |
|
detail::unchecked_array&& ua)
|
76 |
|
detail::unchecked_array&& ua)
|
| 77 |
|
|
77 |
|
|
| 78 |
|
|
78 |
|
|
| 79 |
|
|
79 |
|
|
| 80 |
|
|
80 |
|
|
| 81 |
|
|
81 |
|
|
| 82 |
|
|
82 |
|
|
| 83 |
|
detail::unchecked_object&& uo)
|
83 |
|
detail::unchecked_object&& uo)
|
| 84 |
|
|
84 |
|
|
| 85 |
|
|
85 |
|
|
| 86 |
|
|
86 |
|
|
| 87 |
|
|
87 |
|
|
| 88 |
|
|
88 |
|
|
| 89 |
|
|
89 |
|
|
| 90 |
|
|
90 |
|
|
| 91 |
|
|
91 |
|
|
| 92 |
|
: str_(detail::key_t{}, s, std::move(sp))
|
92 |
|
: str_(detail::key_t{}, s, std::move(sp))
|
| 93 |
|
|
93 |
|
|
| 94 |
|
|
94 |
|
|
| 95 |
|
|
95 |
|
|
| 96 |
|
|
96 |
|
|
| 97 |
|
|
97 |
|
|
| 98 |
|
|
98 |
|
|
| 99 |
|
|
99 |
|
|
| 100 |
|
|
100 |
|
|
| 101 |
|
: str_(detail::key_t{}, s1, s2, std::move(sp))
|
101 |
|
: str_(detail::key_t{}, s1, s2, std::move(sp))
|
| 102 |
|
|
102 |
|
|
| 103 |
|
|
103 |
|
|
| 104 |
|
|
104 |
|
|
| 105 |
|
inline bool is_scalar() const noexcept
|
105 |
|
inline bool is_scalar() const noexcept
|
| 106 |
|
|
106 |
|
|
| 107 |
|
return sca_.k < json::kind::string;
|
107 |
|
return sca_.k < json::kind::string;
|
| 108 |
|
|
108 |
|
|
| 109 |
|
|
109 |
|
|
| 110 |
|
|
110 |
|
|
| 111 |
|
/// Associated [Allocator](https://en.cppreference.com/w/cpp/named_req/Allocator)
|
111 |
|
/// Associated [Allocator](https://en.cppreference.com/w/cpp/named_req/Allocator)
|
| 112 |
|
using allocator_type = container::pmr::polymorphic_allocator<value>;
|
112 |
|
using allocator_type = container::pmr::polymorphic_allocator<value>;
|
| 113 |
|
|
113 |
|
|
| 114 |
|
|
114 |
|
|
| 115 |
|
|
115 |
|
|
| 116 |
|
The value and all of its contents are destroyed. Any dynamically
|
116 |
|
The value and all of its contents are destroyed. Any dynamically
|
| 117 |
|
allocated memory that was allocated internally is freed.
|
117 |
|
allocated memory that was allocated internally is freed.
|
| 118 |
|
|
118 |
|
|
| 119 |
|
|
119 |
|
|
| 120 |
|
Constant, or linear in size for array or object.
|
120 |
|
Constant, or linear in size for array or object.
|
| 121 |
|
|
121 |
|
|
| 122 |
|
|
122 |
|
|
| 123 |
|
|
123 |
|
|
| 124 |
|
|
124 |
|
|
| 125 |
|
|
125 |
|
|
| 126 |
|
|
126 |
|
|
| 127 |
|
|
127 |
|
|
| 128 |
|
|
128 |
|
|
| 129 |
|
|
129 |
|
|
| 130 |
|
|
130 |
|
|
| 131 |
|
|
131 |
|
|
| 132 |
|
@li **(1)**--**(3)** the constructed value is null.
|
132 |
|
@li **(1)**--**(3)** the constructed value is null.
|
| 133 |
|
@li **(4)** the constructed value contains a copy of `b`.
|
133 |
|
@li **(4)** the constructed value contains a copy of `b`.
|
| 134 |
|
@li **(5)**--**(9)** the constructed value contains a copy of `i`.
|
134 |
|
@li **(5)**--**(9)** the constructed value contains a copy of `i`.
|
| 135 |
|
@li **(10)**--**(14)** the constructed value contains a copy of `u`.
|
135 |
|
@li **(10)**--**(14)** the constructed value contains a copy of `u`.
|
| 136 |
|
@li **(15)** the constructed value contains a copy of `d`.
|
136 |
|
@li **(15)** the constructed value contains a copy of `d`.
|
| 137 |
|
@li **(16)**, **(19)** the constructed value contains a copy of the
|
137 |
|
@li **(16)**, **(19)** the constructed value contains a copy of the
|
| 138 |
|
|
138 |
|
|
| 139 |
|
@li **(17)** the constructed value contains a copy of the
|
139 |
|
@li **(17)** the constructed value contains a copy of the
|
| 140 |
|
null-terminated string `s`.
|
140 |
|
null-terminated string `s`.
|
| 141 |
|
@li **(18)** the constructed value takes ownership of `s`'s storage.
|
141 |
|
@li **(18)** the constructed value takes ownership of `s`'s storage.
|
| 142 |
|
@li **(20)** if `*s.storage() == *sp` equivalent to **(18)**, otherwise
|
142 |
|
@li **(20)** if `*s.storage() == *sp` equivalent to **(18)**, otherwise
|
| 143 |
|
|
143 |
|
|
| 144 |
|
@li **(21)** the constructed value contains an empty string.
|
144 |
|
@li **(21)** the constructed value contains an empty string.
|
| 145 |
|
@li **(22)** the constructed value takes ownership of `arr`'s storage.
|
145 |
|
@li **(22)** the constructed value takes ownership of `arr`'s storage.
|
| 146 |
|
@li **(23)** the constructed value contains an element-wise copy of the
|
146 |
|
@li **(23)** the constructed value contains an element-wise copy of the
|
| 147 |
|
|
147 |
|
|
| 148 |
|
@li **(24)** if `*arr.storage() == *sp` equivalent to **(22)**,
|
148 |
|
@li **(24)** if `*arr.storage() == *sp` equivalent to **(22)**,
|
| 149 |
|
otherwise equivalent to **(23)**.
|
149 |
|
otherwise equivalent to **(23)**.
|
| 150 |
|
@li **(25)** the constructed value contains an empty array.
|
150 |
|
@li **(25)** the constructed value contains an empty array.
|
| 151 |
|
@li **(26)** the constructed value takes ownership of `obj`'s storage.
|
151 |
|
@li **(26)** the constructed value takes ownership of `obj`'s storage.
|
| 152 |
|
@li **(27)** the constructed value contains an element-wise copy of the
|
152 |
|
@li **(27)** the constructed value contains an element-wise copy of the
|
| 153 |
|
|
153 |
|
|
| 154 |
|
@li **(28)** if `*obj.storage() == *sp` equivalent to **(26)**,
|
154 |
|
@li **(28)** if `*obj.storage() == *sp` equivalent to **(26)**,
|
| 155 |
|
otherwise equivalent to **(27)**.
|
155 |
|
otherwise equivalent to **(27)**.
|
| 156 |
|
@li **(29)** the constructed value contains an empty object.
|
156 |
|
@li **(29)** the constructed value contains an empty object.
|
| 157 |
|
@li **(30)** the constructed value's contents are formed by
|
157 |
|
@li **(30)** the constructed value's contents are formed by
|
| 158 |
|
constructing from `init` and `sp` (see \<\<initializer_lists\>\>).
|
158 |
|
constructing from `init` and `sp` (see \<\<initializer_lists\>\>).
|
| 159 |
|
@li **(31)**, **(32)** the constructed value contains a copy of the
|
159 |
|
@li **(31)**, **(32)** the constructed value contains a copy of the
|
| 160 |
|
|
160 |
|
|
| 161 |
|
@li **(33)** the constructed value acquires ownership of the contents
|
161 |
|
@li **(33)** the constructed value acquires ownership of the contents
|
| 162 |
|
|
162 |
|
|
| 163 |
|
@li **(34)** equivalent to **(33)** if `*sp == *other.storage()`;
|
163 |
|
@li **(34)** equivalent to **(33)** if `*sp == *other.storage()`;
|
| 164 |
|
otherwise equivalent to **(32)**.
|
164 |
|
otherwise equivalent to **(32)**.
|
| 165 |
|
@li **(35)** the constructed value acquires ownership of the contents
|
165 |
|
@li **(35)** the constructed value acquires ownership of the contents
|
| 166 |
|
of `other` using pilfer semantics. This is more efficient than move
|
166 |
|
of `other` using pilfer semantics. This is more efficient than move
|
| 167 |
|
construction, when it is known that the moved-from object will be
|
167 |
|
construction, when it is known that the moved-from object will be
|
| 168 |
|
immediately destroyed afterwards.
|
168 |
|
immediately destroyed afterwards.
|
| 169 |
|
|
169 |
|
|
| 170 |
|
With **(2)**--**(17)**, **(19)**--**(21)**, **(23)**--**(25)**,
|
170 |
|
With **(2)**--**(17)**, **(19)**--**(21)**, **(23)**--**(25)**,
|
| 171 |
|
{sp} **(27)**--**(30)**, **(32)**, and **(34)** the constructed value
|
171 |
|
{sp} **(27)**--**(30)**, **(32)**, and **(34)** the constructed value
|
| 172 |
|
uses memory resource of `sp`. With **(18)**, **(22)**, **(26)**,
|
172 |
|
uses memory resource of `sp`. With **(18)**, **(22)**, **(26)**,
|
| 173 |
|
{sp} **(31)**, **(33)**, and **(35)** it uses the memory resource of
|
173 |
|
{sp} **(31)**, **(33)**, and **(35)** it uses the memory resource of
|
| 174 |
|
the argument (`s`, `arr`, obj`, or `value`). In either case the value
|
174 |
|
the argument (`s`, `arr`, obj`, or `value`). In either case the value
|
| 175 |
|
will share the ownership of the memory resource. With **(1)**
|
175 |
|
will share the ownership of the memory resource. With **(1)**
|
| 176 |
|
it uses the \<\<default_memory_resource, default memory resource\>\>.
|
176 |
|
it uses the \<\<default_memory_resource, default memory resource\>\>.
|
| 177 |
|
|
177 |
|
|
| 178 |
|
After **(18)**, **(22)**, **(26)**, and **(33)** the argument behaves
|
178 |
|
After **(18)**, **(22)**, **(26)**, and **(33)** the argument behaves
|
| 179 |
|
as if newly constructed with its current storage pointer (i.e. becomes
|
179 |
|
as if newly constructed with its current storage pointer (i.e. becomes
|
| 180 |
|
an empty string, array, object, or null value).
|
180 |
|
an empty string, array, object, or null value).
|
| 181 |
|
|
181 |
|
|
| 182 |
|
After **(35)** `other` is not in a usable state and may only be
|
182 |
|
After **(35)** `other` is not in a usable state and may only be
|
| 183 |
|
|
183 |
|
|
| 184 |
|
|
184 |
|
|
| 185 |
|
|
185 |
|
|
| 186 |
|
@li **(1)**--**(15)**, **(18)**, **(21)**, **(22)**, **(25)**,
|
186 |
|
@li **(1)**--**(15)**, **(18)**, **(21)**, **(22)**, **(25)**,
|
| 187 |
|
{sp} **(26)**, **(29)**, **(33)**, **(35)** constant.
|
187 |
|
{sp} **(26)**, **(29)**, **(33)**, **(35)** constant.
|
| 188 |
|
@li **(16)**, **(19)** linear in `s.size()`.
|
188 |
|
@li **(16)**, **(19)** linear in `s.size()`.
|
| 189 |
|
@li **(17)** linear in `std::strlen(s)`.
|
189 |
|
@li **(17)** linear in `std::strlen(s)`.
|
| 190 |
|
@li **(20)** if `*s.storage() == *sp` constant, otherwise linear
|
190 |
|
@li **(20)** if `*s.storage() == *sp` constant, otherwise linear
|
| 191 |
|
|
191 |
|
|
| 192 |
|
@li **(23)** linear in `arr.size()`.
|
192 |
|
@li **(23)** linear in `arr.size()`.
|
| 193 |
|
@li **(24)** if `*arr.storage() == *sp` constant, otherwise linear
|
193 |
|
@li **(24)** if `*arr.storage() == *sp` constant, otherwise linear
|
| 194 |
|
|
194 |
|
|
| 195 |
|
@li **(27)** linear in `obj.size()`.
|
195 |
|
@li **(27)** linear in `obj.size()`.
|
| 196 |
|
@li **(28)** if `*obj.storage() == *sp` constant, otherwise linear
|
196 |
|
@li **(28)** if `*obj.storage() == *sp` constant, otherwise linear
|
| 197 |
|
|
197 |
|
|
| 198 |
|
@li **(30)** linear in `init.size()`.
|
198 |
|
@li **(30)** linear in `init.size()`.
|
| 199 |
|
@li **(31)**, **(32)** linear in the size of `other`.
|
199 |
|
@li **(31)**, **(32)** linear in the size of `other`.
|
| 200 |
|
@li **(34)** constant if `*sp == *other.storage()`; otherwise linear in
|
200 |
|
@li **(34)** constant if `*sp == *other.storage()`; otherwise linear in
|
| 201 |
|
|
201 |
|
|
| 202 |
|
|
202 |
|
|
| 203 |
|
The size of `other` is either the size of the underlying container
|
203 |
|
The size of `other` is either the size of the underlying container
|
| 204 |
|
(if there is one), or can be considered to be 1.
|
204 |
|
(if there is one), or can be considered to be 1.
|
| 205 |
|
|
205 |
|
|
| 206 |
|
|
206 |
|
|
| 207 |
|
@li **(1)**--**(15)**, **(18)**, **(21)**, **(22)**, **(25)**,
|
207 |
|
@li **(1)**--**(15)**, **(18)**, **(21)**, **(22)**, **(25)**,
|
| 208 |
|
**(26)**, **(29)**, **(33)**, **(35)** no-throw guarantee.
|
208 |
|
**(26)**, **(29)**, **(33)**, **(35)** no-throw guarantee.
|
| 209 |
|
@li **(16)**, **(17)**, **(19)**, **(23)**, **(27)**,
|
209 |
|
@li **(16)**, **(17)**, **(19)**, **(23)**, **(27)**,
|
| 210 |
|
**(30)**--**(32)** strong guarantee.
|
210 |
|
**(30)**--**(32)** strong guarantee.
|
| 211 |
|
@li **(20)** if `*s.storage() == *sp` no-throw guarantee, otherwise
|
211 |
|
@li **(20)** if `*s.storage() == *sp` no-throw guarantee, otherwise
|
| 212 |
|
|
212 |
|
|
| 213 |
|
@li **(24)** if `*arr.storage() == *sp` no-throw guarantee, otherwise
|
213 |
|
@li **(24)** if `*arr.storage() == *sp` no-throw guarantee, otherwise
|
| 214 |
|
|
214 |
|
|
| 215 |
|
@li **(28)** if `*obj.storage() == *sp` no-throw guarantee, otherwise
|
215 |
|
@li **(28)** if `*obj.storage() == *sp` no-throw guarantee, otherwise
|
| 216 |
|
|
216 |
|
|
| 217 |
|
@li **(33)** if `*other.storage() == *sp` no-throw guarantee, otherwise
|
217 |
|
@li **(33)** if `*other.storage() == *sp` no-throw guarantee, otherwise
|
| 218 |
|
|
218 |
|
|
| 219 |
|
|
219 |
|
|
| 220 |
|
Calls to `memory_resource::allocate` may throw.
|
220 |
|
Calls to `memory_resource::allocate` may throw.
|
| 221 |
|
|
221 |
|
|
| 222 |
|
|
222 |
|
|
| 223 |
|
[Valueless Variants Considered Harmful](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0308r0.html).
|
223 |
|
[Valueless Variants Considered Harmful](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0308r0.html).
|
| 224 |
|
|
224 |
|
|
| 225 |
|
|
225 |
|
|
| 226 |
|
|
226 |
|
|
| 227 |
|
|
227 |
|
|
| 228 |
|
|
228 |
|
|
| 229 |
|
|
229 |
|
|
| 230 |
|
|
230 |
|
|
| 231 |
|
|
231 |
|
|
| 232 |
|
|
232 |
|
|
| 233 |
|
|
233 |
|
|
| 234 |
|
@param sp A pointer to the @ref boost::container::pmr::memory_resource
|
234 |
|
@param sp A pointer to the @ref boost::container::pmr::memory_resource
|
| 235 |
|
|
235 |
|
|
| 236 |
|
|
236 |
|
|
| 237 |
|
|
237 |
|
|
| 238 |
|
value(storage_ptr sp) noexcept
|
238 |
|
value(storage_ptr sp) noexcept
|
| 239 |
|
|
239 |
|
|
| 240 |
|
|
240 |
|
|
| 241 |
|
|
241 |
|
|
| 242 |
|
|
242 |
|
|
| 243 |
|
|
243 |
|
|
| 244 |
|
|
244 |
|
|
| 245 |
|
|
245 |
|
|
| 246 |
|
storage_ptr sp = {}) noexcept
|
246 |
|
storage_ptr sp = {}) noexcept
|
| 247 |
|
|
247 |
|
|
| 248 |
|
|
248 |
|
|
| 249 |
|
|
249 |
|
|
| 250 |
|
|
250 |
|
|
| 251 |
|
|
251 |
|
|
| 252 |
|
|
252 |
|
|
| 253 |
|
@param b The boolean to construct with.
|
253 |
|
@param b The boolean to construct with.
|
| 254 |
|
|
254 |
|
|
| 255 |
|
|
255 |
|
|
| 256 |
|
|
256 |
|
|
| 257 |
|
|
257 |
|
|
| 258 |
|
|
258 |
|
|
| 259 |
|
storage_ptr sp = {}) noexcept;
|
259 |
|
storage_ptr sp = {}) noexcept;
|
| 260 |
|
|
260 |
|
|
| 261 |
|
|
261 |
|
|
| 262 |
|
,class = typename std::enable_if<
|
262 |
|
,class = typename std::enable_if<
|
| 263 |
|
std::is_same<T, bool>::value>::type
|
263 |
|
std::is_same<T, bool>::value>::type
|
| 264 |
|
|
264 |
|
|
| 265 |
|
|
265 |
|
|
| 266 |
|
|
266 |
|
|
| 267 |
|
storage_ptr sp = {}) noexcept
|
267 |
|
storage_ptr sp = {}) noexcept
|
| 268 |
|
|
268 |
|
|
| 269 |
|
|
269 |
|
|
| 270 |
|
|
270 |
|
|
| 271 |
|
|
271 |
|
|
| 272 |
|
|
272 |
|
|
| 273 |
|
|
273 |
|
|
| 274 |
|
|
274 |
|
|
| 275 |
|
@param i The number to construct with.
|
275 |
|
@param i The number to construct with.
|
| 276 |
|
|
276 |
|
|
| 277 |
|
|
277 |
|
|
| 278 |
|
|
278 |
|
|
| 279 |
|
|
279 |
|
|
| 280 |
|
storage_ptr sp = {}) noexcept
|
280 |
|
storage_ptr sp = {}) noexcept
|
| 281 |
|
: sca_(static_cast<std::int64_t>(
|
281 |
|
: sca_(static_cast<std::int64_t>(
|
| 282 |
|
|
282 |
|
|
| 283 |
|
|
283 |
|
|
| 284 |
|
|
284 |
|
|
| 285 |
|
|
285 |
|
|
| 286 |
|
|
286 |
|
|
| 287 |
|
|
287 |
|
|
| 288 |
|
|
288 |
|
|
| 289 |
|
storage_ptr sp = {}) noexcept
|
289 |
|
storage_ptr sp = {}) noexcept
|
| 290 |
|
: sca_(static_cast<std::int64_t>(
|
290 |
|
: sca_(static_cast<std::int64_t>(
|
| 291 |
|
|
291 |
|
|
| 292 |
|
|
292 |
|
|
| 293 |
|
|
293 |
|
|
| 294 |
|
|
294 |
|
|
| 295 |
|
|
295 |
|
|
| 296 |
|
|
296 |
|
|
| 297 |
|
|
297 |
|
|
| 298 |
|
storage_ptr sp = {}) noexcept
|
298 |
|
storage_ptr sp = {}) noexcept
|
| 299 |
|
: sca_(static_cast<std::int64_t>(i),
|
299 |
|
: sca_(static_cast<std::int64_t>(i),
|
| 300 |
|
|
300 |
|
|
| 301 |
|
|
301 |
|
|
| 302 |
|
|
302 |
|
|
| 303 |
|
|
303 |
|
|
| 304 |
|
|
304 |
|
|
| 305 |
|
|
305 |
|
|
| 306 |
|
|
306 |
|
|
| 307 |
|
storage_ptr sp = {}) noexcept
|
307 |
|
storage_ptr sp = {}) noexcept
|
| 308 |
|
: sca_(static_cast<std::int64_t>(i),
|
308 |
|
: sca_(static_cast<std::int64_t>(i),
|
| 309 |
|
|
309 |
|
|
| 310 |
|
|
310 |
|
|
| 311 |
|
|
311 |
|
|
| 312 |
|
|
312 |
|
|
| 313 |
|
|
313 |
|
|
| 314 |
|
|
314 |
|
|
| 315 |
|
|
315 |
|
|
| 316 |
|
storage_ptr sp = {}) noexcept
|
316 |
|
storage_ptr sp = {}) noexcept
|
| 317 |
|
: sca_(static_cast<std::int64_t>(i),
|
317 |
|
: sca_(static_cast<std::int64_t>(i),
|
| 318 |
|
|
318 |
|
|
| 319 |
|
|
319 |
|
|
| 320 |
|
|
320 |
|
|
| 321 |
|
|
321 |
|
|
| 322 |
|
|
322 |
|
|
| 323 |
|
|
323 |
|
|
| 324 |
|
@param u The number to construct with.
|
324 |
|
@param u The number to construct with.
|
| 325 |
|
|
325 |
|
|
| 326 |
|
|
326 |
|
|
| 327 |
|
|
327 |
|
|
| 328 |
|
|
328 |
|
|
| 329 |
|
storage_ptr sp = {}) noexcept
|
329 |
|
storage_ptr sp = {}) noexcept
|
| 330 |
|
: sca_(static_cast<std::uint64_t>(
|
330 |
|
: sca_(static_cast<std::uint64_t>(
|
| 331 |
|
|
331 |
|
|
| 332 |
|
|
332 |
|
|
| 333 |
|
|
333 |
|
|
| 334 |
|
|
334 |
|
|
| 335 |
|
|
335 |
|
|
| 336 |
|
|
336 |
|
|
| 337 |
|
|
337 |
|
|
| 338 |
|
storage_ptr sp = {}) noexcept
|
338 |
|
storage_ptr sp = {}) noexcept
|
| 339 |
|
: sca_(static_cast<std::uint64_t>(u),
|
339 |
|
: sca_(static_cast<std::uint64_t>(u),
|
| 340 |
|
|
340 |
|
|
| 341 |
|
|
341 |
|
|
| 342 |
|
|
342 |
|
|
| 343 |
|
|
343 |
|
|
| 344 |
|
|
344 |
|
|
| 345 |
|
|
345 |
|
|
| 346 |
|
|
346 |
|
|
| 347 |
|
storage_ptr sp = {}) noexcept
|
347 |
|
storage_ptr sp = {}) noexcept
|
| 348 |
|
: sca_(static_cast<std::uint64_t>(u),
|
348 |
|
: sca_(static_cast<std::uint64_t>(u),
|
| 349 |
|
|
349 |
|
|
| 350 |
|
|
350 |
|
|
| 351 |
|
|
351 |
|
|
| 352 |
|
|
352 |
|
|
| 353 |
|
|
353 |
|
|
| 354 |
|
|
354 |
|
|
| 355 |
|
|
355 |
|
|
| 356 |
|
storage_ptr sp = {}) noexcept
|
356 |
|
storage_ptr sp = {}) noexcept
|
| 357 |
|
: sca_(static_cast<std::uint64_t>(u),
|
357 |
|
: sca_(static_cast<std::uint64_t>(u),
|
| 358 |
|
|
358 |
|
|
| 359 |
|
|
359 |
|
|
| 360 |
|
|
360 |
|
|
| 361 |
|
|
361 |
|
|
| 362 |
|
|
362 |
|
|
| 363 |
|
|
363 |
|
|
| 364 |
|
|
364 |
|
|
| 365 |
|
storage_ptr sp = {}) noexcept
|
365 |
|
storage_ptr sp = {}) noexcept
|
| 366 |
|
: sca_(static_cast<std::uint64_t>(u),
|
366 |
|
: sca_(static_cast<std::uint64_t>(u),
|
| 367 |
|
|
367 |
|
|
| 368 |
|
|
368 |
|
|
| 369 |
|
|
369 |
|
|
| 370 |
|
|
370 |
|
|
| 371 |
|
|
371 |
|
|
| 372 |
|
|
372 |
|
|
| 373 |
|
@param d The number to construct with.
|
373 |
|
@param d The number to construct with.
|
| 374 |
|
|
374 |
|
|
| 375 |
|
|
375 |
|
|
| 376 |
|
|
376 |
|
|
| 377 |
|
|
377 |
|
|
| 378 |
|
storage_ptr sp = {}) noexcept
|
378 |
|
storage_ptr sp = {}) noexcept
|
| 379 |
|
|
379 |
|
|
| 380 |
|
|
380 |
|
|
| 381 |
|
|
381 |
|
|
| 382 |
|
|
382 |
|
|
| 383 |
|
|
383 |
|
|
| 384 |
|
|
384 |
|
|
| 385 |
|
@param s The string to construct with.
|
385 |
|
@param s The string to construct with.
|
| 386 |
|
|
386 |
|
|
| 387 |
|
|
387 |
|
|
| 388 |
|
|
388 |
|
|
| 389 |
|
|
389 |
|
|
| 390 |
|
|
390 |
|
|
| 391 |
|
|
391 |
|
|
| 392 |
|
|
392 |
|
|
| 393 |
|
|
393 |
|
|
| 394 |
|
|
394 |
|
|
| 395 |
|
|
395 |
|
|
| 396 |
|
|
396 |
|
|
| 397 |
|
|
397 |
|
|
| 398 |
|
|
398 |
|
|
| 399 |
|
|
399 |
|
|
| 400 |
|
|
400 |
|
|
| 401 |
|
|
401 |
|
|
| 402 |
|
|
402 |
|
|
| 403 |
|
|
403 |
|
|
| 404 |
|
|
404 |
|
|
| 405 |
|
|
405 |
|
|
| 406 |
|
|
406 |
|
|
| 407 |
|
|
407 |
|
|
| 408 |
|
|
408 |
|
|
| 409 |
|
|
409 |
|
|
| 410 |
|
|
410 |
|
|
| 411 |
|
|
411 |
|
|
| 412 |
|
|
412 |
|
|
| 413 |
|
|
413 |
|
|
| 414 |
|
|
414 |
|
|
| 415 |
|
|
415 |
|
|
| 416 |
|
|
416 |
|
|
| 417 |
|
|
417 |
|
|
| 418 |
|
|
418 |
|
|
| 419 |
|
|
419 |
|
|
| 420 |
|
|
420 |
|
|
| 421 |
|
|
421 |
|
|
| 422 |
|
|
422 |
|
|
| 423 |
|
|
423 |
|
|
| 424 |
|
|
424 |
|
|
| 425 |
|
|
425 |
|
|
| 426 |
|
|
426 |
|
|
| 427 |
|
|
427 |
|
|
| 428 |
|
|
428 |
|
|
| 429 |
|
|
429 |
|
|
| 430 |
|
|
430 |
|
|
| 431 |
|
|
431 |
|
|
| 432 |
|
|
432 |
|
|
| 433 |
|
storage_ptr sp = {}) noexcept
|
433 |
|
storage_ptr sp = {}) noexcept
|
| 434 |
|
|
434 |
|
|
| 435 |
|
|
435 |
|
|
| 436 |
|
|
436 |
|
|
| 437 |
|
|
437 |
|
|
| 438 |
|
|
438 |
|
|
| 439 |
|
|
439 |
|
|
| 440 |
|
@param arr The array to construct with.
|
440 |
|
@param arr The array to construct with.
|
| 441 |
|
|
441 |
|
|
| 442 |
|
value(array arr) noexcept
|
442 |
|
value(array arr) noexcept
|
| 443 |
|
|
443 |
|
|
| 444 |
|
|
444 |
|
|
| 445 |
|
|
445 |
|
|
| 446 |
|
|
446 |
|
|
| 447 |
|
|
447 |
|
|
| 448 |
|
|
448 |
|
|
| 449 |
|
|
449 |
|
|
| 450 |
|
|
450 |
|
|
| 451 |
|
|
451 |
|
|
| 452 |
|
|
452 |
|
|
| 453 |
|
|
453 |
|
|
| 454 |
|
|
454 |
|
|
| 455 |
|
|
455 |
|
|
| 456 |
|
|
456 |
|
|
| 457 |
|
|
457 |
|
|
| 458 |
|
|
458 |
|
|
| 459 |
|
|
459 |
|
|
| 460 |
|
|
460 |
|
|
| 461 |
|
|
461 |
|
|
| 462 |
|
|
462 |
|
|
| 463 |
|
|
463 |
|
|
| 464 |
|
|
464 |
|
|
| 465 |
|
|
465 |
|
|
| 466 |
|
|
466 |
|
|
| 467 |
|
|
467 |
|
|
| 468 |
|
|
468 |
|
|
| 469 |
|
|
469 |
|
|
| 470 |
|
storage_ptr sp = {}) noexcept
|
470 |
|
storage_ptr sp = {}) noexcept
|
| 471 |
|
|
471 |
|
|
| 472 |
|
|
472 |
|
|
| 473 |
|
|
473 |
|
|
| 474 |
|
|
474 |
|
|
| 475 |
|
|
475 |
|
|
| 476 |
|
|
476 |
|
|
| 477 |
|
@param obj The object to construct with.
|
477 |
|
@param obj The object to construct with.
|
| 478 |
|
|
478 |
|
|
| 479 |
|
value(object obj) noexcept
|
479 |
|
value(object obj) noexcept
|
| 480 |
|
|
480 |
|
|
| 481 |
|
|
481 |
|
|
| 482 |
|
|
482 |
|
|
| 483 |
|
|
483 |
|
|
| 484 |
|
|
484 |
|
|
| 485 |
|
|
485 |
|
|
| 486 |
|
|
486 |
|
|
| 487 |
|
|
487 |
|
|
| 488 |
|
: obj_( obj, std::move(sp) )
|
488 |
|
: obj_( obj, std::move(sp) )
|
| 489 |
|
|
489 |
|
|
| 490 |
|
|
490 |
|
|
| 491 |
|
|
491 |
|
|
| 492 |
|
|
492 |
|
|
| 493 |
|
|
493 |
|
|
| 494 |
|
|
494 |
|
|
| 495 |
|
|
495 |
|
|
| 496 |
|
: obj_( std::move(obj), std::move(sp) )
|
496 |
|
: obj_( std::move(obj), std::move(sp) )
|
| 497 |
|
|
497 |
|
|
| 498 |
|
|
498 |
|
|
| 499 |
|
|
499 |
|
|
| 500 |
|
|
500 |
|
|
| 501 |
|
|
501 |
|
|
| 502 |
|
|
502 |
|
|
| 503 |
|
storage_ptr sp = {}) noexcept
|
503 |
|
storage_ptr sp = {}) noexcept
|
| 504 |
|
|
504 |
|
|
| 505 |
|
|
505 |
|
|
| 506 |
|
|
506 |
|
|
| 507 |
|
|
507 |
|
|
| 508 |
|
|
508 |
|
|
| 509 |
|
|
509 |
|
|
| 510 |
|
@param init The initializer list to construct from.
|
510 |
|
@param init The initializer list to construct from.
|
| 511 |
|
|
511 |
|
|
| 512 |
|
|
512 |
|
|
| 513 |
|
|
513 |
|
|
| 514 |
|
|
514 |
|
|
| 515 |
|
std::initializer_list<value_ref> init,
|
515 |
|
std::initializer_list<value_ref> init,
|
| 516 |
|
|
516 |
|
|
| 517 |
|
|
517 |
|
|
| 518 |
|
|
518 |
|
|
| 519 |
|
|
519 |
|
|
| 520 |
|
@param other Another `value`.
|
520 |
|
@param other Another `value`.
|
| 521 |
|
|
521 |
|
|
| 522 |
|
value(value const& other)
|
522 |
|
value(value const& other)
|
| 523 |
|
: value(other, other.storage())
|
523 |
|
: value(other, other.storage())
|
| 524 |
|
|
524 |
|
|
| 525 |
|
|
525 |
|
|
| 526 |
|
|
526 |
|
|
| 527 |
|
|
527 |
|
|
| 528 |
|
|
528 |
|
|
| 529 |
|
|
529 |
|
|
| 530 |
|
|
530 |
|
|
| 531 |
|
|
531 |
|
|
| 532 |
|
|
532 |
|
|
| 533 |
|
|
533 |
|
|
| 534 |
|
|
534 |
|
|
| 535 |
|
value(value&& other) noexcept;
|
535 |
|
value(value&& other) noexcept;
|
| 536 |
|
|
536 |
|
|
| 537 |
|
|
537 |
|
|
| 538 |
|
|
538 |
|
|
| 539 |
|
|
539 |
|
|
| 540 |
|
|
540 |
|
|
| 541 |
|
|
541 |
|
|
| 542 |
|
|
542 |
|
|
| 543 |
|
|
543 |
|
|
| 544 |
|
value(pilfered<value> other) noexcept
|
544 |
|
value(pilfered<value> other) noexcept
|
| 545 |
|
|
545 |
|
|
| 546 |
|
relocate(this, other.get());
|
546 |
|
relocate(this, other.get());
|
| 547 |
|
::new(&other.get().sca_) scalar();
|
547 |
|
::new(&other.get().sca_) scalar();
|
| 548 |
|
|
548 |
|
|
| 549 |
|
|
549 |
|
|
| 550 |
|
|
550 |
|
|
| 551 |
|
//------------------------------------------------------
|
551 |
|
//------------------------------------------------------
|
| 552 |
|
|
552 |
|
|
| 553 |
|
|
553 |
|
|
| 554 |
|
|
554 |
|
|
| 555 |
|
//------------------------------------------------------
|
555 |
|
//------------------------------------------------------
|
| 556 |
|
|
556 |
|
|
| 557 |
|
|
557 |
|
|
| 558 |
|
|
558 |
|
|
| 559 |
|
Replaces the contents of this value.
|
559 |
|
Replaces the contents of this value.
|
| 560 |
|
|
560 |
|
|
| 561 |
|
@li **(1)** replaces with an element-wise copy of the contents of
|
561 |
|
@li **(1)** replaces with an element-wise copy of the contents of
|
| 562 |
|
|
562 |
|
|
| 563 |
|
@li **(2)** replaces with the contents `other` using move semantics
|
563 |
|
@li **(2)** replaces with the contents `other` using move semantics
|
| 564 |
|
|
564 |
|
|
| 565 |
|
@li **(3)** replaces with the value formed by constructing from `init`
|
565 |
|
@li **(3)** replaces with the value formed by constructing from `init`
|
| 566 |
|
and `this->storage()` (see \<\<initializer_lists\>\>).
|
566 |
|
and `this->storage()` (see \<\<initializer_lists\>\>).
|
| 567 |
|
@li **(4)** replaces with null.
|
567 |
|
@li **(4)** replaces with null.
|
| 568 |
|
@li **(5)** replaces with the boolean value `b`.
|
568 |
|
@li **(5)** replaces with the boolean value `b`.
|
| 569 |
|
@li **(6)**--**(10)** replaces with the signed integer `i`.
|
569 |
|
@li **(6)**--**(10)** replaces with the signed integer `i`.
|
| 570 |
|
@li **(11)**--**(15)** replaces with the unsigned integer `u`.
|
570 |
|
@li **(11)**--**(15)** replaces with the unsigned integer `u`.
|
| 571 |
|
@li **(16)** replaces with the number `d`.
|
571 |
|
@li **(16)** replaces with the number `d`.
|
| 572 |
|
@li **(17)**, **(19)** replaces with a copy of the string `s`.
|
572 |
|
@li **(17)**, **(19)** replaces with a copy of the string `s`.
|
| 573 |
|
@li **(18)**, equivalent to `*this = string_view(s)`.
|
573 |
|
@li **(18)**, equivalent to `*this = string_view(s)`.
|
| 574 |
|
@li **(20)** replaces with the string `s` using move semantics
|
574 |
|
@li **(20)** replaces with the string `s` using move semantics
|
| 575 |
|
|
575 |
|
|
| 576 |
|
@li **(21)** replaces with a copy of the array `arr`.
|
576 |
|
@li **(21)** replaces with a copy of the array `arr`.
|
| 577 |
|
@li **(22)** replaces with the array `arr` using move semantics
|
577 |
|
@li **(22)** replaces with the array `arr` using move semantics
|
| 578 |
|
|
578 |
|
|
| 579 |
|
@li **(23)** replaces with a copy of the object `obj`.
|
579 |
|
@li **(23)** replaces with a copy of the object `obj`.
|
| 580 |
|
@li **(24)** replaces with the object `obj` using move semantics
|
580 |
|
@li **(24)** replaces with the object `obj` using move semantics
|
| 581 |
|
|
581 |
|
|
| 582 |
|
|
582 |
|
|
| 583 |
|
Move assignment for `value` never changes the associated memory
|
583 |
|
Move assignment for `value` never changes the associated memory
|
| 584 |
|
resource. Because of this if the memory resource of the assigned value
|
584 |
|
resource. Because of this if the memory resource of the assigned value
|
| 585 |
|
differs from that of `*this`, the operation is equivalent to a copy.
|
585 |
|
differs from that of `*this`, the operation is equivalent to a copy.
|
| 586 |
|
Otherwise, it replaces the underlying storage in constant time without
|
586 |
|
Otherwise, it replaces the underlying storage in constant time without
|
| 587 |
|
the possibility of exceptions.
|
587 |
|
the possibility of exceptions.
|
| 588 |
|
|
588 |
|
|
| 589 |
|
|
589 |
|
|
| 590 |
|
@li **(1)** linear in the sizes of `*this` and `other`.
|
590 |
|
@li **(1)** linear in the sizes of `*this` and `other`.
|
| 591 |
|
@li **(2)** constant if `*this->storage() == *other.storage()`,
|
591 |
|
@li **(2)** constant if `*this->storage() == *other.storage()`,
|
| 592 |
|
otherwise linear in the sizes of `*this` and `other`.
|
592 |
|
otherwise linear in the sizes of `*this` and `other`.
|
| 593 |
|
@li **(3)** linear in the sizes of `*this` and `init`.
|
593 |
|
@li **(3)** linear in the sizes of `*this` and `init`.
|
| 594 |
|
@li **(4)**--**(16)** linear in the size of `*this`.
|
594 |
|
@li **(4)**--**(16)** linear in the size of `*this`.
|
| 595 |
|
@li **(17)**, **(19)** linear in the size of `*this` and `s.size()`.
|
595 |
|
@li **(17)**, **(19)** linear in the size of `*this` and `s.size()`.
|
| 596 |
|
@li **(18)** linear in the size of `*this` and `std::strlen(s)`.
|
596 |
|
@li **(18)** linear in the size of `*this` and `std::strlen(s)`.
|
| 597 |
|
@li **(22)** constant if `*this->storage() == *s.storage()`,
|
597 |
|
@li **(22)** constant if `*this->storage() == *s.storage()`,
|
| 598 |
|
otherwise linear in the size of `*this` and `s.size()`.
|
598 |
|
otherwise linear in the size of `*this` and `s.size()`.
|
| 599 |
|
@li **(21)** linear in the size of `*this` and `arr.size()`.
|
599 |
|
@li **(21)** linear in the size of `*this` and `arr.size()`.
|
| 600 |
|
@li **(22)** constant if `*this->storage() == *arr.storage()`,
|
600 |
|
@li **(22)** constant if `*this->storage() == *arr.storage()`,
|
| 601 |
|
otherwise linear in the size of `*this` and `arr.size()`.
|
601 |
|
otherwise linear in the size of `*this` and `arr.size()`.
|
| 602 |
|
@li **(23)** linear in the size of `*this` and `obj.size()`.
|
602 |
|
@li **(23)** linear in the size of `*this` and `obj.size()`.
|
| 603 |
|
@li **(24)** constant if `*this->storage() == *obj.storage()`,
|
603 |
|
@li **(24)** constant if `*this->storage() == *obj.storage()`,
|
| 604 |
|
otherwise linear in the size of `*this` and `obj.size()`.
|
604 |
|
otherwise linear in the size of `*this` and `obj.size()`.
|
| 605 |
|
|
605 |
|
|
| 606 |
|
The size of `*this` is either the size of the underlying container
|
606 |
|
The size of `*this` is either the size of the underlying container
|
| 607 |
|
(if there is one), or can be considered to be 1.
|
607 |
|
(if there is one), or can be considered to be 1.
|
| 608 |
|
|
608 |
|
|
| 609 |
|
|
609 |
|
|
| 610 |
|
@li **(1)**--**(3)**, **(17)**--**(24)** strong guarantee.
|
610 |
|
@li **(1)**--**(3)**, **(17)**--**(24)** strong guarantee.
|
| 611 |
|
@li **(4)**--**(16)** no-throw guarantee.
|
611 |
|
@li **(4)**--**(16)** no-throw guarantee.
|
| 612 |
|
|
612 |
|
|
| 613 |
|
Calls to `memory_resource::allocate` may throw.
|
613 |
|
Calls to `memory_resource::allocate` may throw.
|
| 614 |
|
|
614 |
|
|
| 615 |
|
@param other The source value.
|
615 |
|
@param other The source value.
|
| 616 |
|
|
616 |
|
|
| 617 |
|
|
617 |
|
|
| 618 |
|
|
618 |
|
|
| 619 |
|
|
619 |
|
|
| 620 |
|
|
620 |
|
|
| 621 |
|
operator=(value const& other);
|
621 |
|
operator=(value const& other);
|
| 622 |
|
|
622 |
|
|
| 623 |
|
|
623 |
|
|
| 624 |
|
|
624 |
|
|
| 625 |
|
The contents of the value are replaced with the
|
625 |
|
The contents of the value are replaced with the
|
| 626 |
|
contents of `other` using move semantics:
|
626 |
|
contents of `other` using move semantics:
|
| 627 |
|
|
627 |
|
|
| 628 |
|
@li If `*other.storage() == *sp`, ownership of
|
628 |
|
@li If `*other.storage() == *sp`, ownership of
|
| 629 |
|
the underlying memory is transferred in constant
|
629 |
|
the underlying memory is transferred in constant
|
| 630 |
|
time, with no possibility of exceptions.
|
630 |
|
time, with no possibility of exceptions.
|
| 631 |
|
After assignment, the moved-from value becomes
|
631 |
|
After assignment, the moved-from value becomes
|
| 632 |
|
a null with its current storage pointer.
|
632 |
|
a null with its current storage pointer.
|
| 633 |
|
|
633 |
|
|
| 634 |
|
@li If `*other.storage() != *sp`, an
|
634 |
|
@li If `*other.storage() != *sp`, an
|
| 635 |
|
element-wise copy is performed if
|
635 |
|
element-wise copy is performed if
|
| 636 |
|
`other.is_structured() == true`, which may throw.
|
636 |
|
`other.is_structured() == true`, which may throw.
|
| 637 |
|
In this case, the moved-from value is not
|
637 |
|
In this case, the moved-from value is not
|
| 638 |
|
|
638 |
|
|
| 639 |
|
|
639 |
|
|
| 640 |
|
|
640 |
|
|
| 641 |
|
|
641 |
|
|
| 642 |
|
operator=(value&& other);
|
642 |
|
operator=(value&& other);
|
| 643 |
|
|
643 |
|
|
| 644 |
|
|
644 |
|
|
| 645 |
|
|
645 |
|
|
| 646 |
|
@param init The initializer list to assign from.
|
646 |
|
@param init The initializer list to assign from.
|
| 647 |
|
|
647 |
|
|
| 648 |
|
|
648 |
|
|
| 649 |
|
|
649 |
|
|
| 650 |
|
|
650 |
|
|
| 651 |
|
std::initializer_list<value_ref> init);
|
651 |
|
std::initializer_list<value_ref> init);
|
| 652 |
|
|
652 |
|
|
| 653 |
|
|
653 |
|
|
| 654 |
|
|
654 |
|
|
| 655 |
|
operator=(std::nullptr_t) noexcept
|
655 |
|
operator=(std::nullptr_t) noexcept
|
| 656 |
|
|
656 |
|
|
| 657 |
|
|
657 |
|
|
| 658 |
|
|
658 |
|
|
| 659 |
|
sca_.k = json::kind::null;
|
659 |
|
sca_.k = json::kind::null;
|
| 660 |
|
|
660 |
|
|
| 661 |
|
|
661 |
|
|
| 662 |
|
|
662 |
|
|
| 663 |
|
|
663 |
|
|
| 664 |
|
|
664 |
|
|
| 665 |
|
|
665 |
|
|
| 666 |
|
|
666 |
|
|
| 667 |
|
|
667 |
|
|
| 668 |
|
|
668 |
|
|
| 669 |
|
|
669 |
|
|
| 670 |
|
|
670 |
|
|
| 671 |
|
|
671 |
|
|
| 672 |
|
|
672 |
|
|
| 673 |
|
|
673 |
|
|
| 674 |
|
value& operator=(bool b) noexcept;
|
674 |
|
value& operator=(bool b) noexcept;
|
| 675 |
|
|
675 |
|
|
| 676 |
|
|
676 |
|
|
| 677 |
|
,class = typename std::enable_if<
|
677 |
|
,class = typename std::enable_if<
|
| 678 |
|
std::is_same<T, bool>::value>::type
|
678 |
|
std::is_same<T, bool>::value>::type
|
| 679 |
|
|
679 |
|
|
| 680 |
|
value& operator=(T b) noexcept
|
680 |
|
value& operator=(T b) noexcept
|
| 681 |
|
|
681 |
|
|
| 682 |
|
|
682 |
|
|
| 683 |
|
|
683 |
|
|
| 684 |
|
|
684 |
|
|
| 685 |
|
sca_.k = json::kind::bool_;
|
685 |
|
sca_.k = json::kind::bool_;
|
| 686 |
|
|
686 |
|
|
| 687 |
|
|
687 |
|
|
| 688 |
|
|
688 |
|
|
| 689 |
|
|
689 |
|
|
| 690 |
|
|
690 |
|
|
| 691 |
|
|
691 |
|
|
| 692 |
|
|
692 |
|
|
| 693 |
|
|
693 |
|
|
| 694 |
|
|
694 |
|
|
| 695 |
|
|
695 |
|
|
| 696 |
|
|
696 |
|
|
| 697 |
|
|
697 |
|
|
| 698 |
|
|
698 |
|
|
| 699 |
|
|
699 |
|
|
| 700 |
|
value& operator=(signed char i) noexcept
|
700 |
|
value& operator=(signed char i) noexcept
|
| 701 |
|
|
701 |
|
|
| 702 |
|
|
702 |
|
|
| 703 |
|
static_cast<long long>(i));
|
703 |
|
static_cast<long long>(i));
|
| 704 |
|
|
704 |
|
|
| 705 |
|
|
705 |
|
|
| 706 |
|
|
706 |
|
|
| 707 |
|
value& operator=(short i) noexcept
|
707 |
|
value& operator=(short i) noexcept
|
| 708 |
|
|
708 |
|
|
| 709 |
|
|
709 |
|
|
| 710 |
|
static_cast<long long>(i));
|
710 |
|
static_cast<long long>(i));
|
| 711 |
|
|
711 |
|
|
| 712 |
|
|
712 |
|
|
| 713 |
|
|
713 |
|
|
| 714 |
|
value& operator=(int i) noexcept
|
714 |
|
value& operator=(int i) noexcept
|
| 715 |
|
|
715 |
|
|
| 716 |
|
|
716 |
|
|
| 717 |
|
static_cast<long long>(i));
|
717 |
|
static_cast<long long>(i));
|
| 718 |
|
|
718 |
|
|
| 719 |
|
|
719 |
|
|
| 720 |
|
|
720 |
|
|
| 721 |
|
value& operator=(long i) noexcept
|
721 |
|
value& operator=(long i) noexcept
|
| 722 |
|
|
722 |
|
|
| 723 |
|
|
723 |
|
|
| 724 |
|
static_cast<long long>(i));
|
724 |
|
static_cast<long long>(i));
|
| 725 |
|
|
725 |
|
|
| 726 |
|
|
726 |
|
|
| 727 |
|
|
727 |
|
|
| 728 |
|
value& operator=(long long i) noexcept
|
728 |
|
value& operator=(long long i) noexcept
|
| 729 |
|
|
729 |
|
|
| 730 |
|
|
730 |
|
|
| 731 |
|
|
731 |
|
|
| 732 |
|
|
732 |
|
|
| 733 |
|
sca_.k = json::kind::int64;
|
733 |
|
sca_.k = json::kind::int64;
|
| 734 |
|
|
734 |
|
|
| 735 |
|
|
735 |
|
|
| 736 |
|
|
736 |
|
|
| 737 |
|
::new(&sca_) scalar(static_cast<
|
737 |
|
::new(&sca_) scalar(static_cast<
|
| 738 |
|
std::int64_t>(i), destroy());
|
738 |
|
std::int64_t>(i), destroy());
|
| 739 |
|
|
739 |
|
|
| 740 |
|
|
740 |
|
|
| 741 |
|
|
741 |
|
|
| 742 |
|
|
742 |
|
|
| 743 |
|
|
743 |
|
|
| 744 |
|
|
744 |
|
|
| 745 |
|
|
745 |
|
|
| 746 |
|
|
746 |
|
|
| 747 |
|
value& operator=(unsigned char u) noexcept
|
747 |
|
value& operator=(unsigned char u) noexcept
|
| 748 |
|
|
748 |
|
|
| 749 |
|
return operator=(static_cast<
|
749 |
|
return operator=(static_cast<
|
| 750 |
|
|
750 |
|
|
| 751 |
|
|
751 |
|
|
| 752 |
|
|
752 |
|
|
| 753 |
|
|
753 |
|
|
| 754 |
|
value& operator=(unsigned short u) noexcept
|
754 |
|
value& operator=(unsigned short u) noexcept
|
| 755 |
|
|
755 |
|
|
| 756 |
|
return operator=(static_cast<
|
756 |
|
return operator=(static_cast<
|
| 757 |
|
|
757 |
|
|
| 758 |
|
|
758 |
|
|
| 759 |
|
|
759 |
|
|
| 760 |
|
|
760 |
|
|
| 761 |
|
value& operator=(unsigned int u) noexcept
|
761 |
|
value& operator=(unsigned int u) noexcept
|
| 762 |
|
|
762 |
|
|
| 763 |
|
return operator=(static_cast<
|
763 |
|
return operator=(static_cast<
|
| 764 |
|
|
764 |
|
|
| 765 |
|
|
765 |
|
|
| 766 |
|
|
766 |
|
|
| 767 |
|
|
767 |
|
|
| 768 |
|
value& operator=(unsigned long u) noexcept
|
768 |
|
value& operator=(unsigned long u) noexcept
|
| 769 |
|
|
769 |
|
|
| 770 |
|
return operator=(static_cast<
|
770 |
|
return operator=(static_cast<
|
| 771 |
|
|
771 |
|
|
| 772 |
|
|
772 |
|
|
| 773 |
|
|
773 |
|
|
| 774 |
|
|
774 |
|
|
| 775 |
|
value& operator=(unsigned long long u) noexcept
|
775 |
|
value& operator=(unsigned long long u) noexcept
|
| 776 |
|
|
776 |
|
|
| 777 |
|
|
777 |
|
|
| 778 |
|
|
778 |
|
|
| 779 |
|
|
779 |
|
|
| 780 |
|
sca_.k = json::kind::uint64;
|
780 |
|
sca_.k = json::kind::uint64;
|
| 781 |
|
|
781 |
|
|
| 782 |
|
|
782 |
|
|
| 783 |
|
|
783 |
|
|
| 784 |
|
::new(&sca_) scalar(static_cast<
|
784 |
|
::new(&sca_) scalar(static_cast<
|
| 785 |
|
std::uint64_t>(u), destroy());
|
785 |
|
std::uint64_t>(u), destroy());
|
| 786 |
|
|
786 |
|
|
| 787 |
|
|
787 |
|
|
| 788 |
|
|
788 |
|
|
| 789 |
|
|
789 |
|
|
| 790 |
|
|
790 |
|
|
| 791 |
|
|
791 |
|
|
| 792 |
|
|
792 |
|
|
| 793 |
|
|
793 |
|
|
| 794 |
|
value& operator=(double d) noexcept
|
794 |
|
value& operator=(double d) noexcept
|
| 795 |
|
|
795 |
|
|
| 796 |
|
|
796 |
|
|
| 797 |
|
|
797 |
|
|
| 798 |
|
|
798 |
|
|
| 799 |
|
sca_.k = json::kind::double_;
|
799 |
|
sca_.k = json::kind::double_;
|
| 800 |
|
|
800 |
|
|
| 801 |
|
|
801 |
|
|
| 802 |
|
|
802 |
|
|
| 803 |
|
|
803 |
|
|
| 804 |
|
|
804 |
|
|
| 805 |
|
|
805 |
|
|
| 806 |
|
|
806 |
|
|
| 807 |
|
|
807 |
|
|
| 808 |
|
|
808 |
|
|
| 809 |
|
|
809 |
|
|
| 810 |
|
|
810 |
|
|
| 811 |
|
|
811 |
|
|
| 812 |
|
|
812 |
|
|
| 813 |
|
|
813 |
|
|
| 814 |
|
value& operator=(string_view s);
|
814 |
|
value& operator=(string_view s);
|
| 815 |
|
|
815 |
|
|
| 816 |
|
|
816 |
|
|
| 817 |
|
|
817 |
|
|
| 818 |
|
value& operator=(char const* s);
|
818 |
|
value& operator=(char const* s);
|
| 819 |
|
|
819 |
|
|
| 820 |
|
|
820 |
|
|
| 821 |
|
|
821 |
|
|
| 822 |
|
value& operator=(string const& s);
|
822 |
|
value& operator=(string const& s);
|
| 823 |
|
|
823 |
|
|
| 824 |
|
|
824 |
|
|
| 825 |
|
|
825 |
|
|
| 826 |
|
The contents of the value are replaced with the
|
826 |
|
The contents of the value are replaced with the
|
| 827 |
|
contents of `s` using move semantics:
|
827 |
|
contents of `s` using move semantics:
|
| 828 |
|
|
828 |
|
|
| 829 |
|
@li If `*other.storage() == *this->storage()`,
|
829 |
|
@li If `*other.storage() == *this->storage()`,
|
| 830 |
|
ownership of the underlying memory is transferred
|
830 |
|
ownership of the underlying memory is transferred
|
| 831 |
|
in constant time, with no possibility of exceptions.
|
831 |
|
in constant time, with no possibility of exceptions.
|
| 832 |
|
After assignment, the moved-from string becomes
|
832 |
|
After assignment, the moved-from string becomes
|
| 833 |
|
empty with its current storage pointer.
|
833 |
|
empty with its current storage pointer.
|
| 834 |
|
|
834 |
|
|
| 835 |
|
@li If `*other.storage() != *this->storage()`, an
|
835 |
|
@li If `*other.storage() != *this->storage()`, an
|
| 836 |
|
element-wise copy is performed, which may throw.
|
836 |
|
element-wise copy is performed, which may throw.
|
| 837 |
|
In this case, the moved-from string is not
|
837 |
|
In this case, the moved-from string is not
|
| 838 |
|
|
838 |
|
|
| 839 |
|
|
839 |
|
|
| 840 |
|
@param s The string to move-assign from.
|
840 |
|
@param s The string to move-assign from.
|
| 841 |
|
|
841 |
|
|
| 842 |
|
|
842 |
|
|
| 843 |
|
value& operator=(string&& s);
|
843 |
|
value& operator=(string&& s);
|
| 844 |
|
|
844 |
|
|
| 845 |
|
|
845 |
|
|
| 846 |
|
|
846 |
|
|
| 847 |
|
Replace `*this` with a copy of the array `arr`.
|
847 |
|
Replace `*this` with a copy of the array `arr`.
|
| 848 |
|
|
848 |
|
|
| 849 |
|
|
849 |
|
|
| 850 |
|
|
850 |
|
|
| 851 |
|
Calls to `memory_resource::allocate` may throw.
|
851 |
|
Calls to `memory_resource::allocate` may throw.
|
| 852 |
|
|
852 |
|
|
| 853 |
|
|
853 |
|
|
| 854 |
|
Linear in the sum of sizes of `*this` and `arr`
|
854 |
|
Linear in the sum of sizes of `*this` and `arr`
|
| 855 |
|
|
855 |
|
|
| 856 |
|
@param arr The new array.
|
856 |
|
@param arr The new array.
|
| 857 |
|
|
857 |
|
|
| 858 |
|
|
858 |
|
|
| 859 |
|
value& operator=(array const& arr);
|
859 |
|
value& operator=(array const& arr);
|
| 860 |
|
|
860 |
|
|
| 861 |
|
|
861 |
|
|
| 862 |
|
|
862 |
|
|
| 863 |
|
The contents of the value are replaced with the
|
863 |
|
The contents of the value are replaced with the
|
| 864 |
|
contents of `arr` using move semantics:
|
864 |
|
contents of `arr` using move semantics:
|
| 865 |
|
|
865 |
|
|
| 866 |
|
@li If `*arr.storage() == *this->storage()`,
|
866 |
|
@li If `*arr.storage() == *this->storage()`,
|
| 867 |
|
ownership of the underlying memory is transferred
|
867 |
|
ownership of the underlying memory is transferred
|
| 868 |
|
in constant time, with no possibility of exceptions.
|
868 |
|
in constant time, with no possibility of exceptions.
|
| 869 |
|
After assignment, the moved-from array becomes
|
869 |
|
After assignment, the moved-from array becomes
|
| 870 |
|
empty with its current storage pointer.
|
870 |
|
empty with its current storage pointer.
|
| 871 |
|
|
871 |
|
|
| 872 |
|
@li If `*arr.storage() != *this->storage()`, an
|
872 |
|
@li If `*arr.storage() != *this->storage()`, an
|
| 873 |
|
element-wise copy is performed, which may throw.
|
873 |
|
element-wise copy is performed, which may throw.
|
| 874 |
|
In this case, the moved-from array is not
|
874 |
|
In this case, the moved-from array is not
|
| 875 |
|
|
875 |
|
|
| 876 |
|
|
876 |
|
|
| 877 |
|
|
877 |
|
|
| 878 |
|
Constant, or linear in the size of `*this` plus `arr.size()`.
|
878 |
|
Constant, or linear in the size of `*this` plus `arr.size()`.
|
| 879 |
|
|
879 |
|
|
| 880 |
|
|
880 |
|
|
| 881 |
|
|
881 |
|
|
| 882 |
|
Calls to `memory_resource::allocate` may throw.
|
882 |
|
Calls to `memory_resource::allocate` may throw.
|
| 883 |
|
|
883 |
|
|
| 884 |
|
@param arr The array to move-assign from.
|
884 |
|
@param arr The array to move-assign from.
|
| 885 |
|
|
885 |
|
|
| 886 |
|
|
886 |
|
|
| 887 |
|
value& operator=(array&& arr);
|
887 |
|
value& operator=(array&& arr);
|
| 888 |
|
|
888 |
|
|
| 889 |
|
|
889 |
|
|
| 890 |
|
|
890 |
|
|
| 891 |
|
Replace `*this` with a copy of the obect `obj`.
|
891 |
|
Replace `*this` with a copy of the obect `obj`.
|
| 892 |
|
|
892 |
|
|
| 893 |
|
|
893 |
|
|
| 894 |
|
|
894 |
|
|
| 895 |
|
Calls to `memory_resource::allocate` may throw.
|
895 |
|
Calls to `memory_resource::allocate` may throw.
|
| 896 |
|
|
896 |
|
|
| 897 |
|
|
897 |
|
|
| 898 |
|
Linear in the sum of sizes of `*this` and `obj`
|
898 |
|
Linear in the sum of sizes of `*this` and `obj`
|
| 899 |
|
|
899 |
|
|
| 900 |
|
@param obj The new object.
|
900 |
|
@param obj The new object.
|
| 901 |
|
|
901 |
|
|
| 902 |
|
|
902 |
|
|
| 903 |
|
value& operator=(object const& obj);
|
903 |
|
value& operator=(object const& obj);
|
| 904 |
|
|
904 |
|
|
| 905 |
|
|
905 |
|
|
| 906 |
|
|
906 |
|
|
| 907 |
|
The contents of the value are replaced with the
|
907 |
|
The contents of the value are replaced with the
|
| 908 |
|
contents of `obj` using move semantics:
|
908 |
|
contents of `obj` using move semantics:
|
| 909 |
|
|
909 |
|
|
| 910 |
|
@li If `*obj.storage() == *this->storage()`,
|
910 |
|
@li If `*obj.storage() == *this->storage()`,
|
| 911 |
|
ownership of the underlying memory is transferred
|
911 |
|
ownership of the underlying memory is transferred
|
| 912 |
|
in constant time, with no possibility of exceptions.
|
912 |
|
in constant time, with no possibility of exceptions.
|
| 913 |
|
After assignment, the moved-from object becomes
|
913 |
|
After assignment, the moved-from object becomes
|
| 914 |
|
empty with its current storage pointer.
|
914 |
|
empty with its current storage pointer.
|
| 915 |
|
|
915 |
|
|
| 916 |
|
@li If `*obj.storage() != *this->storage()`, an
|
916 |
|
@li If `*obj.storage() != *this->storage()`, an
|
| 917 |
|
element-wise copy is performed, which may throw.
|
917 |
|
element-wise copy is performed, which may throw.
|
| 918 |
|
In this case, the moved-from object is not
|
918 |
|
In this case, the moved-from object is not
|
| 919 |
|
|
919 |
|
|
| 920 |
|
|
920 |
|
|
| 921 |
|
|
921 |
|
|
| 922 |
|
Constant, or linear in the size of `*this` plus `obj.size()`.
|
922 |
|
Constant, or linear in the size of `*this` plus `obj.size()`.
|
| 923 |
|
|
923 |
|
|
| 924 |
|
|
924 |
|
|
| 925 |
|
|
925 |
|
|
| 926 |
|
Calls to `memory_resource::allocate` may throw.
|
926 |
|
Calls to `memory_resource::allocate` may throw.
|
| 927 |
|
|
927 |
|
|
| 928 |
|
@param obj The object to move-assign from.
|
928 |
|
@param obj The object to move-assign from.
|
| 929 |
|
|
929 |
|
|
| 930 |
|
|
930 |
|
|
| 931 |
|
value& operator=(object&& obj);
|
931 |
|
value& operator=(object&& obj);
|
| 932 |
|
|
932 |
|
|
| 933 |
|
|
933 |
|
|
| 934 |
|
//------------------------------------------------------
|
934 |
|
//------------------------------------------------------
|
| 935 |
|
|
935 |
|
|
| 936 |
|
|
936 |
|
|
| 937 |
|
|
937 |
|
|
| 938 |
|
//------------------------------------------------------
|
938 |
|
//------------------------------------------------------
|
| 939 |
|
|
939 |
|
|
| 940 |
|
/** Replace with a null value.
|
940 |
|
/** Replace with a null value.
|
| 941 |
|
|
941 |
|
|
| 942 |
|
The current value is destroyed and the kind is changed to kind::null.
|
942 |
|
The current value is destroyed and the kind is changed to kind::null.
|
| 943 |
|
The associated memeory resource is kept unchanged.
|
943 |
|
The associated memeory resource is kept unchanged.
|
| 944 |
|
|
944 |
|
|
| 945 |
|
|
945 |
|
|
| 946 |
|
Linear in the size of `*this`.
|
946 |
|
Linear in the size of `*this`.
|
| 947 |
|
|
947 |
|
|
| 948 |
|
|
948 |
|
|
| 949 |
|
|
949 |
|
|
| 950 |
|
|
950 |
|
|
| 951 |
|
|
951 |
|
|
| 952 |
|
|
952 |
|
|
| 953 |
|
|
953 |
|
|
| 954 |
|
|
954 |
|
|
| 955 |
|
|
955 |
|
|
| 956 |
|
|
956 |
|
|
| 957 |
|
/** Replace with a `bool` value.
|
957 |
|
/** Replace with a `bool` value.
|
| 958 |
|
|
958 |
|
|
| 959 |
|
The value is replaced with a `bool` initialized to `false`, destroying
|
959 |
|
The value is replaced with a `bool` initialized to `false`, destroying
|
| 960 |
|
the previous contents, but keeping the memeory resource.
|
960 |
|
the previous contents, but keeping the memeory resource.
|
| 961 |
|
|
961 |
|
|
| 962 |
|
|
962 |
|
|
| 963 |
|
Linear in the size of `*this`.
|
963 |
|
Linear in the size of `*this`.
|
| 964 |
|
|
964 |
|
|
| 965 |
|
|
965 |
|
|
| 966 |
|
|
966 |
|
|
| 967 |
|
|
967 |
|
|
| 968 |
|
@return `this->get_bool()`.
|
968 |
|
@return `this->get_bool()`.
|
| 969 |
|
|
969 |
|
|
| 970 |
|
|
970 |
|
|
| 971 |
|
|
971 |
|
|
| 972 |
|
|
972 |
|
|
| 973 |
|
|
973 |
|
|
| 974 |
|
|
974 |
|
|
| 975 |
|
|
975 |
|
|
| 976 |
|
|
976 |
|
|
| 977 |
|
/** Replace with a `std::int64_t` value.
|
977 |
|
/** Replace with a `std::int64_t` value.
|
| 978 |
|
|
978 |
|
|
| 979 |
|
The value is replaced with a `std::int64_t` initialized to zero,
|
979 |
|
The value is replaced with a `std::int64_t` initialized to zero,
|
| 980 |
|
destroying the previous contents, but keeping the memeory resource.
|
980 |
|
destroying the previous contents, but keeping the memeory resource.
|
| 981 |
|
|
981 |
|
|
| 982 |
|
|
982 |
|
|
| 983 |
|
Linear in the size of `*this`.
|
983 |
|
Linear in the size of `*this`.
|
| 984 |
|
|
984 |
|
|
| 985 |
|
|
985 |
|
|
| 986 |
|
|
986 |
|
|
| 987 |
|
|
987 |
|
|
| 988 |
|
@return `this->get_int64()`.
|
988 |
|
@return `this->get_int64()`.
|
| 989 |
|
|
989 |
|
|
| 990 |
|
|
990 |
|
|
| 991 |
|
|
991 |
|
|
| 992 |
|
|
992 |
|
|
| 993 |
|
|
993 |
|
|
| 994 |
|
|
994 |
|
|
| 995 |
|
|
995 |
|
|
| 996 |
|
|
996 |
|
|
| 997 |
|
/** Replace with a `std::uint64_t` value.
|
997 |
|
/** Replace with a `std::uint64_t` value.
|
| 998 |
|
|
998 |
|
|
| 999 |
|
The value is replaced with a `std::uint64_t` initialized to zero,
|
999 |
|
The value is replaced with a `std::uint64_t` initialized to zero,
|
| 1000 |
|
destroying the the previous contents, but keeping the memeory resource.
|
1000 |
|
destroying the the previous contents, but keeping the memeory resource.
|
| 1001 |
|
|
1001 |
|
|
| 1002 |
|
|
1002 |
|
|
| 1003 |
|
Linear in the size of `*this`.
|
1003 |
|
Linear in the size of `*this`.
|
| 1004 |
|
|
1004 |
|
|
| 1005 |
|
|
1005 |
|
|
| 1006 |
|
|
1006 |
|
|
| 1007 |
|
|
1007 |
|
|
| 1008 |
|
@return `this->get_uint64()`.
|
1008 |
|
@return `this->get_uint64()`.
|
| 1009 |
|
|
1009 |
|
|
| 1010 |
|
|
1010 |
|
|
| 1011 |
|
emplace_uint64() noexcept
|
1011 |
|
emplace_uint64() noexcept
|
| 1012 |
|
|
1012 |
|
|
| 1013 |
|
|
1013 |
|
|
| 1014 |
|
|
1014 |
|
|
| 1015 |
|
|
1015 |
|
|
| 1016 |
|
|
1016 |
|
|
| 1017 |
|
/** Replace with a `double` value.
|
1017 |
|
/** Replace with a `double` value.
|
| 1018 |
|
|
1018 |
|
|
| 1019 |
|
The value is replaced with a `double` initialized to zero, destroying
|
1019 |
|
The value is replaced with a `double` initialized to zero, destroying
|
| 1020 |
|
the previous contents, but keeping the memeory resource.
|
1020 |
|
the previous contents, but keeping the memeory resource.
|
| 1021 |
|
|
1021 |
|
|
| 1022 |
|
|
1022 |
|
|
| 1023 |
|
Linear in the size of `*this`.
|
1023 |
|
Linear in the size of `*this`.
|
| 1024 |
|
|
1024 |
|
|
| 1025 |
|
|
1025 |
|
|
| 1026 |
|
|
1026 |
|
|
| 1027 |
|
|
1027 |
|
|
| 1028 |
|
@return `this->get_double()`.
|
1028 |
|
@return `this->get_double()`.
|
| 1029 |
|
|
1029 |
|
|
| 1030 |
|
|
1030 |
|
|
| 1031 |
|
emplace_double() noexcept
|
1031 |
|
emplace_double() noexcept
|
| 1032 |
|
|
1032 |
|
|
| 1033 |
|
|
1033 |
|
|
| 1034 |
|
|
1034 |
|
|
| 1035 |
|
|
1035 |
|
|
| 1036 |
|
|
1036 |
|
|
| 1037 |
|
/** Replace with an empty @ref string.
|
1037 |
|
/** Replace with an empty @ref string.
|
| 1038 |
|
|
1038 |
|
|
| 1039 |
|
The value is replaced with an empty @ref string using the current
|
1039 |
|
The value is replaced with an empty @ref string using the current
|
| 1040 |
|
memory resource, destroying the previous contents. All previously
|
1040 |
|
memory resource, destroying the previous contents. All previously
|
| 1041 |
|
obtained iterators and references obtained beforehand are invalidated.
|
1041 |
|
obtained iterators and references obtained beforehand are invalidated.
|
| 1042 |
|
|
1042 |
|
|
| 1043 |
|
|
1043 |
|
|
| 1044 |
|
Linear in the size of `*this`.
|
1044 |
|
Linear in the size of `*this`.
|
| 1045 |
|
|
1045 |
|
|
| 1046 |
|
|
1046 |
|
|
| 1047 |
|
|
1047 |
|
|
| 1048 |
|
|
1048 |
|
|
| 1049 |
|
@return `this->get_string()`.
|
1049 |
|
@return `this->get_string()`.
|
| 1050 |
|
|
1050 |
|
|
| 1051 |
|
|
1051 |
|
|
| 1052 |
|
|
1052 |
|
|
| 1053 |
|
emplace_string() noexcept;
|
1053 |
|
emplace_string() noexcept;
|
| 1054 |
|
|
1054 |
|
|
| 1055 |
|
/** Replace with an empty array.
|
1055 |
|
/** Replace with an empty array.
|
| 1056 |
|
|
1056 |
|
|
| 1057 |
|
The value is replaced with an empty @ref array using the current memory
|
1057 |
|
The value is replaced with an empty @ref array using the current memory
|
| 1058 |
|
resource, destroying the previous contents. All previously obtained
|
1058 |
|
resource, destroying the previous contents. All previously obtained
|
| 1059 |
|
iterators and references obtained beforehand are invalidated.
|
1059 |
|
iterators and references obtained beforehand are invalidated.
|
| 1060 |
|
|
1060 |
|
|
| 1061 |
|
|
1061 |
|
|
| 1062 |
|
Linear in the size of `*this`.
|
1062 |
|
Linear in the size of `*this`.
|
| 1063 |
|
|
1063 |
|
|
| 1064 |
|
|
1064 |
|
|
| 1065 |
|
|
1065 |
|
|
| 1066 |
|
|
1066 |
|
|
| 1067 |
|
@return `this->get_array()`.
|
1067 |
|
@return `this->get_array()`.
|
| 1068 |
|
|
1068 |
|
|
| 1069 |
|
|
1069 |
|
|
| 1070 |
|
|
1070 |
|
|
| 1071 |
|
emplace_array() noexcept;
|
1071 |
|
emplace_array() noexcept;
|
| 1072 |
|
|
1072 |
|
|
| 1073 |
|
/** Replace with an empty @ref object.
|
1073 |
|
/** Replace with an empty @ref object.
|
| 1074 |
|
|
1074 |
|
|
| 1075 |
|
The value is replaced with an empty @ref array using the current memory
|
1075 |
|
The value is replaced with an empty @ref array using the current memory
|
| 1076 |
|
resource, destroying the previous contents. All previously obtained
|
1076 |
|
resource, destroying the previous contents. All previously obtained
|
| 1077 |
|
iterators and references obtained beforehand are invalidated.
|
1077 |
|
iterators and references obtained beforehand are invalidated.
|
| 1078 |
|
|
1078 |
|
|
| 1079 |
|
|
1079 |
|
|
| 1080 |
|
Linear in the size of `*this`.
|
1080 |
|
Linear in the size of `*this`.
|
| 1081 |
|
|
1081 |
|
|
| 1082 |
|
|
1082 |
|
|
| 1083 |
|
|
1083 |
|
|
| 1084 |
|
|
1084 |
|
|
| 1085 |
|
@return `this->get_object()`.
|
1085 |
|
@return `this->get_object()`.
|
| 1086 |
|
|
1086 |
|
|
| 1087 |
|
|
1087 |
|
|
| 1088 |
|
|
1088 |
|
|
| 1089 |
|
emplace_object() noexcept;
|
1089 |
|
emplace_object() noexcept;
|
| 1090 |
|
|
1090 |
|
|
| 1091 |
|
/** Swap the given values.
|
1091 |
|
/** Swap the given values.
|
| 1092 |
|
|
1092 |
|
|
| 1093 |
|
Exchanges the contents of this value with another value. Ownership of
|
1093 |
|
Exchanges the contents of this value with another value. Ownership of
|
| 1094 |
|
the respective @ref boost::container::pmr::memory_resource objects is
|
1094 |
|
the respective @ref boost::container::pmr::memory_resource objects is
|
| 1095 |
|
|
1095 |
|
|
| 1096 |
|
|
1096 |
|
|
| 1097 |
|
@li If `this == &other`, this function has no effect.
|
1097 |
|
@li If `this == &other`, this function has no effect.
|
| 1098 |
|
@li If `*other.storage() == *this->storage()`, ownership of the
|
1098 |
|
@li If `*other.storage() == *this->storage()`, ownership of the
|
| 1099 |
|
underlying memory is swapped in constant time, with no possibility
|
1099 |
|
underlying memory is swapped in constant time, with no possibility
|
| 1100 |
|
of exceptions. All iterators and references remain valid.
|
1100 |
|
of exceptions. All iterators and references remain valid.
|
| 1101 |
|
@li If `*other.storage() != *this->storage()`, the contents are
|
1101 |
|
@li If `*other.storage() != *this->storage()`, the contents are
|
| 1102 |
|
logically swapped by making copies, which can throw. In this case
|
1102 |
|
logically swapped by making copies, which can throw. In this case
|
| 1103 |
|
all iterators and references are invalidated.
|
1103 |
|
all iterators and references are invalidated.
|
| 1104 |
|
|
1104 |
|
|
| 1105 |
|
|
1105 |
|
|
| 1106 |
|
Constant or linear in the sum of the sizes of the values.
|
1106 |
|
Constant or linear in the sum of the sizes of the values.
|
| 1107 |
|
|
1107 |
|
|
| 1108 |
|
|
1108 |
|
|
| 1109 |
|
Strong guarantee. Calls to `memory_resource::allocate` may throw.
|
1109 |
|
Strong guarantee. Calls to `memory_resource::allocate` may throw.
|
| 1110 |
|
|
1110 |
|
|
| 1111 |
|
@param other The value to swap with.
|
1111 |
|
@param other The value to swap with.
|
| 1112 |
|
|
1112 |
|
|
| 1113 |
|
|
1113 |
|
|
| 1114 |
|
|
1114 |
|
|
| 1115 |
|
|
1115 |
|
|
| 1116 |
|
|
1116 |
|
|
| 1117 |
|
/** Swap the given values.
|
1117 |
|
/** Swap the given values.
|
| 1118 |
|
|
1118 |
|
|
| 1119 |
|
Exchanges the contents of value `lhs` with another value `rhs`.
|
1119 |
|
Exchanges the contents of value `lhs` with another value `rhs`.
|
| 1120 |
|
Ownership of the respective @ref boost::container::pmr::memory_resource
|
1120 |
|
Ownership of the respective @ref boost::container::pmr::memory_resource
|
| 1121 |
|
objects is not transferred.
|
1121 |
|
objects is not transferred.
|
| 1122 |
|
|
1122 |
|
|
| 1123 |
|
@li If `&lhs == &rhs`, this function call has no effect.
|
1123 |
|
@li If `&lhs == &rhs`, this function call has no effect.
|
| 1124 |
|
@li If `*lhs.storage() == *rhs.storage()`, ownership of the underlying
|
1124 |
|
@li If `*lhs.storage() == *rhs.storage()`, ownership of the underlying
|
| 1125 |
|
memory is swapped in constant time, with no possibility of
|
1125 |
|
memory is swapped in constant time, with no possibility of
|
| 1126 |
|
exceptions. All iterators and references remain valid.
|
1126 |
|
exceptions. All iterators and references remain valid.
|
| 1127 |
|
@li If `*lhs.storage() != *rhs.storage`, the contents are logically
|
1127 |
|
@li If `*lhs.storage() != *rhs.storage`, the contents are logically
|
| 1128 |
|
swapped by a copy, which can throw. In this case all iterators and
|
1128 |
|
swapped by a copy, which can throw. In this case all iterators and
|
| 1129 |
|
references are invalidated.
|
1129 |
|
references are invalidated.
|
| 1130 |
|
|
1130 |
|
|
| 1131 |
|
|
1131 |
|
|
| 1132 |
|
Constant or linear in the sum of the sizes of the values.
|
1132 |
|
Constant or linear in the sum of the sizes of the values.
|
| 1133 |
|
|
1133 |
|
|
| 1134 |
|
|
1134 |
|
|
| 1135 |
|
Strong guarantee. Calls to `memory_resource::allocate` may throw.
|
1135 |
|
Strong guarantee. Calls to `memory_resource::allocate` may throw.
|
| 1136 |
|
|
1136 |
|
|
| 1137 |
|
@param lhs The value to exchange.
|
1137 |
|
@param lhs The value to exchange.
|
| 1138 |
|
@param rhs The value to exchange.
|
1138 |
|
@param rhs The value to exchange.
|
| 1139 |
|
|
1139 |
|
|
| 1140 |
|
|
1140 |
|
|
| 1141 |
|
|
1141 |
|
|
| 1142 |
|
|
1142 |
|
|
| 1143 |
|
|
1143 |
|
|
| 1144 |
|
swap(value& lhs, value& rhs)
|
1144 |
|
swap(value& lhs, value& rhs)
|
| 1145 |
|
|
1145 |
|
|
| 1146 |
|
|
1146 |
|
|
| 1147 |
|
|
1147 |
|
|
| 1148 |
|
|
1148 |
|
|
| 1149 |
|
//------------------------------------------------------
|
1149 |
|
//------------------------------------------------------
|
| 1150 |
|
|
1150 |
|
|
| 1151 |
|
|
1151 |
|
|
| 1152 |
|
|
1152 |
|
|
| 1153 |
|
//------------------------------------------------------
|
1153 |
|
//------------------------------------------------------
|
| 1154 |
|
|
1154 |
|
|
| 1155 |
|
/** Returns the kind of this JSON value.
|
1155 |
|
/** Returns the kind of this JSON value.
|
| 1156 |
|
|
1156 |
|
|
| 1157 |
|
This function returns the discriminating enumeration constant of type
|
1157 |
|
This function returns the discriminating enumeration constant of type
|
| 1158 |
|
@ref json::kind corresponding to the underlying representation stored
|
1158 |
|
@ref json::kind corresponding to the underlying representation stored
|
| 1159 |
|
|
1159 |
|
|
| 1160 |
|
|
1160 |
|
|
| 1161 |
|
|
1161 |
|
|
| 1162 |
|
|
1162 |
|
|
| 1163 |
|
|
1163 |
|
|
| 1164 |
|
|
1164 |
|
|
| 1165 |
|
|
1165 |
|
|
| 1166 |
|
|
1166 |
|
|
| 1167 |
|
|
1167 |
|
|
| 1168 |
|
|
1168 |
|
|
| 1169 |
|
|
1169 |
|
|
| 1170 |
|
return static_cast<json::kind>(
|
1170 |
|
return static_cast<json::kind>(
|
| 1171 |
|
static_cast<unsigned char>(
|
1171 |
|
static_cast<unsigned char>(
|
| 1172 |
|
|
1172 |
|
|
| 1173 |
|
|
1173 |
|
|
| 1174 |
|
|
1174 |
|
|
| 1175 |
|
/** Check if this is an @ref array.
|
1175 |
|
/** Check if this is an @ref array.
|
| 1176 |
|
|
1176 |
|
|
| 1177 |
|
Returns `true` if the value's @ref kind() is `kind::array`.
|
1177 |
|
Returns `true` if the value's @ref kind() is `kind::array`.
|
| 1178 |
|
|
1178 |
|
|
| 1179 |
|
@returns `this->kind() == kind::array`.
|
1179 |
|
@returns `this->kind() == kind::array`.
|
| 1180 |
|
|
1180 |
|
|
| 1181 |
|
|
1181 |
|
|
| 1182 |
|
|
1182 |
|
|
| 1183 |
|
|
1183 |
|
|
| 1184 |
|
|
1184 |
|
|
| 1185 |
|
|
1185 |
|
|
| 1186 |
|
|
1186 |
|
|
| 1187 |
|
|
1187 |
|
|
| 1188 |
|
is_array() const noexcept
|
1188 |
|
is_array() const noexcept
|
| 1189 |
|
|
1189 |
|
|
| 1190 |
|
return kind() == json::kind::array;
|
1190 |
|
return kind() == json::kind::array;
|
| 1191 |
|
|
1191 |
|
|
| 1192 |
|
|
1192 |
|
|
| 1193 |
|
/** Check if this is an @ref object.
|
1193 |
|
/** Check if this is an @ref object.
|
| 1194 |
|
|
1194 |
|
|
| 1195 |
|
Returns `true` if the value's @ref kind() is `kind::object`.
|
1195 |
|
Returns `true` if the value's @ref kind() is `kind::object`.
|
| 1196 |
|
|
1196 |
|
|
| 1197 |
|
@returns `this->kind() == kind::object`.
|
1197 |
|
@returns `this->kind() == kind::object`.
|
| 1198 |
|
|
1198 |
|
|
| 1199 |
|
|
1199 |
|
|
| 1200 |
|
|
1200 |
|
|
| 1201 |
|
|
1201 |
|
|
| 1202 |
|
|
1202 |
|
|
| 1203 |
|
|
1203 |
|
|
| 1204 |
|
|
1204 |
|
|
| 1205 |
|
|
1205 |
|
|
| 1206 |
|
is_object() const noexcept
|
1206 |
|
is_object() const noexcept
|
| 1207 |
|
|
1207 |
|
|
| 1208 |
|
return kind() == json::kind::object;
|
1208 |
|
return kind() == json::kind::object;
|
| 1209 |
|
|
1209 |
|
|
| 1210 |
|
|
1210 |
|
|
| 1211 |
|
/** Check if this is a @ref string.
|
1211 |
|
/** Check if this is a @ref string.
|
| 1212 |
|
|
1212 |
|
|
| 1213 |
|
Returns `true` if the value's @ref kind() is `kind::string`.
|
1213 |
|
Returns `true` if the value's @ref kind() is `kind::string`.
|
| 1214 |
|
|
1214 |
|
|
| 1215 |
|
@returns `this->kind() == kind::string`.
|
1215 |
|
@returns `this->kind() == kind::string`.
|
| 1216 |
|
|
1216 |
|
|
| 1217 |
|
|
1217 |
|
|
| 1218 |
|
|
1218 |
|
|
| 1219 |
|
|
1219 |
|
|
| 1220 |
|
|
1220 |
|
|
| 1221 |
|
|
1221 |
|
|
| 1222 |
|
|
1222 |
|
|
| 1223 |
|
|
1223 |
|
|
| 1224 |
|
is_string() const noexcept
|
1224 |
|
is_string() const noexcept
|
| 1225 |
|
|
1225 |
|
|
| 1226 |
|
return kind() == json::kind::string;
|
1226 |
|
return kind() == json::kind::string;
|
| 1227 |
|
|
1227 |
|
|
| 1228 |
|
|
1228 |
|
|
| 1229 |
|
/** Check if this is a `std::int64_t`.
|
1229 |
|
/** Check if this is a `std::int64_t`.
|
| 1230 |
|
|
1230 |
|
|
| 1231 |
|
Returns `true` if the value's @ref kind() is `kind::int64`.
|
1231 |
|
Returns `true` if the value's @ref kind() is `kind::int64`.
|
| 1232 |
|
|
1232 |
|
|
| 1233 |
|
@returns `this->kind() == kind::int64`.
|
1233 |
|
@returns `this->kind() == kind::int64`.
|
| 1234 |
|
|
1234 |
|
|
| 1235 |
|
|
1235 |
|
|
| 1236 |
|
|
1236 |
|
|
| 1237 |
|
|
1237 |
|
|
| 1238 |
|
|
1238 |
|
|
| 1239 |
|
|
1239 |
|
|
| 1240 |
|
|
1240 |
|
|
| 1241 |
|
|
1241 |
|
|
| 1242 |
|
is_int64() const noexcept
|
1242 |
|
is_int64() const noexcept
|
| 1243 |
|
|
1243 |
|
|
| 1244 |
|
return kind() == json::kind::int64;
|
1244 |
|
return kind() == json::kind::int64;
|
| 1245 |
|
|
1245 |
|
|
| 1246 |
|
|
1246 |
|
|
| 1247 |
|
/** Checks if this is a `std::uint64_t`.
|
1247 |
|
/** Checks if this is a `std::uint64_t`.
|
| 1248 |
|
|
1248 |
|
|
| 1249 |
|
Returns `true` if the value's @ref kind() is `kind::uint64`.
|
1249 |
|
Returns `true` if the value's @ref kind() is `kind::uint64`.
|
| 1250 |
|
|
1250 |
|
|
| 1251 |
|
@returns `this->kind() == kind::uint64`.
|
1251 |
|
@returns `this->kind() == kind::uint64`.
|
| 1252 |
|
|
1252 |
|
|
| 1253 |
|
|
1253 |
|
|
| 1254 |
|
|
1254 |
|
|
| 1255 |
|
|
1255 |
|
|
| 1256 |
|
|
1256 |
|
|
| 1257 |
|
|
1257 |
|
|
| 1258 |
|
|
1258 |
|
|
| 1259 |
|
|
1259 |
|
|
| 1260 |
|
is_uint64() const noexcept
|
1260 |
|
is_uint64() const noexcept
|
| 1261 |
|
|
1261 |
|
|
| 1262 |
|
return kind() == json::kind::uint64;
|
1262 |
|
return kind() == json::kind::uint64;
|
| 1263 |
|
|
1263 |
|
|
| 1264 |
|
|
1264 |
|
|
| 1265 |
|
/** Check if this is a `double`.
|
1265 |
|
/** Check if this is a `double`.
|
| 1266 |
|
|
1266 |
|
|
| 1267 |
|
Returns `true` if the value's @ref kind() is `kind::double_`.
|
1267 |
|
Returns `true` if the value's @ref kind() is `kind::double_`.
|
| 1268 |
|
|
1268 |
|
|
| 1269 |
|
@returns `this->kind() == kind::double_`.
|
1269 |
|
@returns `this->kind() == kind::double_`.
|
| 1270 |
|
|
1270 |
|
|
| 1271 |
|
|
1271 |
|
|
| 1272 |
|
|
1272 |
|
|
| 1273 |
|
|
1273 |
|
|
| 1274 |
|
|
1274 |
|
|
| 1275 |
|
|
1275 |
|
|
| 1276 |
|
|
1276 |
|
|
| 1277 |
|
|
1277 |
|
|
| 1278 |
|
is_double() const noexcept
|
1278 |
|
is_double() const noexcept
|
| 1279 |
|
|
1279 |
|
|
| 1280 |
|
return kind() == json::kind::double_;
|
1280 |
|
return kind() == json::kind::double_;
|
| 1281 |
|
|
1281 |
|
|
| 1282 |
|
|
1282 |
|
|
| 1283 |
|
/** Check if this is a `bool`.
|
1283 |
|
/** Check if this is a `bool`.
|
| 1284 |
|
|
1284 |
|
|
| 1285 |
|
Returns `true` if the value's @ref kind() is `kind::bool_`.
|
1285 |
|
Returns `true` if the value's @ref kind() is `kind::bool_`.
|
| 1286 |
|
|
1286 |
|
|
| 1287 |
|
@returns `this->kind() == kind::bool_`.
|
1287 |
|
@returns `this->kind() == kind::bool_`.
|
| 1288 |
|
|
1288 |
|
|
| 1289 |
|
|
1289 |
|
|
| 1290 |
|
|
1290 |
|
|
| 1291 |
|
|
1291 |
|
|
| 1292 |
|
|
1292 |
|
|
| 1293 |
|
|
1293 |
|
|
| 1294 |
|
|
1294 |
|
|
| 1295 |
|
|
1295 |
|
|
| 1296 |
|
|
1296 |
|
|
| 1297 |
|
|
1297 |
|
|
| 1298 |
|
return kind() == json::kind::bool_;
|
1298 |
|
return kind() == json::kind::bool_;
|
| 1299 |
|
|
1299 |
|
|
| 1300 |
|
|
1300 |
|
|
| 1301 |
|
/** Check if this is a null value.
|
1301 |
|
/** Check if this is a null value.
|
| 1302 |
|
|
1302 |
|
|
| 1303 |
|
Returns `true` if the value's @ref kind() is `kind::null`.
|
1303 |
|
Returns `true` if the value's @ref kind() is `kind::null`.
|
| 1304 |
|
|
1304 |
|
|
| 1305 |
|
@returns `this->kind() == kind::null`.
|
1305 |
|
@returns `this->kind() == kind::null`.
|
| 1306 |
|
|
1306 |
|
|
| 1307 |
|
|
1307 |
|
|
| 1308 |
|
|
1308 |
|
|
| 1309 |
|
|
1309 |
|
|
| 1310 |
|
|
1310 |
|
|
| 1311 |
|
|
1311 |
|
|
| 1312 |
|
|
1312 |
|
|
| 1313 |
|
|
1313 |
|
|
| 1314 |
|
|
1314 |
|
|
| 1315 |
|
|
1315 |
|
|
| 1316 |
|
return kind() == json::kind::null;
|
1316 |
|
return kind() == json::kind::null;
|
| 1317 |
|
|
1317 |
|
|
| 1318 |
|
|
1318 |
|
|
| 1319 |
|
/** Checks if this is an @ref array or an @ref object.
|
1319 |
|
/** Checks if this is an @ref array or an @ref object.
|
| 1320 |
|
|
1320 |
|
|
| 1321 |
|
This function returns `true` if @ref kind() is either `kind::object` or
|
1321 |
|
This function returns `true` if @ref kind() is either `kind::object` or
|
| 1322 |
|
|
1322 |
|
|
| 1323 |
|
|
1323 |
|
|
| 1324 |
|
|
1324 |
|
|
| 1325 |
|
|
1325 |
|
|
| 1326 |
|
|
1326 |
|
|
| 1327 |
|
|
1327 |
|
|
| 1328 |
|
|
1328 |
|
|
| 1329 |
|
|
1329 |
|
|
| 1330 |
|
|
1330 |
|
|
| 1331 |
|
is_structured() const noexcept
|
1331 |
|
is_structured() const noexcept
|
| 1332 |
|
|
1332 |
|
|
| 1333 |
|
// VFALCO Could use bit 0x20 for this
|
1333 |
|
// VFALCO Could use bit 0x20 for this
|
| 1334 |
|
|
1334 |
|
|
| 1335 |
|
kind() == json::kind::object ||
|
1335 |
|
kind() == json::kind::object ||
|
| 1336 |
|
kind() == json::kind::array;
|
1336 |
|
kind() == json::kind::array;
|
| 1337 |
|
|
1337 |
|
|
| 1338 |
|
|
1338 |
|
|
| 1339 |
|
/** Check if this is not an @ref array or @ref object.
|
1339 |
|
/** Check if this is not an @ref array or @ref object.
|
| 1340 |
|
|
1340 |
|
|
| 1341 |
|
This function returns `true` if @ref kind() is neither `kind::object`
|
1341 |
|
This function returns `true` if @ref kind() is neither `kind::object`
|
| 1342 |
|
|
1342 |
|
|
| 1343 |
|
|
1343 |
|
|
| 1344 |
|
|
1344 |
|
|
| 1345 |
|
|
1345 |
|
|
| 1346 |
|
|
1346 |
|
|
| 1347 |
|
|
1347 |
|
|
| 1348 |
|
|
1348 |
|
|
| 1349 |
|
|
1349 |
|
|
| 1350 |
|
|
1350 |
|
|
| 1351 |
|
is_primitive() const noexcept
|
1351 |
|
is_primitive() const noexcept
|
| 1352 |
|
|
1352 |
|
|
| 1353 |
|
// VFALCO Could use bit 0x20 for this
|
1353 |
|
// VFALCO Could use bit 0x20 for this
|
| 1354 |
|
|
1354 |
|
|
| 1355 |
|
sca_.k != json::kind::object &&
|
1355 |
|
sca_.k != json::kind::object &&
|
| 1356 |
|
sca_.k != json::kind::array;
|
1356 |
|
sca_.k != json::kind::array;
|
| 1357 |
|
|
1357 |
|
|
| 1358 |
|
|
1358 |
|
|
| 1359 |
|
/** Check if this is a number.
|
1359 |
|
/** Check if this is a number.
|
| 1360 |
|
|
1360 |
|
|
| 1361 |
|
This function returns `true` when @ref kind() is one of `kind::int64`,
|
1361 |
|
This function returns `true` when @ref kind() is one of `kind::int64`,
|
| 1362 |
|
`kind::uint64`, or `kind::double_`.
|
1362 |
|
`kind::uint64`, or `kind::double_`.
|
| 1363 |
|
|
1363 |
|
|
| 1364 |
|
|
1364 |
|
|
| 1365 |
|
|
1365 |
|
|
| 1366 |
|
|
1366 |
|
|
| 1367 |
|
|
1367 |
|
|
| 1368 |
|
|
1368 |
|
|
| 1369 |
|
|
1369 |
|
|
| 1370 |
|
|
1370 |
|
|
| 1371 |
|
is_number() const noexcept
|
1371 |
|
is_number() const noexcept
|
| 1372 |
|
|
1372 |
|
|
| 1373 |
|
// VFALCO Could use bit 0x40 for this
|
1373 |
|
// VFALCO Could use bit 0x40 for this
|
| 1374 |
|
|
1374 |
|
|
| 1375 |
|
kind() == json::kind::int64 ||
|
1375 |
|
kind() == json::kind::int64 ||
|
| 1376 |
|
kind() == json::kind::uint64 ||
|
1376 |
|
kind() == json::kind::uint64 ||
|
| 1377 |
|
kind() == json::kind::double_;
|
1377 |
|
kind() == json::kind::double_;
|
| 1378 |
|
|
1378 |
|
|
| 1379 |
|
|
1379 |
|
|
| 1380 |
|
//------------------------------------------------------
|
1380 |
|
//------------------------------------------------------
|
| 1381 |
|
|
1381 |
|
|
| 1382 |
|
/** Return a pointer to the underlying @ref array.
|
1382 |
|
/** Return a pointer to the underlying @ref array.
|
| 1383 |
|
|
1383 |
|
|
| 1384 |
|
If `this->kind() == kind::array`, returns a pointer to the underlying
|
1384 |
|
If `this->kind() == kind::array`, returns a pointer to the underlying
|
| 1385 |
|
array. Otherwise, returns `nullptr`.
|
1385 |
|
array. Otherwise, returns `nullptr`.
|
| 1386 |
|
|
1386 |
|
|
| 1387 |
|
|
1387 |
|
|
| 1388 |
|
The return value is used in both a boolean context and
|
1388 |
|
The return value is used in both a boolean context and
|
| 1389 |
|
|
1389 |
|
|
| 1390 |
|
|
1390 |
|
|
| 1391 |
|
if( auto p = jv.if_array() )
|
1391 |
|
if( auto p = jv.if_array() )
|
| 1392 |
|
|
1392 |
|
|
| 1393 |
|
|
1393 |
|
|
| 1394 |
|
|
1394 |
|
|
| 1395 |
|
|
1395 |
|
|
| 1396 |
|
|
1396 |
|
|
| 1397 |
|
|
1397 |
|
|
| 1398 |
|
|
1398 |
|
|
| 1399 |
|
|
1399 |
|
|
| 1400 |
|
|
1400 |
|
|
| 1401 |
|
|
1401 |
|
|
| 1402 |
|
|
1402 |
|
|
| 1403 |
|
|
1403 |
|
|
| 1404 |
|
if_array() const noexcept
|
1404 |
|
if_array() const noexcept
|
| 1405 |
|
|
1405 |
|
|
| 1406 |
|
if(kind() == json::kind::array)
|
1406 |
|
if(kind() == json::kind::array)
|
| 1407 |
|
|
1407 |
|
|
| 1408 |
|
|
1408 |
|
|
| 1409 |
|
|
1409 |
|
|
| 1410 |
|
|
1410 |
|
|
| 1411 |
|
|
1411 |
|
|
| 1412 |
|
|
1412 |
|
|
| 1413 |
|
|
1413 |
|
|
| 1414 |
|
if(kind() == json::kind::array)
|
1414 |
|
if(kind() == json::kind::array)
|
| 1415 |
|
|
1415 |
|
|
| 1416 |
|
|
1416 |
|
|
| 1417 |
|
|
1417 |
|
|
| 1418 |
|
|
1418 |
|
|
| 1419 |
|
|
1419 |
|
|
| 1420 |
|
/** Return a pointer to the underlying @ref object.
|
1420 |
|
/** Return a pointer to the underlying @ref object.
|
| 1421 |
|
|
1421 |
|
|
| 1422 |
|
If `this->kind() == kind::object`, returns a pointer to the underlying
|
1422 |
|
If `this->kind() == kind::object`, returns a pointer to the underlying
|
| 1423 |
|
object. Otherwise, returns `nullptr`.
|
1423 |
|
object. Otherwise, returns `nullptr`.
|
| 1424 |
|
|
1424 |
|
|
| 1425 |
|
|
1425 |
|
|
| 1426 |
|
The return value is used in both a boolean context and
|
1426 |
|
The return value is used in both a boolean context and
|
| 1427 |
|
|
1427 |
|
|
| 1428 |
|
|
1428 |
|
|
| 1429 |
|
if( auto p = jv.if_object() )
|
1429 |
|
if( auto p = jv.if_object() )
|
| 1430 |
|
|
1430 |
|
|
| 1431 |
|
|
1431 |
|
|
| 1432 |
|
|
1432 |
|
|
| 1433 |
|
|
1433 |
|
|
| 1434 |
|
|
1434 |
|
|
| 1435 |
|
|
1435 |
|
|
| 1436 |
|
|
1436 |
|
|
| 1437 |
|
|
1437 |
|
|
| 1438 |
|
|
1438 |
|
|
| 1439 |
|
|
1439 |
|
|
| 1440 |
|
|
1440 |
|
|
| 1441 |
|
|
1441 |
|
|
| 1442 |
|
if_object() const noexcept
|
1442 |
|
if_object() const noexcept
|
| 1443 |
|
|
1443 |
|
|
| 1444 |
|
if(kind() == json::kind::object)
|
1444 |
|
if(kind() == json::kind::object)
|
| 1445 |
|
|
1445 |
|
|
| 1446 |
|
|
1446 |
|
|
| 1447 |
|
|
1447 |
|
|
| 1448 |
|
|
1448 |
|
|
| 1449 |
|
|
1449 |
|
|
| 1450 |
|
|
1450 |
|
|
| 1451 |
|
|
1451 |
|
|
| 1452 |
|
if(kind() == json::kind::object)
|
1452 |
|
if(kind() == json::kind::object)
|
| 1453 |
|
|
1453 |
|
|
| 1454 |
|
|
1454 |
|
|
| 1455 |
|
|
1455 |
|
|
| 1456 |
|
|
1456 |
|
|
| 1457 |
|
|
1457 |
|
|
| 1458 |
|
/** Return a pointer to the underlying @ref string.
|
1458 |
|
/** Return a pointer to the underlying @ref string.
|
| 1459 |
|
|
1459 |
|
|
| 1460 |
|
If `this->kind() == kind::string`, returns a pointer to the underlying
|
1460 |
|
If `this->kind() == kind::string`, returns a pointer to the underlying
|
| 1461 |
|
object. Otherwise, returns `nullptr`.
|
1461 |
|
object. Otherwise, returns `nullptr`.
|
| 1462 |
|
|
1462 |
|
|
| 1463 |
|
|
1463 |
|
|
| 1464 |
|
The return value is used in both a boolean context and
|
1464 |
|
The return value is used in both a boolean context and
|
| 1465 |
|
|
1465 |
|
|
| 1466 |
|
|
1466 |
|
|
| 1467 |
|
if( auto p = jv.if_string() )
|
1467 |
|
if( auto p = jv.if_string() )
|
| 1468 |
|
|
1468 |
|
|
| 1469 |
|
|
1469 |
|
|
| 1470 |
|
|
1470 |
|
|
| 1471 |
|
|
1471 |
|
|
| 1472 |
|
|
1472 |
|
|
| 1473 |
|
|
1473 |
|
|
| 1474 |
|
|
1474 |
|
|
| 1475 |
|
|
1475 |
|
|
| 1476 |
|
|
1476 |
|
|
| 1477 |
|
|
1477 |
|
|
| 1478 |
|
|
1478 |
|
|
| 1479 |
|
|
1479 |
|
|
| 1480 |
|
if_string() const noexcept
|
1480 |
|
if_string() const noexcept
|
| 1481 |
|
|
1481 |
|
|
| 1482 |
|
if(kind() == json::kind::string)
|
1482 |
|
if(kind() == json::kind::string)
|
| 1483 |
|
|
1483 |
|
|
| 1484 |
|
|
1484 |
|
|
| 1485 |
|
|
1485 |
|
|
| 1486 |
|
|
1486 |
|
|
| 1487 |
|
|
1487 |
|
|
| 1488 |
|
|
1488 |
|
|
| 1489 |
|
|
1489 |
|
|
| 1490 |
|
if(kind() == json::kind::string)
|
1490 |
|
if(kind() == json::kind::string)
|
| 1491 |
|
|
1491 |
|
|
| 1492 |
|
|
1492 |
|
|
| 1493 |
|
|
1493 |
|
|
| 1494 |
|
|
1494 |
|
|
| 1495 |
|
|
1495 |
|
|
| 1496 |
|
/** Return a pointer to the underlying `std::int64_t`.
|
1496 |
|
/** Return a pointer to the underlying `std::int64_t`.
|
| 1497 |
|
|
1497 |
|
|
| 1498 |
|
If `this->kind() == kind::int64`, returns a pointer to the underlying
|
1498 |
|
If `this->kind() == kind::int64`, returns a pointer to the underlying
|
| 1499 |
|
integer. Otherwise, returns `nullptr`.
|
1499 |
|
integer. Otherwise, returns `nullptr`.
|
| 1500 |
|
|
1500 |
|
|
| 1501 |
|
|
1501 |
|
|
| 1502 |
|
The return value is used in both a boolean context and
|
1502 |
|
The return value is used in both a boolean context and
|
| 1503 |
|
|
1503 |
|
|
| 1504 |
|
|
1504 |
|
|
| 1505 |
|
if( auto p = jv.if_int64() )
|
1505 |
|
if( auto p = jv.if_int64() )
|
| 1506 |
|
|
1506 |
|
|
| 1507 |
|
|
1507 |
|
|
| 1508 |
|
|
1508 |
|
|
| 1509 |
|
|
1509 |
|
|
| 1510 |
|
|
1510 |
|
|
| 1511 |
|
|
1511 |
|
|
| 1512 |
|
|
1512 |
|
|
| 1513 |
|
|
1513 |
|
|
| 1514 |
|
|
1514 |
|
|
| 1515 |
|
|
1515 |
|
|
| 1516 |
|
|
1516 |
|
|
| 1517 |
|
|
1517 |
|
|
| 1518 |
|
if_int64() const noexcept
|
1518 |
|
if_int64() const noexcept
|
| 1519 |
|
|
1519 |
|
|
| 1520 |
|
if(kind() == json::kind::int64)
|
1520 |
|
if(kind() == json::kind::int64)
|
| 1521 |
|
|
1521 |
|
|
| 1522 |
|
|
1522 |
|
|
| 1523 |
|
|
1523 |
|
|
| 1524 |
|
|
1524 |
|
|
| 1525 |
|
|
1525 |
|
|
| 1526 |
|
|
1526 |
|
|
| 1527 |
|
|
1527 |
|
|
| 1528 |
|
if(kind() == json::kind::int64)
|
1528 |
|
if(kind() == json::kind::int64)
|
| 1529 |
|
|
1529 |
|
|
| 1530 |
|
|
1530 |
|
|
| 1531 |
|
|
1531 |
|
|
| 1532 |
|
|
1532 |
|
|
| 1533 |
|
|
1533 |
|
|
| 1534 |
|
/** Return a pointer to the underlying `std::uint64_t`.
|
1534 |
|
/** Return a pointer to the underlying `std::uint64_t`.
|
| 1535 |
|
|
1535 |
|
|
| 1536 |
|
If `this->kind() == kind::uint64`, returns a pointer to the underlying
|
1536 |
|
If `this->kind() == kind::uint64`, returns a pointer to the underlying
|
| 1537 |
|
unsigned integer. Otherwise, returns `nullptr`.
|
1537 |
|
unsigned integer. Otherwise, returns `nullptr`.
|
| 1538 |
|
|
1538 |
|
|
| 1539 |
|
|
1539 |
|
|
| 1540 |
|
The return value is used in both a boolean context and
|
1540 |
|
The return value is used in both a boolean context and
|
| 1541 |
|
|
1541 |
|
|
| 1542 |
|
|
1542 |
|
|
| 1543 |
|
if( auto p = jv.if_uint64() )
|
1543 |
|
if( auto p = jv.if_uint64() )
|
| 1544 |
|
|
1544 |
|
|
| 1545 |
|
|
1545 |
|
|
| 1546 |
|
|
1546 |
|
|
| 1547 |
|
|
1547 |
|
|
| 1548 |
|
|
1548 |
|
|
| 1549 |
|
|
1549 |
|
|
| 1550 |
|
|
1550 |
|
|
| 1551 |
|
|
1551 |
|
|
| 1552 |
|
|
1552 |
|
|
| 1553 |
|
|
1553 |
|
|
| 1554 |
|
|
1554 |
|
|
| 1555 |
|
|
1555 |
|
|
| 1556 |
|
if_uint64() const noexcept
|
1556 |
|
if_uint64() const noexcept
|
| 1557 |
|
|
1557 |
|
|
| 1558 |
|
if(kind() == json::kind::uint64)
|
1558 |
|
if(kind() == json::kind::uint64)
|
| 1559 |
|
|
1559 |
|
|
| 1560 |
|
|
1560 |
|
|
| 1561 |
|
|
1561 |
|
|
| 1562 |
|
|
1562 |
|
|
| 1563 |
|
|
1563 |
|
|
| 1564 |
|
|
1564 |
|
|
| 1565 |
|
|
1565 |
|
|
| 1566 |
|
if(kind() == json::kind::uint64)
|
1566 |
|
if(kind() == json::kind::uint64)
|
| 1567 |
|
|
1567 |
|
|
| 1568 |
|
|
1568 |
|
|
| 1569 |
|
|
1569 |
|
|
| 1570 |
|
|
1570 |
|
|
| 1571 |
|
|
1571 |
|
|
| 1572 |
|
/** Return a pointer to the underlying `double`.
|
1572 |
|
/** Return a pointer to the underlying `double`.
|
| 1573 |
|
|
1573 |
|
|
| 1574 |
|
If `this->kind() == kind::double_`, returns a pointer to the underlying
|
1574 |
|
If `this->kind() == kind::double_`, returns a pointer to the underlying
|
| 1575 |
|
double. Otherwise, returns `nullptr`.
|
1575 |
|
double. Otherwise, returns `nullptr`.
|
| 1576 |
|
|
1576 |
|
|
| 1577 |
|
|
1577 |
|
|
| 1578 |
|
The return value is used in both a boolean context and
|
1578 |
|
The return value is used in both a boolean context and
|
| 1579 |
|
|
1579 |
|
|
| 1580 |
|
|
1580 |
|
|
| 1581 |
|
if( auto p = jv.if_double() )
|
1581 |
|
if( auto p = jv.if_double() )
|
| 1582 |
|
|
1582 |
|
|
| 1583 |
|
|
1583 |
|
|
| 1584 |
|
|
1584 |
|
|
| 1585 |
|
|
1585 |
|
|
| 1586 |
|
|
1586 |
|
|
| 1587 |
|
|
1587 |
|
|
| 1588 |
|
|
1588 |
|
|
| 1589 |
|
|
1589 |
|
|
| 1590 |
|
|
1590 |
|
|
| 1591 |
|
|
1591 |
|
|
| 1592 |
|
|
1592 |
|
|
| 1593 |
|
|
1593 |
|
|
| 1594 |
|
if_double() const noexcept
|
1594 |
|
if_double() const noexcept
|
| 1595 |
|
|
1595 |
|
|
| 1596 |
|
if(kind() == json::kind::double_)
|
1596 |
|
if(kind() == json::kind::double_)
|
| 1597 |
|
|
1597 |
|
|
| 1598 |
|
|
1598 |
|
|
| 1599 |
|
|
1599 |
|
|
| 1600 |
|
|
1600 |
|
|
| 1601 |
|
|
1601 |
|
|
| 1602 |
|
|
1602 |
|
|
| 1603 |
|
|
1603 |
|
|
| 1604 |
|
if(kind() == json::kind::double_)
|
1604 |
|
if(kind() == json::kind::double_)
|
| 1605 |
|
|
1605 |
|
|
| 1606 |
|
|
1606 |
|
|
| 1607 |
|
|
1607 |
|
|
| 1608 |
|
|
1608 |
|
|
| 1609 |
|
|
1609 |
|
|
| 1610 |
|
/** Return a pointer to the underlying `bool` .
|
1610 |
|
/** Return a pointer to the underlying `bool` .
|
| 1611 |
|
|
1611 |
|
|
| 1612 |
|
If `this->kind() == kind::bool_`, returns a pointer to the underlying
|
1612 |
|
If `this->kind() == kind::bool_`, returns a pointer to the underlying
|
| 1613 |
|
boolean. Otherwise, returns `nullptr`.
|
1613 |
|
boolean. Otherwise, returns `nullptr`.
|
| 1614 |
|
|
1614 |
|
|
| 1615 |
|
|
1615 |
|
|
| 1616 |
|
The return value is used in both a boolean context and
|
1616 |
|
The return value is used in both a boolean context and
|
| 1617 |
|
|
1617 |
|
|
| 1618 |
|
|
1618 |
|
|
| 1619 |
|
if( auto p = jv.if_bool() )
|
1619 |
|
if( auto p = jv.if_bool() )
|
| 1620 |
|
|
1620 |
|
|
| 1621 |
|
|
1621 |
|
|
| 1622 |
|
|
1622 |
|
|
| 1623 |
|
|
1623 |
|
|
| 1624 |
|
|
1624 |
|
|
| 1625 |
|
|
1625 |
|
|
| 1626 |
|
|
1626 |
|
|
| 1627 |
|
|
1627 |
|
|
| 1628 |
|
|
1628 |
|
|
| 1629 |
|
|
1629 |
|
|
| 1630 |
|
|
1630 |
|
|
| 1631 |
|
|
1631 |
|
|
| 1632 |
|
|
1632 |
|
|
| 1633 |
|
|
1633 |
|
|
| 1634 |
|
if(kind() == json::kind::bool_)
|
1634 |
|
if(kind() == json::kind::bool_)
|
| 1635 |
|
|
1635 |
|
|
| 1636 |
|
|
1636 |
|
|
| 1637 |
|
|
1637 |
|
|
| 1638 |
|
|
1638 |
|
|
| 1639 |
|
|
1639 |
|
|
| 1640 |
|
|
1640 |
|
|
| 1641 |
|
|
1641 |
|
|
| 1642 |
|
if(kind() == json::kind::bool_)
|
1642 |
|
if(kind() == json::kind::bool_)
|
| 1643 |
|
|
1643 |
|
|
| 1644 |
|
|
1644 |
|
|
| 1645 |
|
|
1645 |
|
|
| 1646 |
|
|
1646 |
|
|
| 1647 |
|
|
1647 |
|
|
| 1648 |
|
//------------------------------------------------------
|
1648 |
|
//------------------------------------------------------
|
| 1649 |
|
|
1649 |
|
|
| 1650 |
|
/** Return the stored number cast to an arithmetic type.
|
1650 |
|
/** Return the stored number cast to an arithmetic type.
|
| 1651 |
|
|
1651 |
|
|
| 1652 |
|
This function attempts to return the stored value converted to the
|
1652 |
|
This function attempts to return the stored value converted to the
|
| 1653 |
|
arithmetic type `T` which may not be `bool`:
|
1653 |
|
arithmetic type `T` which may not be `bool`:
|
| 1654 |
|
|
1654 |
|
|
| 1655 |
|
@li If `T` is an integral type and the stored value is a number which
|
1655 |
|
@li If `T` is an integral type and the stored value is a number which
|
| 1656 |
|
can be losslessly converted, the conversion is performed without
|
1656 |
|
can be losslessly converted, the conversion is performed without
|
| 1657 |
|
error and the converted number is returned.
|
1657 |
|
error and the converted number is returned.
|
| 1658 |
|
@li If `T` is an integral type and the stored value is a number which
|
1658 |
|
@li If `T` is an integral type and the stored value is a number which
|
| 1659 |
|
cannot be losslessly converted, then the operation fails with
|
1659 |
|
cannot be losslessly converted, then the operation fails with
|
| 1660 |
|
|
1660 |
|
|
| 1661 |
|
@li If `T` is a floating point type and the stored value is a number,
|
1661 |
|
@li If `T` is a floating point type and the stored value is a number,
|
| 1662 |
|
the conversion is performed without error. The converted number is
|
1662 |
|
the conversion is performed without error. The converted number is
|
| 1663 |
|
returned, with a possible loss of precision.
|
1663 |
|
returned, with a possible loss of precision.
|
| 1664 |
|
@li Otherwise, if the stored value is not a number; that is, if
|
1664 |
|
@li Otherwise, if the stored value is not a number; that is, if
|
| 1665 |
|
@ref is_number() returns `false`, then the operation fails with
|
1665 |
|
@ref is_number() returns `false`, then the operation fails with
|
| 1666 |
|
|
1666 |
|
|
| 1667 |
|
|
1667 |
|
|
| 1668 |
|
|
1668 |
|
|
| 1669 |
|
|
1669 |
|
|
| 1670 |
|
std::is_arithmetic< T >::value && ! std::is_same< T, bool >::value
|
1670 |
|
std::is_arithmetic< T >::value && ! std::is_same< T, bool >::value
|
| 1671 |
|
|
1671 |
|
|
| 1672 |
|
|
1672 |
|
|
| 1673 |
|
|
1673 |
|
|
| 1674 |
|
|
1674 |
|
|
| 1675 |
|
|
1675 |
|
|
| 1676 |
|
|
1676 |
|
|
| 1677 |
|
@li **(1)**, **(2)** no-throw guarantee.
|
1677 |
|
@li **(1)**, **(2)** no-throw guarantee.
|
| 1678 |
|
@li **(3)** strong guarantee.
|
1678 |
|
@li **(3)** strong guarantee.
|
| 1679 |
|
|
1679 |
|
|
| 1680 |
|
@return The converted number.
|
1680 |
|
@return The converted number.
|
| 1681 |
|
|
1681 |
|
|
| 1682 |
|
@param ec Set to the error, if any occurred.
|
1682 |
|
@param ec Set to the error, if any occurred.
|
| 1683 |
|
|
1683 |
|
|
| 1684 |
|
@return The converted number.
|
1684 |
|
@return The converted number.
|
| 1685 |
|
|
1685 |
|
|
| 1686 |
|
|
1686 |
|
|
| 1687 |
|
|
1687 |
|
|
| 1688 |
|
|
1688 |
|
|
| 1689 |
|
|
1689 |
|
|
| 1690 |
|
|
1690 |
|
|
| 1691 |
|
|
1691 |
|
|
| 1692 |
|
|
1692 |
|
|
| 1693 |
|
std::is_arithmetic<T>::value &&
|
1693 |
|
std::is_arithmetic<T>::value &&
|
| 1694 |
|
! std::is_same<T, bool>::value,
|
1694 |
|
! std::is_same<T, bool>::value,
|
| 1695 |
|
|
1695 |
|
|
| 1696 |
|
|
1696 |
|
|
| 1697 |
|
to_number(system::error_code& ec) const noexcept
|
1697 |
|
to_number(system::error_code& ec) const noexcept
|
| 1698 |
|
|
1698 |
|
|
| 1699 |
|
|
1699 |
|
|
| 1700 |
|
auto result = to_number<T>(e);
|
1700 |
|
auto result = to_number<T>(e);
|
| 1701 |
|
|
1701 |
|
|
| 1702 |
|
|
1702 |
|
|
| 1703 |
|
|
1703 |
|
|
| 1704 |
|
|
1704 |
|
|
| 1705 |
|
|
1705 |
|
|
| 1706 |
|
|
1706 |
|
|
| 1707 |
|
|
1707 |
|
|
| 1708 |
|
|
1708 |
|
|
| 1709 |
|
|
1709 |
|
|
| 1710 |
|
std::is_arithmetic<T>::value &&
|
1710 |
|
std::is_arithmetic<T>::value &&
|
| 1711 |
|
! std::is_same<T, bool>::value,
|
1711 |
|
! std::is_same<T, bool>::value,
|
| 1712 |
|
|
1712 |
|
|
| 1713 |
|
|
1713 |
|
|
| 1714 |
|
to_number(std::error_code& ec) const noexcept
|
1714 |
|
to_number(std::error_code& ec) const noexcept
|
| 1715 |
|
|
1715 |
|
|
| 1716 |
|
|
1716 |
|
|
| 1717 |
|
auto result = to_number<T>(jec);
|
1717 |
|
auto result = to_number<T>(jec);
|
| 1718 |
|
|
1718 |
|
|
| 1719 |
|
|
1719 |
|
|
| 1720 |
|
|
1720 |
|
|
| 1721 |
|
|
1721 |
|
|
| 1722 |
|
|
1722 |
|
|
| 1723 |
|
|
1723 |
|
|
| 1724 |
|
@throws boost::system::system_error Overload **(3)** reports errors by
|
1724 |
|
@throws boost::system::system_error Overload **(3)** reports errors by
|
| 1725 |
|
|
1725 |
|
|
| 1726 |
|
|
1726 |
|
|
| 1727 |
|
|
1727 |
|
|
| 1728 |
|
|
1728 |
|
|
| 1729 |
|
|
1729 |
|
|
| 1730 |
|
|
1730 |
|
|
| 1731 |
|
|
1731 |
|
|
| 1732 |
|
std::is_arithmetic<T>::value &&
|
1732 |
|
std::is_arithmetic<T>::value &&
|
| 1733 |
|
! std::is_same<T, bool>::value,
|
1733 |
|
! std::is_same<T, bool>::value,
|
| 1734 |
|
|
1734 |
|
|
| 1735 |
|
|
1735 |
|
|
| 1736 |
|
|
1736 |
|
|
| 1737 |
|
|
1737 |
|
|
| 1738 |
|
return try_to_number<T>().value();
|
1738 |
|
return try_to_number<T>().value();
|
| 1739 |
|
|
1739 |
|
|
| 1740 |
|
|
1740 |
|
|
| 1741 |
|
|
1741 |
|
|
| 1742 |
|
/** Return the stored number as @ref boost::system::result.
|
1742 |
|
/** Return the stored number as @ref boost::system::result.
|
| 1743 |
|
|
1743 |
|
|
| 1744 |
|
This function attempts to return the stored value converted to the
|
1744 |
|
This function attempts to return the stored value converted to the
|
| 1745 |
|
arithmetic type `T` which may not be `bool`:
|
1745 |
|
arithmetic type `T` which may not be `bool`:
|
| 1746 |
|
|
1746 |
|
|
| 1747 |
|
@li If `T` is an integral type and the stored value is a number which
|
1747 |
|
@li If `T` is an integral type and the stored value is a number which
|
| 1748 |
|
can be losslessly converted, the conversion is performed without
|
1748 |
|
can be losslessly converted, the conversion is performed without
|
| 1749 |
|
error and `result<T>` containing the converted number is returned.
|
1749 |
|
error and `result<T>` containing the converted number is returned.
|
| 1750 |
|
@li If `T` is an integral type and the stored value is a number which
|
1750 |
|
@li If `T` is an integral type and the stored value is a number which
|
| 1751 |
|
cannot be losslessly converted, then `result<T>` containing the
|
1751 |
|
cannot be losslessly converted, then `result<T>` containing the
|
| 1752 |
|
corresponding `error_code` is returned.
|
1752 |
|
corresponding `error_code` is returned.
|
| 1753 |
|
@li If `T` is a floating point type and the stored value is a number,
|
1753 |
|
@li If `T` is a floating point type and the stored value is a number,
|
| 1754 |
|
the conversion is performed without error. `result<T>` containing
|
1754 |
|
the conversion is performed without error. `result<T>` containing
|
| 1755 |
|
the converted number, with a possible loss of precision, is
|
1755 |
|
the converted number, with a possible loss of precision, is
|
| 1756 |
|
|
1756 |
|
|
| 1757 |
|
@li Otherwise, if the stored value is not a number; that is, if
|
1757 |
|
@li Otherwise, if the stored value is not a number; that is, if
|
| 1758 |
|
`this->is_number()` returns `false`, then `result<T>` containing
|
1758 |
|
`this->is_number()` returns `false`, then `result<T>` containing
|
| 1759 |
|
the corresponding `error_code` is returned.
|
1759 |
|
the corresponding `error_code` is returned.
|
| 1760 |
|
|
1760 |
|
|
| 1761 |
|
|
1761 |
|
|
| 1762 |
|
|
1762 |
|
|
| 1763 |
|
std::is_arithmetic< T >::value && ! std::is_same< T, bool >::value
|
1763 |
|
std::is_arithmetic< T >::value && ! std::is_same< T, bool >::value
|
| 1764 |
|
|
1764 |
|
|
| 1765 |
|
|
1765 |
|
|
| 1766 |
|
|
1766 |
|
|
| 1767 |
|
|
1767 |
|
|
| 1768 |
|
|
1768 |
|
|
| 1769 |
|
|
1769 |
|
|
| 1770 |
|
|
1770 |
|
|
| 1771 |
|
|
1771 |
|
|
| 1772 |
|
@return `boost::system::result<T>` with either the converted number or
|
1772 |
|
@return `boost::system::result<T>` with either the converted number or
|
| 1773 |
|
|
1773 |
|
|
| 1774 |
|
|
1774 |
|
|
| 1775 |
|
|
1775 |
|
|
| 1776 |
|
|
1776 |
|
|
| 1777 |
|
|
1777 |
|
|
| 1778 |
|
|
1778 |
|
|
| 1779 |
|
|
1779 |
|
|
| 1780 |
|
std::is_arithmetic<T>::value && ! std::is_same<T, bool>::value,
|
1780 |
|
std::is_arithmetic<T>::value && ! std::is_same<T, bool>::value,
|
| 1781 |
|
|
1781 |
|
|
| 1782 |
|
|
1782 |
|
|
| 1783 |
|
|
1783 |
|
|
| 1784 |
|
try_to_number() const noexcept
|
1784 |
|
try_to_number() const noexcept
|
| 1785 |
|
|
1785 |
|
|
| 1786 |
|
|
1786 |
|
|
| 1787 |
|
T result = to_number<T>(ec);
|
1787 |
|
T result = to_number<T>(ec);
|
| 1788 |
|
|
1788 |
|
|
| 1789 |
|
return {system::in_place_error, ec};
|
1789 |
|
return {system::in_place_error, ec};
|
| 1790 |
|
|
1790 |
|
|
| 1791 |
|
return {system::in_place_value, result};
|
1791 |
|
return {system::in_place_value, result};
|
| 1792 |
|
|
1792 |
|
|
| 1793 |
|
|
1793 |
|
|
| 1794 |
|
//------------------------------------------------------
|
1794 |
|
//------------------------------------------------------
|
| 1795 |
|
|
1795 |
|
|
| 1796 |
|
|
1796 |
|
|
| 1797 |
|
|
1797 |
|
|
| 1798 |
|
//------------------------------------------------------
|
1798 |
|
//------------------------------------------------------
|
| 1799 |
|
|
1799 |
|
|
| 1800 |
|
/** Return the associated memory resource.
|
1800 |
|
/** Return the associated memory resource.
|
| 1801 |
|
|
1801 |
|
|
| 1802 |
|
This function returns a smart pointer to the
|
1802 |
|
This function returns a smart pointer to the
|
| 1803 |
|
@ref boost::container::pmr::memory_resource used by the container.
|
1803 |
|
@ref boost::container::pmr::memory_resource used by the container.
|
| 1804 |
|
|
1804 |
|
|
| 1805 |
|
|
1805 |
|
|
| 1806 |
|
|
1806 |
|
|
| 1807 |
|
|
1807 |
|
|
| 1808 |
|
|
1808 |
|
|
| 1809 |
|
|
1809 |
|
|
| 1810 |
|
|
1810 |
|
|
| 1811 |
|
|
1811 |
|
|
| 1812 |
|
|
1812 |
|
|
| 1813 |
|
|
1813 |
|
|
| 1814 |
|
|
1814 |
|
|
| 1815 |
|
|
1815 |
|
|
| 1816 |
|
|
1816 |
|
|
| 1817 |
|
/** Return the associated allocator.
|
1817 |
|
/** Return the associated allocator.
|
| 1818 |
|
|
1818 |
|
|
| 1819 |
|
This function returns an instance of @ref allocator_type constructed
|
1819 |
|
This function returns an instance of @ref allocator_type constructed
|
| 1820 |
|
from the associated @ref boost::container::pmr::memory_resource.
|
1820 |
|
from the associated @ref boost::container::pmr::memory_resource.
|
| 1821 |
|
|
1821 |
|
|
| 1822 |
|
|
1822 |
|
|
| 1823 |
|
|
1823 |
|
|
| 1824 |
|
|
1824 |
|
|
| 1825 |
|
|
1825 |
|
|
| 1826 |
|
|
1826 |
|
|
| 1827 |
|
|
1827 |
|
|
| 1828 |
|
|
1828 |
|
|
| 1829 |
|
get_allocator() const noexcept
|
1829 |
|
get_allocator() const noexcept
|
| 1830 |
|
|
1830 |
|
|
| 1831 |
|
|
1831 |
|
|
| 1832 |
|
|
1832 |
|
|
| 1833 |
|
|
1833 |
|
|
| 1834 |
|
//------------------------------------------------------
|
1834 |
|
//------------------------------------------------------
|
| 1835 |
|
|
1835 |
|
|
| 1836 |
|
/** Return `result` with a reference to the underlying @ref array
|
1836 |
|
/** Return `result` with a reference to the underlying @ref array
|
| 1837 |
|
|
1837 |
|
|
| 1838 |
|
If @ref is_array() is `true`, the result contains a reference to the
|
1838 |
|
If @ref is_array() is `true`, the result contains a reference to the
|
| 1839 |
|
underlying @ref array, otherwise it contains an `error_code`.
|
1839 |
|
underlying @ref array, otherwise it contains an `error_code`.
|
| 1840 |
|
|
1840 |
|
|
| 1841 |
|
|
1841 |
|
|
| 1842 |
|
The return value can be used in both a boolean context and
|
1842 |
|
The return value can be used in both a boolean context and
|
| 1843 |
|
|
1843 |
|
|
| 1844 |
|
|
1844 |
|
|
| 1845 |
|
if( auto r = jv.try_as_array() )
|
1845 |
|
if( auto r = jv.try_as_array() )
|
| 1846 |
|
|
1846 |
|
|
| 1847 |
|
|
1847 |
|
|
| 1848 |
|
|
1848 |
|
|
| 1849 |
|
But can also be used to throw an exception on error:
|
1849 |
|
But can also be used to throw an exception on error:
|
| 1850 |
|
|
1850 |
|
|
| 1851 |
|
return jv.try_as_array().value();
|
1851 |
|
return jv.try_as_array().value();
|
| 1852 |
|
|
1852 |
|
|
| 1853 |
|
|
1853 |
|
|
| 1854 |
|
|
1854 |
|
|
| 1855 |
|
|
1855 |
|
|
| 1856 |
|
|
1856 |
|
|
| 1857 |
|
|
1857 |
|
|
| 1858 |
|
|
1858 |
|
|
| 1859 |
|
|
1859 |
|
|
| 1860 |
|
|
1860 |
|
|
| 1861 |
|
|
1861 |
|
|
| 1862 |
|
|
1862 |
|
|
| 1863 |
|
|
1863 |
|
|
| 1864 |
|
|
1864 |
|
|
| 1865 |
|
|
1865 |
|
|
| 1866 |
|
|
1866 |
|
|
| 1867 |
|
system::result<array const&>
|
1867 |
|
system::result<array const&>
|
| 1868 |
|
try_as_array() const noexcept;
|
1868 |
|
try_as_array() const noexcept;
|
| 1869 |
|
|
1869 |
|
|
| 1870 |
|
|
1870 |
|
|
| 1871 |
|
/** Return `result` with a reference to the underlying @ref object.
|
1871 |
|
/** Return `result` with a reference to the underlying @ref object.
|
| 1872 |
|
|
1872 |
|
|
| 1873 |
|
If @ref is_object() is `true`, the result contains a reference to the
|
1873 |
|
If @ref is_object() is `true`, the result contains a reference to the
|
| 1874 |
|
underlying @ref object, otherwise it contains an `error_code`.
|
1874 |
|
underlying @ref object, otherwise it contains an `error_code`.
|
| 1875 |
|
|
1875 |
|
|
| 1876 |
|
|
1876 |
|
|
| 1877 |
|
The return value can be used in both a boolean context and
|
1877 |
|
The return value can be used in both a boolean context and
|
| 1878 |
|
|
1878 |
|
|
| 1879 |
|
|
1879 |
|
|
| 1880 |
|
if( auto r = jv.try_as_object() )
|
1880 |
|
if( auto r = jv.try_as_object() )
|
| 1881 |
|
|
1881 |
|
|
| 1882 |
|
|
1882 |
|
|
| 1883 |
|
|
1883 |
|
|
| 1884 |
|
But can also be used to throw an exception on error:
|
1884 |
|
But can also be used to throw an exception on error:
|
| 1885 |
|
|
1885 |
|
|
| 1886 |
|
return jv.try_as_object().value();
|
1886 |
|
return jv.try_as_object().value();
|
| 1887 |
|
|
1887 |
|
|
| 1888 |
|
|
1888 |
|
|
| 1889 |
|
|
1889 |
|
|
| 1890 |
|
|
1890 |
|
|
| 1891 |
|
|
1891 |
|
|
| 1892 |
|
|
1892 |
|
|
| 1893 |
|
|
1893 |
|
|
| 1894 |
|
|
1894 |
|
|
| 1895 |
|
|
1895 |
|
|
| 1896 |
|
|
1896 |
|
|
| 1897 |
|
|
1897 |
|
|
| 1898 |
|
|
1898 |
|
|
| 1899 |
|
try_as_object() noexcept;
|
1899 |
|
try_as_object() noexcept;
|
| 1900 |
|
|
1900 |
|
|
| 1901 |
|
|
1901 |
|
|
| 1902 |
|
system::result<object const&>
|
1902 |
|
system::result<object const&>
|
| 1903 |
|
try_as_object() const noexcept;
|
1903 |
|
try_as_object() const noexcept;
|
| 1904 |
|
|
1904 |
|
|
| 1905 |
|
|
1905 |
|
|
| 1906 |
|
/** Return `result` with a reference to the underlying @ref string.
|
1906 |
|
/** Return `result` with a reference to the underlying @ref string.
|
| 1907 |
|
|
1907 |
|
|
| 1908 |
|
If @ref is_string() is `true`, the result contains a reference to the
|
1908 |
|
If @ref is_string() is `true`, the result contains a reference to the
|
| 1909 |
|
underlying @ref string, otherwise it contains an `error_code`.
|
1909 |
|
underlying @ref string, otherwise it contains an `error_code`.
|
| 1910 |
|
|
1910 |
|
|
| 1911 |
|
|
1911 |
|
|
| 1912 |
|
The return value can be used in both a boolean context and
|
1912 |
|
The return value can be used in both a boolean context and
|
| 1913 |
|
|
1913 |
|
|
| 1914 |
|
|
1914 |
|
|
| 1915 |
|
if( auto r = jv.try_as_string() )
|
1915 |
|
if( auto r = jv.try_as_string() )
|
| 1916 |
|
|
1916 |
|
|
| 1917 |
|
|
1917 |
|
|
| 1918 |
|
|
1918 |
|
|
| 1919 |
|
But can also be used to throw an exception on error:
|
1919 |
|
But can also be used to throw an exception on error:
|
| 1920 |
|
|
1920 |
|
|
| 1921 |
|
return jv.try_as_string().value();
|
1921 |
|
return jv.try_as_string().value();
|
| 1922 |
|
|
1922 |
|
|
| 1923 |
|
|
1923 |
|
|
| 1924 |
|
|
1924 |
|
|
| 1925 |
|
|
1925 |
|
|
| 1926 |
|
|
1926 |
|
|
| 1927 |
|
|
1927 |
|
|
| 1928 |
|
|
1928 |
|
|
| 1929 |
|
|
1929 |
|
|
| 1930 |
|
|
1930 |
|
|
| 1931 |
|
|
1931 |
|
|
| 1932 |
|
|
1932 |
|
|
| 1933 |
|
|
1933 |
|
|
| 1934 |
|
try_as_string() noexcept;
|
1934 |
|
try_as_string() noexcept;
|
| 1935 |
|
|
1935 |
|
|
| 1936 |
|
|
1936 |
|
|
| 1937 |
|
system::result<string const&>
|
1937 |
|
system::result<string const&>
|
| 1938 |
|
try_as_string() const noexcept;
|
1938 |
|
try_as_string() const noexcept;
|
| 1939 |
|
|
1939 |
|
|
| 1940 |
|
|
1940 |
|
|
| 1941 |
|
/** Return `result` with the underlying `std::int64_t`
|
1941 |
|
/** Return `result` with the underlying `std::int64_t`
|
| 1942 |
|
|
1942 |
|
|
| 1943 |
|
If @ref is_int64() is `true`, the result contains a reference to **(1)**
|
1943 |
|
If @ref is_int64() is `true`, the result contains a reference to **(1)**
|
| 1944 |
|
or a copy of **(2)** the underlying `std::int64_t`, otherwise it
|
1944 |
|
or a copy of **(2)** the underlying `std::int64_t`, otherwise it
|
| 1945 |
|
contains an `error_code`.
|
1945 |
|
contains an `error_code`.
|
| 1946 |
|
|
1946 |
|
|
| 1947 |
|
|
1947 |
|
|
| 1948 |
|
The return value can be used in both a boolean context and
|
1948 |
|
The return value can be used in both a boolean context and
|
| 1949 |
|
|
1949 |
|
|
| 1950 |
|
|
1950 |
|
|
| 1951 |
|
if( auto r = jv.try_as_int64() )
|
1951 |
|
if( auto r = jv.try_as_int64() )
|
| 1952 |
|
|
1952 |
|
|
| 1953 |
|
|
1953 |
|
|
| 1954 |
|
|
1954 |
|
|
| 1955 |
|
But can also be used to throw an exception on error:
|
1955 |
|
But can also be used to throw an exception on error:
|
| 1956 |
|
|
1956 |
|
|
| 1957 |
|
return jv.try_as_int64().value();
|
1957 |
|
return jv.try_as_int64().value();
|
| 1958 |
|
|
1958 |
|
|
| 1959 |
|
|
1959 |
|
|
| 1960 |
|
|
1960 |
|
|
| 1961 |
|
|
1961 |
|
|
| 1962 |
|
|
1962 |
|
|
| 1963 |
|
|
1963 |
|
|
| 1964 |
|
|
1964 |
|
|
| 1965 |
|
|
1965 |
|
|
| 1966 |
|
|
1966 |
|
|
| 1967 |
|
|
1967 |
|
|
| 1968 |
|
|
1968 |
|
|
| 1969 |
|
system::result<std::int64_t&>
|
1969 |
|
system::result<std::int64_t&>
|
| 1970 |
|
|
1970 |
|
|
| 1971 |
|
|
1971 |
|
|
| 1972 |
|
|
1972 |
|
|
| 1973 |
|
system::result<std::int64_t>
|
1973 |
|
system::result<std::int64_t>
|
| 1974 |
|
try_as_int64() const noexcept;
|
1974 |
|
try_as_int64() const noexcept;
|
| 1975 |
|
|
1975 |
|
|
| 1976 |
|
|
1976 |
|
|
| 1977 |
|
/** Return `result` with the underlying `std::uint64_t`.
|
1977 |
|
/** Return `result` with the underlying `std::uint64_t`.
|
| 1978 |
|
|
1978 |
|
|
| 1979 |
|
If @ref is_uint64() is `true`, the result contains a reference to **(1)**
|
1979 |
|
If @ref is_uint64() is `true`, the result contains a reference to **(1)**
|
| 1980 |
|
or a copy of **(2)** the underlying `std::uint64_t`, otherwise it
|
1980 |
|
or a copy of **(2)** the underlying `std::uint64_t`, otherwise it
|
| 1981 |
|
contains an `error_code`.
|
1981 |
|
contains an `error_code`.
|
| 1982 |
|
|
1982 |
|
|
| 1983 |
|
|
1983 |
|
|
| 1984 |
|
The return value can be used in both a boolean context and
|
1984 |
|
The return value can be used in both a boolean context and
|
| 1985 |
|
|
1985 |
|
|
| 1986 |
|
|
1986 |
|
|
| 1987 |
|
if( auto r = jv.try_as_uint64() )
|
1987 |
|
if( auto r = jv.try_as_uint64() )
|
| 1988 |
|
|
1988 |
|
|
| 1989 |
|
|
1989 |
|
|
| 1990 |
|
|
1990 |
|
|
| 1991 |
|
But can also be used to throw an exception on error:
|
1991 |
|
But can also be used to throw an exception on error:
|
| 1992 |
|
|
1992 |
|
|
| 1993 |
|
return jv.try_as_uint64().value();
|
1993 |
|
return jv.try_as_uint64().value();
|
| 1994 |
|
|
1994 |
|
|
| 1995 |
|
|
1995 |
|
|
| 1996 |
|
|
1996 |
|
|
| 1997 |
|
|
1997 |
|
|
| 1998 |
|
|
1998 |
|
|
| 1999 |
|
|
1999 |
|
|
| 2000 |
|
|
2000 |
|
|
| 2001 |
|
|
2001 |
|
|
| 2002 |
|
|
2002 |
|
|
| 2003 |
|
|
2003 |
|
|
| 2004 |
|
|
2004 |
|
|
| 2005 |
|
system::result<std::uint64_t&>
|
2005 |
|
system::result<std::uint64_t&>
|
| 2006 |
|
try_as_uint64() noexcept;
|
2006 |
|
try_as_uint64() noexcept;
|
| 2007 |
|
|
2007 |
|
|
| 2008 |
|
|
2008 |
|
|
| 2009 |
|
system::result<std::uint64_t>
|
2009 |
|
system::result<std::uint64_t>
|
| 2010 |
|
try_as_uint64() const noexcept;
|
2010 |
|
try_as_uint64() const noexcept;
|
| 2011 |
|
|
2011 |
|
|
| 2012 |
|
|
2012 |
|
|
| 2013 |
|
/** Return `result` with the underlying `double`
|
2013 |
|
/** Return `result` with the underlying `double`
|
| 2014 |
|
|
2014 |
|
|
| 2015 |
|
If @ref is_double() is `true`, the result contains a reference to **(1)**
|
2015 |
|
If @ref is_double() is `true`, the result contains a reference to **(1)**
|
| 2016 |
|
or a copy of **(2)** the underlying `double`, otherwise it
|
2016 |
|
or a copy of **(2)** the underlying `double`, otherwise it
|
| 2017 |
|
contains an `error_code`.
|
2017 |
|
contains an `error_code`.
|
| 2018 |
|
|
2018 |
|
|
| 2019 |
|
|
2019 |
|
|
| 2020 |
|
The return value can be used in both a boolean context and
|
2020 |
|
The return value can be used in both a boolean context and
|
| 2021 |
|
|
2021 |
|
|
| 2022 |
|
|
2022 |
|
|
| 2023 |
|
if( auto r = jv.try_as_double() )
|
2023 |
|
if( auto r = jv.try_as_double() )
|
| 2024 |
|
|
2024 |
|
|
| 2025 |
|
|
2025 |
|
|
| 2026 |
|
|
2026 |
|
|
| 2027 |
|
But can also be used to throw an exception on error:
|
2027 |
|
But can also be used to throw an exception on error:
|
| 2028 |
|
|
2028 |
|
|
| 2029 |
|
return jv.try_as_double().value();
|
2029 |
|
return jv.try_as_double().value();
|
| 2030 |
|
|
2030 |
|
|
| 2031 |
|
|
2031 |
|
|
| 2032 |
|
|
2032 |
|
|
| 2033 |
|
|
2033 |
|
|
| 2034 |
|
|
2034 |
|
|
| 2035 |
|
|
2035 |
|
|
| 2036 |
|
|
2036 |
|
|
| 2037 |
|
|
2037 |
|
|
| 2038 |
|
|
2038 |
|
|
| 2039 |
|
|
2039 |
|
|
| 2040 |
|
|
2040 |
|
|
| 2041 |
|
|
2041 |
|
|
| 2042 |
|
try_as_double() noexcept;
|
2042 |
|
try_as_double() noexcept;
|
| 2043 |
|
|
2043 |
|
|
| 2044 |
|
|
2044 |
|
|
| 2045 |
|
|
2045 |
|
|
| 2046 |
|
try_as_double() const noexcept;
|
2046 |
|
try_as_double() const noexcept;
|
| 2047 |
|
|
2047 |
|
|
| 2048 |
|
|
2048 |
|
|
| 2049 |
|
/** Return `result` with the underlying `bool`
|
2049 |
|
/** Return `result` with the underlying `bool`
|
| 2050 |
|
|
2050 |
|
|
| 2051 |
|
If @ref is_bool() is `true`, the result contains a reference to **(1)**
|
2051 |
|
If @ref is_bool() is `true`, the result contains a reference to **(1)**
|
| 2052 |
|
or a copy to **(2)** the underlying `bool`, otherwise it contains an
|
2052 |
|
or a copy to **(2)** the underlying `bool`, otherwise it contains an
|
| 2053 |
|
|
2053 |
|
|
| 2054 |
|
|
2054 |
|
|
| 2055 |
|
|
2055 |
|
|
| 2056 |
|
The return value can be used in both a boolean context and
|
2056 |
|
The return value can be used in both a boolean context and
|
| 2057 |
|
|
2057 |
|
|
| 2058 |
|
|
2058 |
|
|
| 2059 |
|
if( auto r = jv.try_as_bool() )
|
2059 |
|
if( auto r = jv.try_as_bool() )
|
| 2060 |
|
|
2060 |
|
|
| 2061 |
|
|
2061 |
|
|
| 2062 |
|
|
2062 |
|
|
| 2063 |
|
But can also be used to throw an exception on error:
|
2063 |
|
But can also be used to throw an exception on error:
|
| 2064 |
|
|
2064 |
|
|
| 2065 |
|
return jv.try_as_bool().value();
|
2065 |
|
return jv.try_as_bool().value();
|
| 2066 |
|
|
2066 |
|
|
| 2067 |
|
|
2067 |
|
|
| 2068 |
|
|
2068 |
|
|
| 2069 |
|
|
2069 |
|
|
| 2070 |
|
|
2070 |
|
|
| 2071 |
|
|
2071 |
|
|
| 2072 |
|
|
2072 |
|
|
| 2073 |
|
|
2073 |
|
|
| 2074 |
|
|
2074 |
|
|
| 2075 |
|
|
2075 |
|
|
| 2076 |
|
|
2076 |
|
|
| 2077 |
|
|
2077 |
|
|
| 2078 |
|
|
2078 |
|
|
| 2079 |
|
|
2079 |
|
|
| 2080 |
|
|
2080 |
|
|
| 2081 |
|
|
2081 |
|
|
| 2082 |
|
try_as_bool() const noexcept;
|
2082 |
|
try_as_bool() const noexcept;
|
| 2083 |
|
|
2083 |
|
|
| 2084 |
|
|
2084 |
|
|
| 2085 |
|
/** Return engaged `result` if the `value` is null.
|
2085 |
|
/** Return engaged `result` if the `value` is null.
|
| 2086 |
|
|
2086 |
|
|
| 2087 |
|
If @ref is_null() is `true`, the result is engaged, otherwise it
|
2087 |
|
If @ref is_null() is `true`, the result is engaged, otherwise it
|
| 2088 |
|
contains an `error_code`.
|
2088 |
|
contains an `error_code`.
|
| 2089 |
|
|
2089 |
|
|
| 2090 |
|
|
2090 |
|
|
| 2091 |
|
The return value can be used in both a boolean context and
|
2091 |
|
The return value can be used in both a boolean context and
|
| 2092 |
|
|
2092 |
|
|
| 2093 |
|
|
2093 |
|
|
| 2094 |
|
if( auto r = jv.try_as_null() )
|
2094 |
|
if( auto r = jv.try_as_null() )
|
| 2095 |
|
|
2095 |
|
|
| 2096 |
|
|
2096 |
|
|
| 2097 |
|
|
2097 |
|
|
| 2098 |
|
But can also be used to throw an exception on error:
|
2098 |
|
But can also be used to throw an exception on error:
|
| 2099 |
|
|
2099 |
|
|
| 2100 |
|
return jv.try_as_null().value();
|
2100 |
|
return jv.try_as_null().value();
|
| 2101 |
|
|
2101 |
|
|
| 2102 |
|
|
2102 |
|
|
| 2103 |
|
|
2103 |
|
|
| 2104 |
|
|
2104 |
|
|
| 2105 |
|
|
2105 |
|
|
| 2106 |
|
|
2106 |
|
|
| 2107 |
|
|
2107 |
|
|
| 2108 |
|
|
2108 |
|
|
| 2109 |
|
|
2109 |
|
|
| 2110 |
|
system::result<std::nullptr_t>
|
2110 |
|
system::result<std::nullptr_t>
|
| 2111 |
|
try_as_null() const noexcept;
|
2111 |
|
try_as_null() const noexcept;
|
| 2112 |
|
|
2112 |
|
|
| 2113 |
|
//------------------------------------------------------
|
2113 |
|
//------------------------------------------------------
|
| 2114 |
|
|
2114 |
|
|
| 2115 |
|
/** Return the underlying @ref object, or throw an exception.
|
2115 |
|
/** Return the underlying @ref object, or throw an exception.
|
| 2116 |
|
|
2116 |
|
|
| 2117 |
|
If @ref is_object() is `true`, returns a reference to the underlying
|
2117 |
|
If @ref is_object() is `true`, returns a reference to the underlying
|
| 2118 |
|
@ref object, otherwise throws an exception.
|
2118 |
|
@ref object, otherwise throws an exception.
|
| 2119 |
|
|
2119 |
|
|
| 2120 |
|
|
2120 |
|
|
| 2121 |
|
|
2121 |
|
|
| 2122 |
|
|
2122 |
|
|
| 2123 |
|
@throw boost::system::system_error `! this->is_object()`.
|
2123 |
|
@throw boost::system::system_error `! this->is_object()`.
|
| 2124 |
|
|
2124 |
|
|
| 2125 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
2125 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
| 2126 |
|
source location of the call site by default.
|
2126 |
|
source location of the call site by default.
|
| 2127 |
|
|
2127 |
|
|
| 2128 |
|
|
2128 |
|
|
| 2129 |
|
|
2129 |
|
|
| 2130 |
|
|
2130 |
|
|
| 2131 |
|
|
2131 |
|
|
| 2132 |
|
|
2132 |
|
|
| 2133 |
|
|
2133 |
|
|
| 2134 |
|
as_object(source_location const& loc = BOOST_CURRENT_LOCATION) &
|
2134 |
|
as_object(source_location const& loc = BOOST_CURRENT_LOCATION) &
|
| 2135 |
|
|
2135 |
|
|
| 2136 |
|
auto& self = const_cast<value const&>(*this);
|
2136 |
|
auto& self = const_cast<value const&>(*this);
|
| 2137 |
|
return const_cast<object&>( self.as_object(loc) );
|
2137 |
|
return const_cast<object&>( self.as_object(loc) );
|
| 2138 |
|
|
2138 |
|
|
| 2139 |
|
|
2139 |
|
|
| 2140 |
|
|
2140 |
|
|
| 2141 |
|
|
2141 |
|
|
| 2142 |
|
as_object(source_location const& loc = BOOST_CURRENT_LOCATION) &&
|
2142 |
|
as_object(source_location const& loc = BOOST_CURRENT_LOCATION) &&
|
| 2143 |
|
|
2143 |
|
|
| 2144 |
|
return std::move( as_object(loc) );
|
2144 |
|
return std::move( as_object(loc) );
|
| 2145 |
|
|
2145 |
|
|
| 2146 |
|
|
2146 |
|
|
| 2147 |
|
|
2147 |
|
|
| 2148 |
|
|
2148 |
|
|
| 2149 |
|
|
2149 |
|
|
| 2150 |
|
as_object(source_location const& loc = BOOST_CURRENT_LOCATION) const&;
|
2150 |
|
as_object(source_location const& loc = BOOST_CURRENT_LOCATION) const&;
|
| 2151 |
|
|
2151 |
|
|
| 2152 |
|
|
2152 |
|
|
| 2153 |
|
/** Return the underlying @ref array, or throw an exception.
|
2153 |
|
/** Return the underlying @ref array, or throw an exception.
|
| 2154 |
|
|
2154 |
|
|
| 2155 |
|
If @ref is_array() is `true`, returns a reference to the underlying
|
2155 |
|
If @ref is_array() is `true`, returns a reference to the underlying
|
| 2156 |
|
@ref array, otherwise throws an exception.
|
2156 |
|
@ref array, otherwise throws an exception.
|
| 2157 |
|
|
2157 |
|
|
| 2158 |
|
|
2158 |
|
|
| 2159 |
|
|
2159 |
|
|
| 2160 |
|
|
2160 |
|
|
| 2161 |
|
@throw boost::system::system_error `! this->is_array()`.
|
2161 |
|
@throw boost::system::system_error `! this->is_array()`.
|
| 2162 |
|
|
2162 |
|
|
| 2163 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
2163 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
| 2164 |
|
source location of the call site by default.
|
2164 |
|
source location of the call site by default.
|
| 2165 |
|
|
2165 |
|
|
| 2166 |
|
|
2166 |
|
|
| 2167 |
|
|
2167 |
|
|
| 2168 |
|
|
2168 |
|
|
| 2169 |
|
|
2169 |
|
|
| 2170 |
|
|
2170 |
|
|
| 2171 |
|
|
2171 |
|
|
| 2172 |
|
as_array(source_location const& loc = BOOST_CURRENT_LOCATION) &
|
2172 |
|
as_array(source_location const& loc = BOOST_CURRENT_LOCATION) &
|
| 2173 |
|
|
2173 |
|
|
| 2174 |
|
auto& self = const_cast<value const&>(*this);
|
2174 |
|
auto& self = const_cast<value const&>(*this);
|
| 2175 |
|
return const_cast<array&>( self.as_array(loc) );
|
2175 |
|
return const_cast<array&>( self.as_array(loc) );
|
| 2176 |
|
|
2176 |
|
|
| 2177 |
|
|
2177 |
|
|
| 2178 |
|
|
2178 |
|
|
| 2179 |
|
|
2179 |
|
|
| 2180 |
|
as_array(source_location const& loc = BOOST_CURRENT_LOCATION) &&
|
2180 |
|
as_array(source_location const& loc = BOOST_CURRENT_LOCATION) &&
|
| 2181 |
|
|
2181 |
|
|
| 2182 |
|
return std::move( as_array(loc) );
|
2182 |
|
return std::move( as_array(loc) );
|
| 2183 |
|
|
2183 |
|
|
| 2184 |
|
|
2184 |
|
|
| 2185 |
|
|
2185 |
|
|
| 2186 |
|
|
2186 |
|
|
| 2187 |
|
|
2187 |
|
|
| 2188 |
|
as_array(source_location const& loc = BOOST_CURRENT_LOCATION) const&;
|
2188 |
|
as_array(source_location const& loc = BOOST_CURRENT_LOCATION) const&;
|
| 2189 |
|
|
2189 |
|
|
| 2190 |
|
|
2190 |
|
|
| 2191 |
|
/** Return the underlying @ref string, or throw an exception.
|
2191 |
|
/** Return the underlying @ref string, or throw an exception.
|
| 2192 |
|
|
2192 |
|
|
| 2193 |
|
If @ref is_string() is `true`, returns a reference to the underlying
|
2193 |
|
If @ref is_string() is `true`, returns a reference to the underlying
|
| 2194 |
|
@ref string, otherwise throws an exception.
|
2194 |
|
@ref string, otherwise throws an exception.
|
| 2195 |
|
|
2195 |
|
|
| 2196 |
|
|
2196 |
|
|
| 2197 |
|
|
2197 |
|
|
| 2198 |
|
|
2198 |
|
|
| 2199 |
|
@throw boost::system::system_error `! this->is_string()`.
|
2199 |
|
@throw boost::system::system_error `! this->is_string()`.
|
| 2200 |
|
|
2200 |
|
|
| 2201 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
2201 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
| 2202 |
|
source location of the call site by default.
|
2202 |
|
source location of the call site by default.
|
| 2203 |
|
|
2203 |
|
|
| 2204 |
|
|
2204 |
|
|
| 2205 |
|
|
2205 |
|
|
| 2206 |
|
|
2206 |
|
|
| 2207 |
|
|
2207 |
|
|
| 2208 |
|
|
2208 |
|
|
| 2209 |
|
|
2209 |
|
|
| 2210 |
|
as_string(source_location const& loc = BOOST_CURRENT_LOCATION) &
|
2210 |
|
as_string(source_location const& loc = BOOST_CURRENT_LOCATION) &
|
| 2211 |
|
|
2211 |
|
|
| 2212 |
|
auto& self = const_cast<value const&>(*this);
|
2212 |
|
auto& self = const_cast<value const&>(*this);
|
| 2213 |
|
return const_cast<string&>( self.as_string(loc) );
|
2213 |
|
return const_cast<string&>( self.as_string(loc) );
|
| 2214 |
|
|
2214 |
|
|
| 2215 |
|
|
2215 |
|
|
| 2216 |
|
|
2216 |
|
|
| 2217 |
|
|
2217 |
|
|
| 2218 |
|
as_string(source_location const& loc = BOOST_CURRENT_LOCATION) &&
|
2218 |
|
as_string(source_location const& loc = BOOST_CURRENT_LOCATION) &&
|
| 2219 |
|
|
2219 |
|
|
| 2220 |
|
return std::move( as_string(loc) );
|
2220 |
|
return std::move( as_string(loc) );
|
| 2221 |
|
|
2221 |
|
|
| 2222 |
|
|
2222 |
|
|
| 2223 |
|
|
2223 |
|
|
| 2224 |
|
|
2224 |
|
|
| 2225 |
|
|
2225 |
|
|
| 2226 |
|
as_string(source_location const& loc = BOOST_CURRENT_LOCATION) const&;
|
2226 |
|
as_string(source_location const& loc = BOOST_CURRENT_LOCATION) const&;
|
| 2227 |
|
|
2227 |
|
|
| 2228 |
|
|
2228 |
|
|
| 2229 |
|
/** Return the underlying `std::int64_t`, or throw an exception.
|
2229 |
|
/** Return the underlying `std::int64_t`, or throw an exception.
|
| 2230 |
|
|
2230 |
|
|
| 2231 |
|
If @ref is_int64() is `true`, returns a reference to **(1)** or a copy
|
2231 |
|
If @ref is_int64() is `true`, returns a reference to **(1)** or a copy
|
| 2232 |
|
of **(2)** the underlying `std::int64_t`, otherwise throws an
|
2232 |
|
of **(2)** the underlying `std::int64_t`, otherwise throws an
|
| 2233 |
|
|
2233 |
|
|
| 2234 |
|
|
2234 |
|
|
| 2235 |
|
@note This function is the intended for direct access to the underlying
|
2235 |
|
@note This function is the intended for direct access to the underlying
|
| 2236 |
|
object, __if__ it has the type `std::int64_t`. It does not convert the
|
2236 |
|
object, __if__ it has the type `std::int64_t`. It does not convert the
|
| 2237 |
|
underlying object to the type `std::int64_t` even if a lossless
|
2237 |
|
underlying object to the type `std::int64_t` even if a lossless
|
| 2238 |
|
conversion is possible. If you are not sure which kind your `value`
|
2238 |
|
conversion is possible. If you are not sure which kind your `value`
|
| 2239 |
|
has, and you only care about getting a `std::int64_t` number, consider
|
2239 |
|
has, and you only care about getting a `std::int64_t` number, consider
|
| 2240 |
|
using @ref to_number instead.
|
2240 |
|
using @ref to_number instead.
|
| 2241 |
|
|
2241 |
|
|
| 2242 |
|
|
2242 |
|
|
| 2243 |
|
|
2243 |
|
|
| 2244 |
|
|
2244 |
|
|
| 2245 |
|
@throw boost::system::system_error `! this->is_int64()`.
|
2245 |
|
@throw boost::system::system_error `! this->is_int64()`.
|
| 2246 |
|
|
2246 |
|
|
| 2247 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
2247 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
| 2248 |
|
source location of the call site by default.
|
2248 |
|
source location of the call site by default.
|
| 2249 |
|
|
2249 |
|
|
| 2250 |
|
|
2250 |
|
|
| 2251 |
|
|
2251 |
|
|
| 2252 |
|
|
2252 |
|
|
| 2253 |
|
|
2253 |
|
|
| 2254 |
|
|
2254 |
|
|
| 2255 |
|
|
2255 |
|
|
| 2256 |
|
|
2256 |
|
|
| 2257 |
|
as_int64(source_location const& loc = BOOST_CURRENT_LOCATION);
|
2257 |
|
as_int64(source_location const& loc = BOOST_CURRENT_LOCATION);
|
| 2258 |
|
|
2258 |
|
|
| 2259 |
|
|
2259 |
|
|
| 2260 |
|
|
2260 |
|
|
| 2261 |
|
|
2261 |
|
|
| 2262 |
|
as_int64(source_location const& loc = BOOST_CURRENT_LOCATION) const;
|
2262 |
|
as_int64(source_location const& loc = BOOST_CURRENT_LOCATION) const;
|
| 2263 |
|
|
2263 |
|
|
| 2264 |
|
|
2264 |
|
|
| 2265 |
|
/** Return the underlying `std::uint64_t`, or throw an exception.
|
2265 |
|
/** Return the underlying `std::uint64_t`, or throw an exception.
|
| 2266 |
|
|
2266 |
|
|
| 2267 |
|
If @ref is_uint64() is `true`, returns a reference to **(1)** or a
|
2267 |
|
If @ref is_uint64() is `true`, returns a reference to **(1)** or a
|
| 2268 |
|
copy of **(2)** the underlying `std::uint64_t`, otherwise throws an
|
2268 |
|
copy of **(2)** the underlying `std::uint64_t`, otherwise throws an
|
| 2269 |
|
|
2269 |
|
|
| 2270 |
|
|
2270 |
|
|
| 2271 |
|
@note This function is intended for direct access to the underlying
|
2271 |
|
@note This function is intended for direct access to the underlying
|
| 2272 |
|
object, __if__ it has the type `std::uint64_t`. It does not convert the
|
2272 |
|
object, __if__ it has the type `std::uint64_t`. It does not convert the
|
| 2273 |
|
underlying object to the type `std::uint64_t` even if a lossless
|
2273 |
|
underlying object to the type `std::uint64_t` even if a lossless
|
| 2274 |
|
conversion is possible. If you are not sure which kind your `value`
|
2274 |
|
conversion is possible. If you are not sure which kind your `value`
|
| 2275 |
|
has, and you only care about getting a `std::uint64_t` number, consider
|
2275 |
|
has, and you only care about getting a `std::uint64_t` number, consider
|
| 2276 |
|
using @ref to_number instead.
|
2276 |
|
using @ref to_number instead.
|
| 2277 |
|
|
2277 |
|
|
| 2278 |
|
|
2278 |
|
|
| 2279 |
|
|
2279 |
|
|
| 2280 |
|
|
2280 |
|
|
| 2281 |
|
@throw boost::system::system_error `! this->is_uint64()`.
|
2281 |
|
@throw boost::system::system_error `! this->is_uint64()`.
|
| 2282 |
|
|
2282 |
|
|
| 2283 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
2283 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
| 2284 |
|
source location of the call site by default.
|
2284 |
|
source location of the call site by default.
|
| 2285 |
|
|
2285 |
|
|
| 2286 |
|
|
2286 |
|
|
| 2287 |
|
|
2287 |
|
|
| 2288 |
|
|
2288 |
|
|
| 2289 |
|
|
2289 |
|
|
| 2290 |
|
|
2290 |
|
|
| 2291 |
|
|
2291 |
|
|
| 2292 |
|
|
2292 |
|
|
| 2293 |
|
as_uint64(source_location const& loc = BOOST_CURRENT_LOCATION);
|
2293 |
|
as_uint64(source_location const& loc = BOOST_CURRENT_LOCATION);
|
| 2294 |
|
|
2294 |
|
|
| 2295 |
|
|
2295 |
|
|
| 2296 |
|
|
2296 |
|
|
| 2297 |
|
|
2297 |
|
|
| 2298 |
|
as_uint64(source_location const& loc = BOOST_CURRENT_LOCATION) const;
|
2298 |
|
as_uint64(source_location const& loc = BOOST_CURRENT_LOCATION) const;
|
| 2299 |
|
|
2299 |
|
|
| 2300 |
|
|
2300 |
|
|
| 2301 |
|
/** Return the underlying `double`, or throw an exception.
|
2301 |
|
/** Return the underlying `double`, or throw an exception.
|
| 2302 |
|
|
2302 |
|
|
| 2303 |
|
If @ref is_double() is `true`, returns a reference to **(1)** or a copy
|
2303 |
|
If @ref is_double() is `true`, returns a reference to **(1)** or a copy
|
| 2304 |
|
of **(2)** the underlying `double`, otherwise throws an exception.
|
2304 |
|
of **(2)** the underlying `double`, otherwise throws an exception.
|
| 2305 |
|
|
2305 |
|
|
| 2306 |
|
@note This function is intended for direct access to the underlying
|
2306 |
|
@note This function is intended for direct access to the underlying
|
| 2307 |
|
object, __if__ it has the type `double`. It does not convert the
|
2307 |
|
object, __if__ it has the type `double`. It does not convert the
|
| 2308 |
|
underlying object to type `double` even if a lossless conversion is
|
2308 |
|
underlying object to type `double` even if a lossless conversion is
|
| 2309 |
|
possible. If you are not sure which kind your `value` has, and you only
|
2309 |
|
possible. If you are not sure which kind your `value` has, and you only
|
| 2310 |
|
care about getting a `double` number, consider using @ref to_number
|
2310 |
|
care about getting a `double` number, consider using @ref to_number
|
| 2311 |
|
|
2311 |
|
|
| 2312 |
|
|
2312 |
|
|
| 2313 |
|
|
2313 |
|
|
| 2314 |
|
|
2314 |
|
|
| 2315 |
|
|
2315 |
|
|
| 2316 |
|
@throw boost::system::system_error `! this->is_double()`.
|
2316 |
|
@throw boost::system::system_error `! this->is_double()`.
|
| 2317 |
|
|
2317 |
|
|
| 2318 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
2318 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
| 2319 |
|
source location of the call site by default.
|
2319 |
|
source location of the call site by default.
|
| 2320 |
|
|
2320 |
|
|
| 2321 |
|
|
2321 |
|
|
| 2322 |
|
|
2322 |
|
|
| 2323 |
|
|
2323 |
|
|
| 2324 |
|
|
2324 |
|
|
| 2325 |
|
|
2325 |
|
|
| 2326 |
|
|
2326 |
|
|
| 2327 |
|
|
2327 |
|
|
| 2328 |
|
as_double(source_location const& loc = BOOST_CURRENT_LOCATION);
|
2328 |
|
as_double(source_location const& loc = BOOST_CURRENT_LOCATION);
|
| 2329 |
|
|
2329 |
|
|
| 2330 |
|
|
2330 |
|
|
| 2331 |
|
|
2331 |
|
|
| 2332 |
|
|
2332 |
|
|
| 2333 |
|
as_double(source_location const& loc = BOOST_CURRENT_LOCATION) const;
|
2333 |
|
as_double(source_location const& loc = BOOST_CURRENT_LOCATION) const;
|
| 2334 |
|
|
2334 |
|
|
| 2335 |
|
|
2335 |
|
|
| 2336 |
|
/** Return the underlying `bool`, or throw an exception.
|
2336 |
|
/** Return the underlying `bool`, or throw an exception.
|
| 2337 |
|
|
2337 |
|
|
| 2338 |
|
If @ref is_bool() is `true`, returns a reference to **(1)** or a copy
|
2338 |
|
If @ref is_bool() is `true`, returns a reference to **(1)** or a copy
|
| 2339 |
|
of **(2)** the underlying `bool`, otherwise throws an exception.
|
2339 |
|
of **(2)** the underlying `bool`, otherwise throws an exception.
|
| 2340 |
|
|
2340 |
|
|
| 2341 |
|
|
2341 |
|
|
| 2342 |
|
|
2342 |
|
|
| 2343 |
|
|
2343 |
|
|
| 2344 |
|
@throw boost::system::system_error `! this->is_bool()`.
|
2344 |
|
@throw boost::system::system_error `! this->is_bool()`.
|
| 2345 |
|
|
2345 |
|
|
| 2346 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
2346 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
| 2347 |
|
source location of the call site by default.
|
2347 |
|
source location of the call site by default.
|
| 2348 |
|
|
2348 |
|
|
| 2349 |
|
|
2349 |
|
|
| 2350 |
|
|
2350 |
|
|
| 2351 |
|
|
2351 |
|
|
| 2352 |
|
|
2352 |
|
|
| 2353 |
|
|
2353 |
|
|
| 2354 |
|
|
2354 |
|
|
| 2355 |
|
|
2355 |
|
|
| 2356 |
|
as_bool(source_location const& loc = BOOST_CURRENT_LOCATION);
|
2356 |
|
as_bool(source_location const& loc = BOOST_CURRENT_LOCATION);
|
| 2357 |
|
|
2357 |
|
|
| 2358 |
|
|
2358 |
|
|
| 2359 |
|
|
2359 |
|
|
| 2360 |
|
|
2360 |
|
|
| 2361 |
|
as_bool(source_location const& loc = BOOST_CURRENT_LOCATION) const;
|
2361 |
|
as_bool(source_location const& loc = BOOST_CURRENT_LOCATION) const;
|
| 2362 |
|
|
2362 |
|
|
| 2363 |
|
|
2363 |
|
|
| 2364 |
|
//------------------------------------------------------
|
2364 |
|
//------------------------------------------------------
|
| 2365 |
|
|
2365 |
|
|
| 2366 |
|
/** Return the underlying @ref object, without checking.
|
2366 |
|
/** Return the underlying @ref object, without checking.
|
| 2367 |
|
|
2367 |
|
|
| 2368 |
|
This is the fastest way to access the underlying representation when
|
2368 |
|
This is the fastest way to access the underlying representation when
|
| 2369 |
|
the kind is known in advance.
|
2369 |
|
the kind is known in advance.
|
| 2370 |
|
|
2370 |
|
|
| 2371 |
|
|
2371 |
|
|
| 2372 |
|
|
2372 |
|
|
| 2373 |
|
|
2373 |
|
|
| 2374 |
|
|
2374 |
|
|
| 2375 |
|
|
2375 |
|
|
| 2376 |
|
|
2376 |
|
|
| 2377 |
|
|
2377 |
|
|
| 2378 |
|
|
2378 |
|
|
| 2379 |
|
|
2379 |
|
|
| 2380 |
|
|
2380 |
|
|
| 2381 |
|
|
2381 |
|
|
| 2382 |
|
|
2382 |
|
|
| 2383 |
|
|
2383 |
|
|
| 2384 |
|
|
2384 |
|
|
| 2385 |
|
|
2385 |
|
|
| 2386 |
|
|
2386 |
|
|
| 2387 |
|
|
2387 |
|
|
| 2388 |
|
BOOST_ASSERT(is_object());
|
2388 |
|
BOOST_ASSERT(is_object());
|
| 2389 |
|
|
2389 |
|
|
| 2390 |
|
|
2390 |
|
|
| 2391 |
|
|
2391 |
|
|
| 2392 |
|
|
2392 |
|
|
| 2393 |
|
|
2393 |
|
|
| 2394 |
|
|
2394 |
|
|
| 2395 |
|
BOOST_ASSERT(is_object());
|
2395 |
|
BOOST_ASSERT(is_object());
|
| 2396 |
|
|
2396 |
|
|
| 2397 |
|
|
2397 |
|
|
| 2398 |
|
|
2398 |
|
|
| 2399 |
|
|
2399 |
|
|
| 2400 |
|
get_object() const& noexcept
|
2400 |
|
get_object() const& noexcept
|
| 2401 |
|
|
2401 |
|
|
| 2402 |
|
BOOST_ASSERT(is_object());
|
2402 |
|
BOOST_ASSERT(is_object());
|
| 2403 |
|
|
2403 |
|
|
| 2404 |
|
|
2404 |
|
|
| 2405 |
|
|
2405 |
|
|
| 2406 |
|
|
2406 |
|
|
| 2407 |
|
/** Return the underlying @ref array, without checking.
|
2407 |
|
/** Return the underlying @ref array, without checking.
|
| 2408 |
|
|
2408 |
|
|
| 2409 |
|
This is the fastest way to access the underlying representation when
|
2409 |
|
This is the fastest way to access the underlying representation when
|
| 2410 |
|
the kind is known in advance.
|
2410 |
|
the kind is known in advance.
|
| 2411 |
|
|
2411 |
|
|
| 2412 |
|
|
2412 |
|
|
| 2413 |
|
|
2413 |
|
|
| 2414 |
|
|
2414 |
|
|
| 2415 |
|
|
2415 |
|
|
| 2416 |
|
|
2416 |
|
|
| 2417 |
|
|
2417 |
|
|
| 2418 |
|
|
2418 |
|
|
| 2419 |
|
|
2419 |
|
|
| 2420 |
|
|
2420 |
|
|
| 2421 |
|
|
2421 |
|
|
| 2422 |
|
|
2422 |
|
|
| 2423 |
|
|
2423 |
|
|
| 2424 |
|
|
2424 |
|
|
| 2425 |
|
|
2425 |
|
|
| 2426 |
|
|
2426 |
|
|
| 2427 |
|
|
2427 |
|
|
| 2428 |
|
|
2428 |
|
|
| 2429 |
|
BOOST_ASSERT(is_array());
|
2429 |
|
BOOST_ASSERT(is_array());
|
| 2430 |
|
|
2430 |
|
|
| 2431 |
|
|
2431 |
|
|
| 2432 |
|
|
2432 |
|
|
| 2433 |
|
|
2433 |
|
|
| 2434 |
|
|
2434 |
|
|
| 2435 |
|
|
2435 |
|
|
| 2436 |
|
BOOST_ASSERT(is_array());
|
2436 |
|
BOOST_ASSERT(is_array());
|
| 2437 |
|
|
2437 |
|
|
| 2438 |
|
|
2438 |
|
|
| 2439 |
|
|
2439 |
|
|
| 2440 |
|
|
2440 |
|
|
| 2441 |
|
get_array() const& noexcept
|
2441 |
|
get_array() const& noexcept
|
| 2442 |
|
|
2442 |
|
|
| 2443 |
|
BOOST_ASSERT(is_array());
|
2443 |
|
BOOST_ASSERT(is_array());
|
| 2444 |
|
|
2444 |
|
|
| 2445 |
|
|
2445 |
|
|
| 2446 |
|
|
2446 |
|
|
| 2447 |
|
|
2447 |
|
|
| 2448 |
|
/** Return the underlying @ref string, without checking.
|
2448 |
|
/** Return the underlying @ref string, without checking.
|
| 2449 |
|
|
2449 |
|
|
| 2450 |
|
This is the fastest way to access the underlying representation when
|
2450 |
|
This is the fastest way to access the underlying representation when
|
| 2451 |
|
the kind is known in advance.
|
2451 |
|
the kind is known in advance.
|
| 2452 |
|
|
2452 |
|
|
| 2453 |
|
|
2453 |
|
|
| 2454 |
|
|
2454 |
|
|
| 2455 |
|
|
2455 |
|
|
| 2456 |
|
|
2456 |
|
|
| 2457 |
|
|
2457 |
|
|
| 2458 |
|
|
2458 |
|
|
| 2459 |
|
|
2459 |
|
|
| 2460 |
|
|
2460 |
|
|
| 2461 |
|
|
2461 |
|
|
| 2462 |
|
|
2462 |
|
|
| 2463 |
|
|
2463 |
|
|
| 2464 |
|
|
2464 |
|
|
| 2465 |
|
|
2465 |
|
|
| 2466 |
|
|
2466 |
|
|
| 2467 |
|
|
2467 |
|
|
| 2468 |
|
|
2468 |
|
|
| 2469 |
|
|
2469 |
|
|
| 2470 |
|
BOOST_ASSERT(is_string());
|
2470 |
|
BOOST_ASSERT(is_string());
|
| 2471 |
|
|
2471 |
|
|
| 2472 |
|
|
2472 |
|
|
| 2473 |
|
|
2473 |
|
|
| 2474 |
|
|
2474 |
|
|
| 2475 |
|
|
2475 |
|
|
| 2476 |
|
|
2476 |
|
|
| 2477 |
|
BOOST_ASSERT(is_string());
|
2477 |
|
BOOST_ASSERT(is_string());
|
| 2478 |
|
|
2478 |
|
|
| 2479 |
|
|
2479 |
|
|
| 2480 |
|
|
2480 |
|
|
| 2481 |
|
|
2481 |
|
|
| 2482 |
|
get_string() const& noexcept
|
2482 |
|
get_string() const& noexcept
|
| 2483 |
|
|
2483 |
|
|
| 2484 |
|
BOOST_ASSERT(is_string());
|
2484 |
|
BOOST_ASSERT(is_string());
|
| 2485 |
|
|
2485 |
|
|
| 2486 |
|
|
2486 |
|
|
| 2487 |
|
|
2487 |
|
|
| 2488 |
|
|
2488 |
|
|
| 2489 |
|
/** Return the underlying `std::int64_t`, without checking.
|
2489 |
|
/** Return the underlying `std::int64_t`, without checking.
|
| 2490 |
|
|
2490 |
|
|
| 2491 |
|
This is the fastest way to access the underlying representation when
|
2491 |
|
This is the fastest way to access the underlying representation when
|
| 2492 |
|
the kind is known in advance.
|
2492 |
|
the kind is known in advance.
|
| 2493 |
|
|
2493 |
|
|
| 2494 |
|
|
2494 |
|
|
| 2495 |
|
|
2495 |
|
|
| 2496 |
|
|
2496 |
|
|
| 2497 |
|
|
2497 |
|
|
| 2498 |
|
|
2498 |
|
|
| 2499 |
|
|
2499 |
|
|
| 2500 |
|
|
2500 |
|
|
| 2501 |
|
|
2501 |
|
|
| 2502 |
|
|
2502 |
|
|
| 2503 |
|
|
2503 |
|
|
| 2504 |
|
|
2504 |
|
|
| 2505 |
|
|
2505 |
|
|
| 2506 |
|
|
2506 |
|
|
| 2507 |
|
|
2507 |
|
|
| 2508 |
|
|
2508 |
|
|
| 2509 |
|
|
2509 |
|
|
| 2510 |
|
|
2510 |
|
|
| 2511 |
|
BOOST_ASSERT(is_int64());
|
2511 |
|
BOOST_ASSERT(is_int64());
|
| 2512 |
|
|
2512 |
|
|
| 2513 |
|
|
2513 |
|
|
| 2514 |
|
|
2514 |
|
|
| 2515 |
|
|
2515 |
|
|
| 2516 |
|
get_int64() const noexcept
|
2516 |
|
get_int64() const noexcept
|
| 2517 |
|
|
2517 |
|
|
| 2518 |
|
BOOST_ASSERT(is_int64());
|
2518 |
|
BOOST_ASSERT(is_int64());
|
| 2519 |
|
|
2519 |
|
|
| 2520 |
|
|
2520 |
|
|
| 2521 |
|
|
2521 |
|
|
| 2522 |
|
|
2522 |
|
|
| 2523 |
|
/** Return the underlying `std::uint64_t`, without checking.
|
2523 |
|
/** Return the underlying `std::uint64_t`, without checking.
|
| 2524 |
|
|
2524 |
|
|
| 2525 |
|
This is the fastest way to access the underlying representation when
|
2525 |
|
This is the fastest way to access the underlying representation when
|
| 2526 |
|
the kind is known in advance.
|
2526 |
|
the kind is known in advance.
|
| 2527 |
|
|
2527 |
|
|
| 2528 |
|
|
2528 |
|
|
| 2529 |
|
|
2529 |
|
|
| 2530 |
|
|
2530 |
|
|
| 2531 |
|
|
2531 |
|
|
| 2532 |
|
|
2532 |
|
|
| 2533 |
|
|
2533 |
|
|
| 2534 |
|
|
2534 |
|
|
| 2535 |
|
|
2535 |
|
|
| 2536 |
|
|
2536 |
|
|
| 2537 |
|
|
2537 |
|
|
| 2538 |
|
|
2538 |
|
|
| 2539 |
|
|
2539 |
|
|
| 2540 |
|
|
2540 |
|
|
| 2541 |
|
|
2541 |
|
|
| 2542 |
|
|
2542 |
|
|
| 2543 |
|
|
2543 |
|
|
| 2544 |
|
|
2544 |
|
|
| 2545 |
|
BOOST_ASSERT(is_uint64());
|
2545 |
|
BOOST_ASSERT(is_uint64());
|
| 2546 |
|
|
2546 |
|
|
| 2547 |
|
|
2547 |
|
|
| 2548 |
|
|
2548 |
|
|
| 2549 |
|
|
2549 |
|
|
| 2550 |
|
get_uint64() const noexcept
|
2550 |
|
get_uint64() const noexcept
|
| 2551 |
|
|
2551 |
|
|
| 2552 |
|
BOOST_ASSERT(is_uint64());
|
2552 |
|
BOOST_ASSERT(is_uint64());
|
| 2553 |
|
|
2553 |
|
|
| 2554 |
|
|
2554 |
|
|
| 2555 |
|
|
2555 |
|
|
| 2556 |
|
|
2556 |
|
|
| 2557 |
|
/** Return the underlying `double`, without checking.
|
2557 |
|
/** Return the underlying `double`, without checking.
|
| 2558 |
|
|
2558 |
|
|
| 2559 |
|
This is the fastest way to access the underlying
|
2559 |
|
This is the fastest way to access the underlying
|
| 2560 |
|
representation when the kind is known in advance.
|
2560 |
|
representation when the kind is known in advance.
|
| 2561 |
|
|
2561 |
|
|
| 2562 |
|
|
2562 |
|
|
| 2563 |
|
|
2563 |
|
|
| 2564 |
|
|
2564 |
|
|
| 2565 |
|
|
2565 |
|
|
| 2566 |
|
|
2566 |
|
|
| 2567 |
|
|
2567 |
|
|
| 2568 |
|
|
2568 |
|
|
| 2569 |
|
|
2569 |
|
|
| 2570 |
|
|
2570 |
|
|
| 2571 |
|
|
2571 |
|
|
| 2572 |
|
|
2572 |
|
|
| 2573 |
|
|
2573 |
|
|
| 2574 |
|
|
2574 |
|
|
| 2575 |
|
|
2575 |
|
|
| 2576 |
|
|
2576 |
|
|
| 2577 |
|
|
2577 |
|
|
| 2578 |
|
|
2578 |
|
|
| 2579 |
|
BOOST_ASSERT(is_double());
|
2579 |
|
BOOST_ASSERT(is_double());
|
| 2580 |
|
|
2580 |
|
|
| 2581 |
|
|
2581 |
|
|
| 2582 |
|
|
2582 |
|
|
| 2583 |
|
|
2583 |
|
|
| 2584 |
|
get_double() const noexcept
|
2584 |
|
get_double() const noexcept
|
| 2585 |
|
|
2585 |
|
|
| 2586 |
|
BOOST_ASSERT(is_double());
|
2586 |
|
BOOST_ASSERT(is_double());
|
| 2587 |
|
|
2587 |
|
|
| 2588 |
|
|
2588 |
|
|
| 2589 |
|
|
2589 |
|
|
| 2590 |
|
|
2590 |
|
|
| 2591 |
|
/** Return the underlying `bool`, without checking.
|
2591 |
|
/** Return the underlying `bool`, without checking.
|
| 2592 |
|
|
2592 |
|
|
| 2593 |
|
This is the fastest way to access the underlying representation when
|
2593 |
|
This is the fastest way to access the underlying representation when
|
| 2594 |
|
the kind is known in advance.
|
2594 |
|
the kind is known in advance.
|
| 2595 |
|
|
2595 |
|
|
| 2596 |
|
|
2596 |
|
|
| 2597 |
|
|
2597 |
|
|
| 2598 |
|
|
2598 |
|
|
| 2599 |
|
|
2599 |
|
|
| 2600 |
|
|
2600 |
|
|
| 2601 |
|
|
2601 |
|
|
| 2602 |
|
|
2602 |
|
|
| 2603 |
|
|
2603 |
|
|
| 2604 |
|
|
2604 |
|
|
| 2605 |
|
|
2605 |
|
|
| 2606 |
|
|
2606 |
|
|
| 2607 |
|
|
2607 |
|
|
| 2608 |
|
|
2608 |
|
|
| 2609 |
|
|
2609 |
|
|
| 2610 |
|
|
2610 |
|
|
| 2611 |
|
|
2611 |
|
|
| 2612 |
|
|
2612 |
|
|
| 2613 |
|
|
2613 |
|
|
| 2614 |
|
|
2614 |
|
|
| 2615 |
|
|
2615 |
|
|
| 2616 |
|
|
2616 |
|
|
| 2617 |
|
|
2617 |
|
|
| 2618 |
|
get_bool() const noexcept
|
2618 |
|
get_bool() const noexcept
|
| 2619 |
|
|
2619 |
|
|
| 2620 |
|
|
2620 |
|
|
| 2621 |
|
|
2621 |
|
|
| 2622 |
|
|
2622 |
|
|
| 2623 |
|
|
2623 |
|
|
| 2624 |
|
|
2624 |
|
|
| 2625 |
|
//------------------------------------------------------
|
2625 |
|
//------------------------------------------------------
|
| 2626 |
|
|
2626 |
|
|
| 2627 |
|
/** Access an element, with bounds checking.
|
2627 |
|
/** Access an element, with bounds checking.
|
| 2628 |
|
|
2628 |
|
|
| 2629 |
|
Returns `boost::system::result` containing a reference to the element
|
2629 |
|
Returns `boost::system::result` containing a reference to the element
|
| 2630 |
|
of the underlying ccontainer, if such element exists. If the underlying
|
2630 |
|
of the underlying ccontainer, if such element exists. If the underlying
|
| 2631 |
|
value is not a container of the suitable type or the container doesn't
|
2631 |
|
value is not a container of the suitable type or the container doesn't
|
| 2632 |
|
have a corresponding element the result contains an `error_code`.
|
2632 |
|
have a corresponding element the result contains an `error_code`.
|
| 2633 |
|
|
2633 |
|
|
| 2634 |
|
, if `pos` is within its range. If `pos` is
|
2634 |
|
, if `pos` is within its range. If `pos` is
|
| 2635 |
|
outside of that range, or the underlying value is not an object the
|
2635 |
|
outside of that range, or the underlying value is not an object the
|
| 2636 |
|
|
2636 |
|
|
| 2637 |
|
Returns @ref boost::system::result containing a reference to the
|
2637 |
|
Returns @ref boost::system::result containing a reference to the
|
| 2638 |
|
element of the underlying @ref array, if `pos` is within its range. If
|
2638 |
|
element of the underlying @ref array, if `pos` is within its range. If
|
| 2639 |
|
`pos` is outside of that range, or the underlying value is not an array
|
2639 |
|
`pos` is outside of that range, or the underlying value is not an array
|
| 2640 |
|
the result contains an `error_code`.
|
2640 |
|
the result contains an `error_code`.
|
| 2641 |
|
|
2641 |
|
|
| 2642 |
|
This function is used to access elements of
|
2642 |
|
This function is used to access elements of
|
| 2643 |
|
the underlying container, or throw an exception if that could not be
|
2643 |
|
the underlying container, or throw an exception if that could not be
|
| 2644 |
|
|
2644 |
|
|
| 2645 |
|
|
2645 |
|
|
| 2646 |
|
@li **(1)**, **(2)** require the underlying container to be an
|
2646 |
|
@li **(1)**, **(2)** require the underlying container to be an
|
| 2647 |
|
@ref object, and look for an element with the key `key`.
|
2647 |
|
@ref object, and look for an element with the key `key`.
|
| 2648 |
|
@li **(3)**, **(4)** require the underlying container to be an
|
2648 |
|
@li **(3)**, **(4)** require the underlying container to be an
|
| 2649 |
|
@ref array, and look for an element at index `pos`.
|
2649 |
|
@ref array, and look for an element at index `pos`.
|
| 2650 |
|
|
2650 |
|
|
| 2651 |
|
|
2651 |
|
|
| 2652 |
|
|
2652 |
|
|
| 2653 |
|
|
2653 |
|
|
| 2654 |
|
@param key The key of the element to find.
|
2654 |
|
@param key The key of the element to find.
|
| 2655 |
|
|
2655 |
|
|
| 2656 |
|
|
2656 |
|
|
| 2657 |
|
|
2657 |
|
|
| 2658 |
|
|
2658 |
|
|
| 2659 |
|
|
2659 |
|
|
| 2660 |
|
|
2660 |
|
|
| 2661 |
|
|
2661 |
|
|
| 2662 |
|
|
2662 |
|
|
| 2663 |
|
|
2663 |
|
|
| 2664 |
|
|
2664 |
|
|
| 2665 |
|
boost::system::result<value&>
|
2665 |
|
boost::system::result<value&>
|
| 2666 |
|
try_at(string_view key) noexcept;
|
2666 |
|
try_at(string_view key) noexcept;
|
| 2667 |
|
|
2667 |
|
|
| 2668 |
|
|
2668 |
|
|
| 2669 |
|
boost::system::result<value const&>
|
2669 |
|
boost::system::result<value const&>
|
| 2670 |
|
try_at(string_view key) const noexcept;
|
2670 |
|
try_at(string_view key) const noexcept;
|
| 2671 |
|
|
2671 |
|
|
| 2672 |
|
|
2672 |
|
|
| 2673 |
|
|
2673 |
|
|
| 2674 |
|
@param pos A zero-based array index.
|
2674 |
|
@param pos A zero-based array index.
|
| 2675 |
|
|
2675 |
|
|
| 2676 |
|
|
2676 |
|
|
| 2677 |
|
boost::system::result<value&>
|
2677 |
|
boost::system::result<value&>
|
| 2678 |
|
try_at(std::size_t pos) noexcept;
|
2678 |
|
try_at(std::size_t pos) noexcept;
|
| 2679 |
|
|
2679 |
|
|
| 2680 |
|
|
2680 |
|
|
| 2681 |
|
|
2681 |
|
|
| 2682 |
|
boost::system::result<value const&>
|
2682 |
|
boost::system::result<value const&>
|
| 2683 |
|
try_at(std::size_t pos) const noexcept;
|
2683 |
|
try_at(std::size_t pos) const noexcept;
|
| 2684 |
|
|
2684 |
|
|
| 2685 |
|
|
2685 |
|
|
| 2686 |
|
|
2686 |
|
|
| 2687 |
|
/** Access an element, with bounds checking.
|
2687 |
|
/** Access an element, with bounds checking.
|
| 2688 |
|
|
2688 |
|
|
| 2689 |
|
This function is used to access elements of
|
2689 |
|
This function is used to access elements of
|
| 2690 |
|
the underlying container, or throw an exception if that could not be
|
2690 |
|
the underlying container, or throw an exception if that could not be
|
| 2691 |
|
|
2691 |
|
|
| 2692 |
|
|
2692 |
|
|
| 2693 |
|
@li **(1)**--**(3)** is equivalent to
|
2693 |
|
@li **(1)**--**(3)** is equivalent to
|
| 2694 |
|
`this->as_object(loc).at(key, loc)`.
|
2694 |
|
`this->as_object(loc).at(key, loc)`.
|
| 2695 |
|
@li **(4)**--**(6)** is equivalent to
|
2695 |
|
@li **(4)**--**(6)** is equivalent to
|
| 2696 |
|
`this->as_array(loc).at(pos, loc)`.
|
2696 |
|
`this->as_array(loc).at(pos, loc)`.
|
| 2697 |
|
|
2697 |
|
|
| 2698 |
|
|
2698 |
|
|
| 2699 |
|
|
2699 |
|
|
| 2700 |
|
|
2700 |
|
|
| 2701 |
|
|
2701 |
|
|
| 2702 |
|
|
2702 |
|
|
| 2703 |
|
|
2703 |
|
|
| 2704 |
|
@param key The key of the element to find.
|
2704 |
|
@param key The key of the element to find.
|
| 2705 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
2705 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
| 2706 |
|
source location of the call site by default.
|
2706 |
|
source location of the call site by default.
|
| 2707 |
|
|
2707 |
|
|
| 2708 |
|
@throw boost::system::system_error The underlying type of value is not
|
2708 |
|
@throw boost::system::system_error The underlying type of value is not
|
| 2709 |
|
the container type corresponding to the first argument (i.e.
|
2709 |
|
the container type corresponding to the first argument (i.e.
|
| 2710 |
|
using an index with an @ref object).
|
2710 |
|
using an index with an @ref object).
|
| 2711 |
|
@throw boost::system::system_error An element corresponding to the
|
2711 |
|
@throw boost::system::system_error An element corresponding to the
|
| 2712 |
|
first argument was not found.
|
2712 |
|
first argument was not found.
|
| 2713 |
|
|
2713 |
|
|
| 2714 |
|
@see @ref as_array, @ref as_object.
|
2714 |
|
@see @ref as_array, @ref as_object.
|
| 2715 |
|
|
2715 |
|
|
| 2716 |
|
|
2716 |
|
|
| 2717 |
|
|
2717 |
|
|
| 2718 |
|
|
2718 |
|
|
| 2719 |
|
at(string_view key, source_location const& loc = BOOST_CURRENT_LOCATION) &
|
2719 |
|
at(string_view key, source_location const& loc = BOOST_CURRENT_LOCATION) &
|
| 2720 |
|
|
2720 |
|
|
| 2721 |
|
return as_object(loc).at(key, loc);
|
2721 |
|
return as_object(loc).at(key, loc);
|
| 2722 |
|
|
2722 |
|
|
| 2723 |
|
|
2723 |
|
|
| 2724 |
|
|
2724 |
|
|
| 2725 |
|
|
2725 |
|
|
| 2726 |
|
at(string_view key, source_location const& loc = BOOST_CURRENT_LOCATION) &&
|
2726 |
|
at(string_view key, source_location const& loc = BOOST_CURRENT_LOCATION) &&
|
| 2727 |
|
|
2727 |
|
|
| 2728 |
|
return std::move( as_object(loc) ).at(key, loc);
|
2728 |
|
return std::move( as_object(loc) ).at(key, loc);
|
| 2729 |
|
|
2729 |
|
|
| 2730 |
|
|
2730 |
|
|
| 2731 |
|
|
2731 |
|
|
| 2732 |
|
|
2732 |
|
|
| 2733 |
|
|
2733 |
|
|
| 2734 |
|
|
2734 |
|
|
| 2735 |
|
source_location const& loc = BOOST_CURRENT_LOCATION) const&
|
2735 |
|
source_location const& loc = BOOST_CURRENT_LOCATION) const&
|
| 2736 |
|
|
2736 |
|
|
| 2737 |
|
return as_object(loc).at(key, loc);
|
2737 |
|
return as_object(loc).at(key, loc);
|
| 2738 |
|
|
2738 |
|
|
| 2739 |
|
|
2739 |
|
|
| 2740 |
|
|
2740 |
|
|
| 2741 |
|
|
2741 |
|
|
| 2742 |
|
@param pos A zero-based array index.
|
2742 |
|
@param pos A zero-based array index.
|
| 2743 |
|
|
2743 |
|
|
| 2744 |
|
|
2744 |
|
|
| 2745 |
|
|
2745 |
|
|
| 2746 |
|
at(std::size_t pos, source_location const& loc = BOOST_CURRENT_LOCATION) &
|
2746 |
|
at(std::size_t pos, source_location const& loc = BOOST_CURRENT_LOCATION) &
|
| 2747 |
|
|
2747 |
|
|
| 2748 |
|
return as_array(loc).at(pos, loc);
|
2748 |
|
return as_array(loc).at(pos, loc);
|
| 2749 |
|
|
2749 |
|
|
| 2750 |
|
|
2750 |
|
|
| 2751 |
|
|
2751 |
|
|
| 2752 |
|
|
2752 |
|
|
| 2753 |
|
at(std::size_t pos, source_location const& loc = BOOST_CURRENT_LOCATION) &&
|
2753 |
|
at(std::size_t pos, source_location const& loc = BOOST_CURRENT_LOCATION) &&
|
| 2754 |
|
|
2754 |
|
|
| 2755 |
|
return std::move( as_array(loc) ).at(pos, loc);
|
2755 |
|
return std::move( as_array(loc) ).at(pos, loc);
|
| 2756 |
|
|
2756 |
|
|
| 2757 |
|
|
2757 |
|
|
| 2758 |
|
|
2758 |
|
|
| 2759 |
|
|
2759 |
|
|
| 2760 |
|
|
2760 |
|
|
| 2761 |
|
source_location const& loc = BOOST_CURRENT_LOCATION) const&
|
2761 |
|
source_location const& loc = BOOST_CURRENT_LOCATION) const&
|
| 2762 |
|
|
2762 |
|
|
| 2763 |
|
return as_array(loc).at(pos, loc);
|
2763 |
|
return as_array(loc).at(pos, loc);
|
| 2764 |
|
|
2764 |
|
|
| 2765 |
|
|
2765 |
|
|
| 2766 |
|
|
2766 |
|
|
| 2767 |
|
/** Access an element via JSON Pointer.
|
2767 |
|
/** Access an element via JSON Pointer.
|
| 2768 |
|
|
2768 |
|
|
| 2769 |
|
This function is used to access a (potentially nested) element of the
|
2769 |
|
This function is used to access a (potentially nested) element of the
|
| 2770 |
|
value using a JSON Pointer string.
|
2770 |
|
value using a JSON Pointer string.
|
| 2771 |
|
|
2771 |
|
|
| 2772 |
|
|
2772 |
|
|
| 2773 |
|
Linear in the sizes of `ptr` and underlying array, object, or string.
|
2773 |
|
Linear in the sizes of `ptr` and underlying array, object, or string.
|
| 2774 |
|
|
2774 |
|
|
| 2775 |
|
|
2775 |
|
|
| 2776 |
|
|
2776 |
|
|
| 2777 |
|
|
2777 |
|
|
| 2778 |
|
@param ptr JSON Pointer string.
|
2778 |
|
@param ptr JSON Pointer string.
|
| 2779 |
|
|
2779 |
|
|
| 2780 |
|
@return @ref boost::system::result containing either a reference to the
|
2780 |
|
@return @ref boost::system::result containing either a reference to the
|
| 2781 |
|
element identified by `ptr` or a corresponding `error_code`.
|
2781 |
|
element identified by `ptr` or a corresponding `error_code`.
|
| 2782 |
|
|
2782 |
|
|
| 2783 |
|
|
2783 |
|
|
| 2784 |
|
[RFC 6901 - JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901).
|
2784 |
|
[RFC 6901 - JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901).
|
| 2785 |
|
|
2785 |
|
|
| 2786 |
|
|
2786 |
|
|
| 2787 |
|
|
2787 |
|
|
| 2788 |
|
|
2788 |
|
|
| 2789 |
|
system::result<value const&>
|
2789 |
|
system::result<value const&>
|
| 2790 |
|
try_at_pointer(string_view ptr) const noexcept;
|
2790 |
|
try_at_pointer(string_view ptr) const noexcept;
|
| 2791 |
|
|
2791 |
|
|
| 2792 |
|
|
2792 |
|
|
| 2793 |
|
|
2793 |
|
|
| 2794 |
|
try_at_pointer(string_view ptr) noexcept;
|
2794 |
|
try_at_pointer(string_view ptr) noexcept;
|
| 2795 |
|
|
2795 |
|
|
| 2796 |
|
|
2796 |
|
|
| 2797 |
|
/** Access an element via JSON Pointer.
|
2797 |
|
/** Access an element via JSON Pointer.
|
| 2798 |
|
|
2798 |
|
|
| 2799 |
|
This function is used to access a (potentially nested) element of the
|
2799 |
|
This function is used to access a (potentially nested) element of the
|
| 2800 |
|
value using a JSON Pointer string.
|
2800 |
|
value using a JSON Pointer string.
|
| 2801 |
|
|
2801 |
|
|
| 2802 |
|
|
2802 |
|
|
| 2803 |
|
Linear in the sizes of `ptr` and the underlying container.
|
2803 |
|
Linear in the sizes of `ptr` and the underlying container.
|
| 2804 |
|
|
2804 |
|
|
| 2805 |
|
|
2805 |
|
|
| 2806 |
|
|
2806 |
|
|
| 2807 |
|
|
2807 |
|
|
| 2808 |
|
@param ptr JSON Pointer string.
|
2808 |
|
@param ptr JSON Pointer string.
|
| 2809 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
2809 |
|
@param loc @ref boost::source_location to use in thrown exception; the
|
| 2810 |
|
source location of the call site by default.
|
2810 |
|
source location of the call site by default.
|
| 2811 |
|
|
2811 |
|
|
| 2812 |
|
@return reference to the element identified by `ptr`.
|
2812 |
|
@return reference to the element identified by `ptr`.
|
| 2813 |
|
|
2813 |
|
|
| 2814 |
|
@throw boost::system::system_error if an error occurs.
|
2814 |
|
@throw boost::system::system_error if an error occurs.
|
| 2815 |
|
|
2815 |
|
|
| 2816 |
|
|
2816 |
|
|
| 2817 |
|
[RFC 6901 - JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901).
|
2817 |
|
[RFC 6901 - JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901).
|
| 2818 |
|
|
2818 |
|
|
| 2819 |
|
|
2819 |
|
|
| 2820 |
|
|
2820 |
|
|
| 2821 |
|
|
2821 |
|
|
| 2822 |
|
|
2822 |
|
|
| 2823 |
|
|
2823 |
|
|
| 2824 |
|
|
2824 |
|
|
| 2825 |
|
source_location const& loc = BOOST_CURRENT_LOCATION) const&;
|
2825 |
|
source_location const& loc = BOOST_CURRENT_LOCATION) const&;
|
| 2826 |
|
|
2826 |
|
|
| 2827 |
|
|
2827 |
|
|
| 2828 |
|
|
2828 |
|
|
| 2829 |
|
|
2829 |
|
|
| 2830 |
|
|
2830 |
|
|
| 2831 |
|
|
2831 |
|
|
| 2832 |
|
source_location const& loc = BOOST_CURRENT_LOCATION) &&;
|
2832 |
|
source_location const& loc = BOOST_CURRENT_LOCATION) &&;
|
| 2833 |
|
|
2833 |
|
|
| 2834 |
|
|
2834 |
|
|
| 2835 |
|
|
2835 |
|
|
| 2836 |
|
|
2836 |
|
|
| 2837 |
|
|
2837 |
|
|
| 2838 |
|
|
2838 |
|
|
| 2839 |
|
source_location const& loc = BOOST_CURRENT_LOCATION) &;
|
2839 |
|
source_location const& loc = BOOST_CURRENT_LOCATION) &;
|
| 2840 |
|
|
2840 |
|
|
| 2841 |
|
|
2841 |
|
|
| 2842 |
|
/** Access an element via JSON Pointer.
|
2842 |
|
/** Access an element via JSON Pointer.
|
| 2843 |
|
|
2843 |
|
|
| 2844 |
|
This function is used to access a (potentially nested) element of the
|
2844 |
|
This function is used to access a (potentially nested) element of the
|
| 2845 |
|
value using a JSON Pointer string.
|
2845 |
|
value using a JSON Pointer string.
|
| 2846 |
|
|
2846 |
|
|
| 2847 |
|
|
2847 |
|
|
| 2848 |
|
Linear in the sizes of `ptr` and underlying container.
|
2848 |
|
Linear in the sizes of `ptr` and underlying container.
|
| 2849 |
|
|
2849 |
|
|
| 2850 |
|
|
2850 |
|
|
| 2851 |
|
|
2851 |
|
|
| 2852 |
|
|
2852 |
|
|
| 2853 |
|
@param ptr JSON Pointer string.
|
2853 |
|
@param ptr JSON Pointer string.
|
| 2854 |
|
@param ec Set to the error, if any occurred.
|
2854 |
|
@param ec Set to the error, if any occurred.
|
| 2855 |
|
|
2855 |
|
|
| 2856 |
|
@return pointer to the element identified by `ptr`.
|
2856 |
|
@return pointer to the element identified by `ptr`.
|
| 2857 |
|
|
2857 |
|
|
| 2858 |
|
|
2858 |
|
|
| 2859 |
|
[RFC 6901 - JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901)
|
2859 |
|
[RFC 6901 - JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901)
|
| 2860 |
|
|
2860 |
|
|
| 2861 |
|
|
2861 |
|
|
| 2862 |
|
|
2862 |
|
|
| 2863 |
|
|
2863 |
|
|
| 2864 |
|
|
2864 |
|
|
| 2865 |
|
find_pointer(string_view ptr, system::error_code& ec) const noexcept;
|
2865 |
|
find_pointer(string_view ptr, system::error_code& ec) const noexcept;
|
| 2866 |
|
|
2866 |
|
|
| 2867 |
|
|
2867 |
|
|
| 2868 |
|
|
2868 |
|
|
| 2869 |
|
find_pointer(string_view ptr, system::error_code& ec) noexcept;
|
2869 |
|
find_pointer(string_view ptr, system::error_code& ec) noexcept;
|
| 2870 |
|
|
2870 |
|
|
| 2871 |
|
|
2871 |
|
|
| 2872 |
|
|
2872 |
|
|
| 2873 |
|
find_pointer(string_view ptr, std::error_code& ec) const noexcept;
|
2873 |
|
find_pointer(string_view ptr, std::error_code& ec) const noexcept;
|
| 2874 |
|
|
2874 |
|
|
| 2875 |
|
|
2875 |
|
|
| 2876 |
|
|
2876 |
|
|
| 2877 |
|
find_pointer(string_view ptr, std::error_code& ec) noexcept;
|
2877 |
|
find_pointer(string_view ptr, std::error_code& ec) noexcept;
|
| 2878 |
|
|
2878 |
|
|
| 2879 |
|
|
2879 |
|
|
| 2880 |
|
//------------------------------------------------------
|
2880 |
|
//------------------------------------------------------
|
| 2881 |
|
|
2881 |
|
|
| 2882 |
|
/** Set an element via JSON Pointer.
|
2882 |
|
/** Set an element via JSON Pointer.
|
| 2883 |
|
|
2883 |
|
|
| 2884 |
|
This function is used to insert or assign to a potentially nested
|
2884 |
|
This function is used to insert or assign to a potentially nested
|
| 2885 |
|
element of the value using a JSON Pointer string. The function may
|
2885 |
|
element of the value using a JSON Pointer string. The function may
|
| 2886 |
|
create intermediate elements corresponding to pointer segments.
|
2886 |
|
create intermediate elements corresponding to pointer segments.
|
| 2887 |
|
|
2887 |
|
|
| 2888 |
|
The particular conditions when and what kind of intermediate element
|
2888 |
|
The particular conditions when and what kind of intermediate element
|
| 2889 |
|
is created is governed by the `ptr` parameter.
|
2889 |
|
is created is governed by the `ptr` parameter.
|
| 2890 |
|
|
2890 |
|
|
| 2891 |
|
Each pointer token is considered in sequence. For each token
|
2891 |
|
Each pointer token is considered in sequence. For each token
|
| 2892 |
|
|
2892 |
|
|
| 2893 |
|
- if the containing value is an @ref object, then a new `null`
|
2893 |
|
- if the containing value is an @ref object, then a new `null`
|
| 2894 |
|
element is created with key equal to unescaped token string;
|
2894 |
|
element is created with key equal to unescaped token string;
|
| 2895 |
|
|
2895 |
|
|
| 2896 |
|
|
2896 |
|
|
| 2897 |
|
- if the containing value is an @ref array, and the token represents a
|
2897 |
|
- if the containing value is an @ref array, and the token represents a
|
| 2898 |
|
past-the-end marker, then a `null` element is appended to the array;
|
2898 |
|
past-the-end marker, then a `null` element is appended to the array;
|
| 2899 |
|
|
2899 |
|
|
| 2900 |
|
|
2900 |
|
|
| 2901 |
|
- if the containing value is an @ref array, and the token represents a
|
2901 |
|
- if the containing value is an @ref array, and the token represents a
|
| 2902 |
|
number, then if the difference between the number and array's size
|
2902 |
|
number, then if the difference between the number and array's size
|
| 2903 |
|
is smaller than `opts.max_created_elements`, then the size of the
|
2903 |
|
is smaller than `opts.max_created_elements`, then the size of the
|
| 2904 |
|
array is increased, so that the number can reference an element in the
|
2904 |
|
array is increased, so that the number can reference an element in the
|
| 2905 |
|
|
2905 |
|
|
| 2906 |
|
|
2906 |
|
|
| 2907 |
|
- if the containing value is of different @ref kind and
|
2907 |
|
- if the containing value is of different @ref kind and
|
| 2908 |
|
`opts.replace_any_scalar` is `true`, or the value is `null`, then
|
2908 |
|
`opts.replace_any_scalar` is `true`, or the value is `null`, then
|
| 2909 |
|
|
2909 |
|
|
| 2910 |
|
- if `opts.create_arrays` is `true` and the token either represents
|
2910 |
|
- if `opts.create_arrays` is `true` and the token either represents
|
| 2911 |
|
past-the-end marker or a number, then the value is replaced with
|
2911 |
|
past-the-end marker or a number, then the value is replaced with
|
| 2912 |
|
an empty array and the token is considered again; otherwise
|
2912 |
|
an empty array and the token is considered again; otherwise
|
| 2913 |
|
|
2913 |
|
|
| 2914 |
|
- if `opts.create_objects` is `true`, then the value is replaced
|
2914 |
|
- if `opts.create_objects` is `true`, then the value is replaced
|
| 2915 |
|
with an empty object and the token is considered again; otherwise
|
2915 |
|
with an empty object and the token is considered again; otherwise
|
| 2916 |
|
|
2916 |
|
|
| 2917 |
|
|
2917 |
|
|
| 2918 |
|
|
2918 |
|
|
| 2919 |
|
|
2919 |
|
|
| 2920 |
|
Linear in the sum of size of `ptr`, size of underlying array, object,
|
2920 |
|
Linear in the sum of size of `ptr`, size of underlying array, object,
|
| 2921 |
|
or string and `opts.max_created_elements`.
|
2921 |
|
or string and `opts.max_created_elements`.
|
| 2922 |
|
|
2922 |
|
|
| 2923 |
|
|
2923 |
|
|
| 2924 |
|
Basic guarantee. Calls to `memory_resource::allocate` may throw.
|
2924 |
|
Basic guarantee. Calls to `memory_resource::allocate` may throw.
|
| 2925 |
|
|
2925 |
|
|
| 2926 |
|
@param sv JSON Pointer string.
|
2926 |
|
@param sv JSON Pointer string.
|
| 2927 |
|
@param ref The value to assign to pointed element.
|
2927 |
|
@param ref The value to assign to pointed element.
|
| 2928 |
|
@param opts The options for the algorithm.
|
2928 |
|
@param opts The options for the algorithm.
|
| 2929 |
|
|
2929 |
|
|
| 2930 |
|
@return @ref boost::system::result containing either a reference to the
|
2930 |
|
@return @ref boost::system::result containing either a reference to the
|
| 2931 |
|
element identified by `ptr` or a corresponding `error_code`.
|
2931 |
|
element identified by `ptr` or a corresponding `error_code`.
|
| 2932 |
|
|
2932 |
|
|
| 2933 |
|
|
2933 |
|
|
| 2934 |
|
@ref set_pointer_options,
|
2934 |
|
@ref set_pointer_options,
|
| 2935 |
|
[RFC 6901 - JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901).
|
2935 |
|
[RFC 6901 - JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901).
|
| 2936 |
|
|
2936 |
|
|
| 2937 |
|
|
2937 |
|
|
| 2938 |
|
|
2938 |
|
|
| 2939 |
|
|
2939 |
|
|
| 2940 |
|
|
2940 |
|
|
| 2941 |
|
|
2941 |
|
|
| 2942 |
|
set_pointer_options const& opts = {} );
|
2942 |
|
set_pointer_options const& opts = {} );
|
| 2943 |
|
|
2943 |
|
|
| 2944 |
|
/** Set an element via JSON Pointer.
|
2944 |
|
/** Set an element via JSON Pointer.
|
| 2945 |
|
|
2945 |
|
|
| 2946 |
|
This function is used to insert or assign to a potentially nested
|
2946 |
|
This function is used to insert or assign to a potentially nested
|
| 2947 |
|
element of the value using a JSON Pointer string. The function may
|
2947 |
|
element of the value using a JSON Pointer string. The function may
|
| 2948 |
|
create intermediate elements corresponding to pointer segments.
|
2948 |
|
create intermediate elements corresponding to pointer segments.
|
| 2949 |
|
|
2949 |
|
|
| 2950 |
|
The particular conditions when and what kind of intermediate element
|
2950 |
|
The particular conditions when and what kind of intermediate element
|
| 2951 |
|
is created is governed by the `ptr` parameter.
|
2951 |
|
is created is governed by the `ptr` parameter.
|
| 2952 |
|
|
2952 |
|
|
| 2953 |
|
Each pointer token is considered in sequence. For each token
|
2953 |
|
Each pointer token is considered in sequence. For each token
|
| 2954 |
|
|
2954 |
|
|
| 2955 |
|
- if the containing value is an @ref object, then a new `null`
|
2955 |
|
- if the containing value is an @ref object, then a new `null`
|
| 2956 |
|
element is created with key equal to unescaped token string; otherwise
|
2956 |
|
element is created with key equal to unescaped token string; otherwise
|
| 2957 |
|
|
2957 |
|
|
| 2958 |
|
- if the containing value is an @ref array, and the token represents a
|
2958 |
|
- if the containing value is an @ref array, and the token represents a
|
| 2959 |
|
past-the-end marker, then a `null` element is appended to the array;
|
2959 |
|
past-the-end marker, then a `null` element is appended to the array;
|
| 2960 |
|
|
2960 |
|
|
| 2961 |
|
|
2961 |
|
|
| 2962 |
|
- if the containing value is an @ref array, and the token represents a
|
2962 |
|
- if the containing value is an @ref array, and the token represents a
|
| 2963 |
|
number, then if the difference between the number and array's size
|
2963 |
|
number, then if the difference between the number and array's size
|
| 2964 |
|
is smaller than `opts.max_created_elements`, then the size of the
|
2964 |
|
is smaller than `opts.max_created_elements`, then the size of the
|
| 2965 |
|
array is increased, so that the number can reference an element in the
|
2965 |
|
array is increased, so that the number can reference an element in the
|
| 2966 |
|
|
2966 |
|
|
| 2967 |
|
|
2967 |
|
|
| 2968 |
|
- if the containing value is of different @ref kind and
|
2968 |
|
- if the containing value is of different @ref kind and
|
| 2969 |
|
`opts.replace_any_scalar` is `true`, or the value is `null`, then
|
2969 |
|
`opts.replace_any_scalar` is `true`, or the value is `null`, then
|
| 2970 |
|
|
2970 |
|
|
| 2971 |
|
- if `opts.create_arrays` is `true` and the token either represents
|
2971 |
|
- if `opts.create_arrays` is `true` and the token either represents
|
| 2972 |
|
past-the-end marker or a number, then the value is replaced with
|
2972 |
|
past-the-end marker or a number, then the value is replaced with
|
| 2973 |
|
an empty array and the token is considered again; otherwise
|
2973 |
|
an empty array and the token is considered again; otherwise
|
| 2974 |
|
|
2974 |
|
|
| 2975 |
|
- if `opts.create_objects` is `true`, then the value is replaced
|
2975 |
|
- if `opts.create_objects` is `true`, then the value is replaced
|
| 2976 |
|
with an empty object and the token is considered again; otherwise
|
2976 |
|
with an empty object and the token is considered again; otherwise
|
| 2977 |
|
|
2977 |
|
|
| 2978 |
|
|
2978 |
|
|
| 2979 |
|
|
2979 |
|
|
| 2980 |
|
|
2980 |
|
|
| 2981 |
|
Linear in the sum of size of `ptr`, size of underlying array, object,
|
2981 |
|
Linear in the sum of size of `ptr`, size of underlying array, object,
|
| 2982 |
|
or string and `opts.max_created_elements`.
|
2982 |
|
or string and `opts.max_created_elements`.
|
| 2983 |
|
|
2983 |
|
|
| 2984 |
|
|
2984 |
|
|
| 2985 |
|
|
2985 |
|
|
| 2986 |
|
Calls to `memory_resource::allocate` may throw.
|
2986 |
|
Calls to `memory_resource::allocate` may throw.
|
| 2987 |
|
|
2987 |
|
|
| 2988 |
|
@param sv JSON Pointer string.
|
2988 |
|
@param sv JSON Pointer string.
|
| 2989 |
|
|
2989 |
|
|
| 2990 |
|
@param ref The value to assign to pointed element.
|
2990 |
|
@param ref The value to assign to pointed element.
|
| 2991 |
|
|
2991 |
|
|
| 2992 |
|
@param opts The options for the algorithm.
|
2992 |
|
@param opts The options for the algorithm.
|
| 2993 |
|
|
2993 |
|
|
| 2994 |
|
@return Reference to the element identified by `ptr`.
|
2994 |
|
@return Reference to the element identified by `ptr`.
|
| 2995 |
|
|
2995 |
|
|
| 2996 |
|
@throws boost::system::system_error Overload **(1)** reports errors by
|
2996 |
|
@throws boost::system::system_error Overload **(1)** reports errors by
|
| 2997 |
|
|
2997 |
|
|
| 2998 |
|
|
2998 |
|
|
| 2999 |
|
@see @ref set_pointer_options,
|
2999 |
|
@see @ref set_pointer_options,
|
| 3000 |
|
[RFC 6901 - JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901">).
|
3000 |
|
[RFC 6901 - JavaScript Object Notation (JSON) Pointer](https://datatracker.ietf.org/doc/html/rfc6901">).
|
| 3001 |
|
|
3001 |
|
|
| 3002 |
|
|
3002 |
|
|
| 3003 |
|
|
3003 |
|
|
| 3004 |
|
|
3004 |
|
|
| 3005 |
|
|
3005 |
|
|
| 3006 |
|
|
3006 |
|
|
| 3007 |
|
|
3007 |
|
|
| 3008 |
|
|
3008 |
|
|
| 3009 |
|
set_pointer_options const& opts = {} );
|
3009 |
|
set_pointer_options const& opts = {} );
|
| 3010 |
|
|
3010 |
|
|
| 3011 |
|
|
3011 |
|
|
| 3012 |
|
|
3012 |
|
|
| 3013 |
|
@param ec Set to the error, if any occurred.
|
3013 |
|
@param ec Set to the error, if any occurred.
|
| 3014 |
|
|
3014 |
|
|
| 3015 |
|
|
3015 |
|
|
| 3016 |
|
|
3016 |
|
|
| 3017 |
|
|
3017 |
|
|
| 3018 |
|
|
3018 |
|
|
| 3019 |
|
|
3019 |
|
|
| 3020 |
|
|
3020 |
|
|
| 3021 |
|
|
3021 |
|
|
| 3022 |
|
|
3022 |
|
|
| 3023 |
|
|
3023 |
|
|
| 3024 |
|
set_pointer_options const& opts = {} );
|
3024 |
|
set_pointer_options const& opts = {} );
|
| 3025 |
|
|
3025 |
|
|
| 3026 |
|
|
3026 |
|
|
| 3027 |
|
|
3027 |
|
|
| 3028 |
|
|
3028 |
|
|
| 3029 |
|
|
3029 |
|
|
| 3030 |
|
|
3030 |
|
|
| 3031 |
|
|
3031 |
|
|
| 3032 |
|
|
3032 |
|
|
| 3033 |
|
set_pointer_options const& opts = {} );
|
3033 |
|
set_pointer_options const& opts = {} );
|
| 3034 |
|
|
3034 |
|
|
| 3035 |
|
|
3035 |
|
|
| 3036 |
|
//------------------------------------------------------
|
3036 |
|
//------------------------------------------------------
|
| 3037 |
|
|
3037 |
|
|
|
|
|
3038 |
+ |
/** Remove an element via JSON Pointer.
|
|
|
|
3039 |
+ |
|
|
|
|
3040 |
+ |
|
|
|
|
3041 |
+ |
|
|
|
|
3042 |
+ |
|
|
|
|
3043 |
+ |
|
|
|
|
3044 |
+ |
|
|
|
|
3045 |
+ |
|
|
|
|
3046 |
+ |
|
|
|
|
3047 |
+ |
|
|
|
|
3048 |
+ |
|
|
|
|
3049 |
+ |
//------------------------------------------------------
|
|
|
|
3050 |
+ |
|
| 3038 |
|
/** Check if two values are equal.
|
3051 |
|
/** Check if two values are equal.
|
| 3039 |
|
|
3052 |
|
|
| 3040 |
|
Two values are equal when they are the same kind and their referenced
|
3053 |
|
Two values are equal when they are the same kind and their referenced
|
| 3041 |
|
values are equal, or when they are both integral types and their
|
3054 |
|
values are equal, or when they are both integral types and their
|
| 3042 |
|
integral representations are equal.
|
3055 |
|
integral representations are equal.
|
| 3043 |
|
|
3056 |
|
|
| 3044 |
|
|
3057 |
|
|
| 3045 |
|
Constant or linear in the size of the underlying @ref array, @ref object,
|
3058 |
|
Constant or linear in the size of the underlying @ref array, @ref object,
|
| 3046 |
|
|
3059 |
|
|
| 3047 |
|
|
3060 |
|
|
| 3048 |
|
|
3061 |
|
|
| 3049 |
|
|
3062 |
|
|
| 3050 |
|
|
3063 |
|
|
| 3051 |
|
// inline friend speeds up overload resolution
|
3064 |
|
// inline friend speeds up overload resolution
|
| 3052 |
|
|
3065 |
|
|
| 3053 |
|
|
3066 |
|
|
| 3054 |
|
|
3067 |
|
|
| 3055 |
|
|
3068 |
|
|
| 3056 |
|
value const& rhs) noexcept
|
3069 |
|
value const& rhs) noexcept
|
| 3057 |
|
|
3070 |
|
|
| 3058 |
|
|
3071 |
|
|
| 3059 |
|
|
3072 |
|
|
| 3060 |
|
|
3073 |
|
|
| 3061 |
|
/** Check if two values are not equal.
|
3074 |
|
/** Check if two values are not equal.
|
| 3062 |
|
|
3075 |
|
|
| 3063 |
|
Two values are equal when they are the same kind and their referenced
|
3076 |
|
Two values are equal when they are the same kind and their referenced
|
| 3064 |
|
values are equal, or when they are both integral types and their
|
3077 |
|
values are equal, or when they are both integral types and their
|
| 3065 |
|
integral representations are equal.
|
3078 |
|
integral representations are equal.
|
| 3066 |
|
|
3079 |
|
|
| 3067 |
|
|
3080 |
|
|
| 3068 |
|
Constant or linear in the size of the underlying @ref array,
|
3081 |
|
Constant or linear in the size of the underlying @ref array,
|
| 3069 |
|
@ref object, or @ref string.
|
3082 |
|
@ref object, or @ref string.
|
| 3070 |
|
|
3083 |
|
|
| 3071 |
|
|
3084 |
|
|
| 3072 |
|
|
3085 |
|
|
| 3073 |
|
|
3086 |
|
|
| 3074 |
|
|
3087 |
|
|
| 3075 |
|
|
3088 |
|
|
| 3076 |
|
|
3089 |
|
|
| 3077 |
|
|
3090 |
|
|
| 3078 |
|
value const& rhs) noexcept
|
3091 |
|
value const& rhs) noexcept
|
| 3079 |
|
|
3092 |
|
|
| 3080 |
|
|
3093 |
|
|
| 3081 |
|
|
3094 |
|
|
| 3082 |
|
|
3095 |
|
|
| 3083 |
|
/** Serialize @ref value to an output stream.
|
3096 |
|
/** Serialize @ref value to an output stream.
|
| 3084 |
|
|
3097 |
|
|
| 3085 |
|
This function serializes a `value` as JSON text into the output stream.
|
3098 |
|
This function serializes a `value` as JSON text into the output stream.
|
| 3086 |
|
|
3099 |
|
|
| 3087 |
|
@return Reference to `os`.
|
3100 |
|
@return Reference to `os`.
|
| 3088 |
|
|
3101 |
|
|
| 3089 |
|
|
3102 |
|
|
| 3090 |
|
Constant or linear in the size of `jv`.
|
3103 |
|
Constant or linear in the size of `jv`.
|
| 3091 |
|
|
3104 |
|
|
| 3092 |
|
|
3105 |
|
|
| 3093 |
|
|
3106 |
|
|
| 3094 |
|
Calls to `memory_resource::allocate` may throw.
|
3107 |
|
Calls to `memory_resource::allocate` may throw.
|
| 3095 |
|
|
3108 |
|
|
| 3096 |
|
@param os The output stream to serialize to.
|
3109 |
|
@param os The output stream to serialize to.
|
| 3097 |
|
|
3110 |
|
|
| 3098 |
|
@param jv The value to serialize.
|
3111 |
|
@param jv The value to serialize.
|
| 3099 |
|
|
3112 |
|
|
| 3100 |
|
|
3113 |
|
|
| 3101 |
|
|
3114 |
|
|
| 3102 |
|
|
3115 |
|
|
| 3103 |
|
|
3116 |
|
|
| 3104 |
|
|
3117 |
|
|
| 3105 |
|
|
3118 |
|
|
| 3106 |
|
|
3119 |
|
|
| 3107 |
|
/** Parse @ref value from an input stream.
|
3120 |
|
/** Parse @ref value from an input stream.
|
| 3108 |
|
|
3121 |
|
|
| 3109 |
|
This function parses JSON from an input stream into a `value`. If
|
3122 |
|
This function parses JSON from an input stream into a `value`. If
|
| 3110 |
|
parsing fails, @ref std::ios_base::failbit will be set for `is` and
|
3123 |
|
parsing fails, @ref std::ios_base::failbit will be set for `is` and
|
| 3111 |
|
`jv` will be left unchanged. Regardless of whether @ref
|
3124 |
|
`jv` will be left unchanged. Regardless of whether @ref
|
| 3112 |
|
std::ios_base::skipws flag is set on `is`, consumes whitespace before
|
3125 |
|
std::ios_base::skipws flag is set on `is`, consumes whitespace before
|
| 3113 |
|
and after JSON, because whitespace is considered a part of JSON.
|
3126 |
|
and after JSON, because whitespace is considered a part of JSON.
|
| 3114 |
|
|
3127 |
|
|
| 3115 |
|
[_FormattedInputFunction_](https://en.cppreference.com/w/cpp/named_req/FormattedInputFunction).
|
3128 |
|
[_FormattedInputFunction_](https://en.cppreference.com/w/cpp/named_req/FormattedInputFunction).
|
| 3116 |
|
|
3129 |
|
|
| 3117 |
|
@note This operator cannot assume that the stream only contains a
|
3130 |
|
@note This operator cannot assume that the stream only contains a
|
| 3118 |
|
single JSON document, which may result in **very underwhelming
|
3131 |
|
single JSON document, which may result in **very underwhelming
|
| 3119 |
|
performance**, if the stream isn't cooperative. If you know that your
|
3132 |
|
performance**, if the stream isn't cooperative. If you know that your
|
| 3120 |
|
input consists of a single JSON document, consider using @ref parse
|
3133 |
|
input consists of a single JSON document, consider using @ref parse
|
| 3121 |
|
|
3134 |
|
|
| 3122 |
|
|
3135 |
|
|
| 3123 |
|
@return Reference to `is`.
|
3136 |
|
@return Reference to `is`.
|
| 3124 |
|
|
3137 |
|
|
| 3125 |
|
|
3138 |
|
|
| 3126 |
|
Linear in the size of JSON data.
|
3139 |
|
Linear in the size of JSON data.
|
| 3127 |
|
|
3140 |
|
|
| 3128 |
|
|
3141 |
|
|
| 3129 |
|
|
3142 |
|
|
| 3130 |
|
Calls to `memory_resource::allocate` may throw.
|
3143 |
|
Calls to `memory_resource::allocate` may throw.
|
| 3131 |
|
The stream may throw as configured by @ref std::ios::exceptions.
|
3144 |
|
The stream may throw as configured by @ref std::ios::exceptions.
|
| 3132 |
|
|
3145 |
|
|
| 3133 |
|
@param is The input stream to parse from.
|
3146 |
|
@param is The input stream to parse from.
|
| 3134 |
|
|
3147 |
|
|
| 3135 |
|
@param jv The value to parse into.
|
3148 |
|
@param jv The value to parse into.
|
| 3136 |
|
|
3149 |
|
|
| 3137 |
|
|
3150 |
|
|
| 3138 |
|
|
3151 |
|
|
| 3139 |
|
|
3152 |
|
|
| 3140 |
|
|
3153 |
|
|
| 3141 |
|
|
3154 |
|
|
| 3142 |
|
|
3155 |
|
|
| 3143 |
|
|
3156 |
|
|
| 3144 |
|
|
3157 |
|
|
| 3145 |
|
|
3158 |
|
|
| 3146 |
|
/** Helper for @ref boost::hash support.
|
3159 |
|
/** Helper for @ref boost::hash support.
|
| 3147 |
|
|
3160 |
|
|
| 3148 |
|
Computes a hash value for `jv`. This function is used by
|
3161 |
|
Computes a hash value for `jv`. This function is used by
|
| 3149 |
|
`boost::hash<value>`. Similar overloads for @ref array, @ref object,
|
3162 |
|
`boost::hash<value>`. Similar overloads for @ref array, @ref object,
|
| 3150 |
|
and @ref string do not exist, because those types are supported by
|
3163 |
|
and @ref string do not exist, because those types are supported by
|
| 3151 |
|
`boost::hash` out of the box.
|
3164 |
|
`boost::hash` out of the box.
|
| 3152 |
|
|
3165 |
|
|
| 3153 |
|
@return hash value for `jv`.
|
3166 |
|
@return hash value for `jv`.
|
| 3154 |
|
|
3167 |
|
|
| 3155 |
|
@param jv `value` for which a hash is to be computed.
|
3168 |
|
@param jv `value` for which a hash is to be computed.
|
| 3156 |
|
|
3169 |
|
|
| 3157 |
|
@see [Boost.ContainerHash](https://boost.org/libs/container_hash).
|
3170 |
|
@see [Boost.ContainerHash](https://boost.org/libs/container_hash).
|
| 3158 |
|
|
3171 |
|
|
| 3159 |
|
|
3172 |
|
|
| 3160 |
|
|
3173 |
|
|
| 3161 |
|
|
3174 |
|
|
| 3162 |
|
|
3175 |
|
|
| 3163 |
|
std::is_same< detail::remove_cvref<T>, value >::value >::type*
|
3176 |
|
std::is_same< detail::remove_cvref<T>, value >::value >::type*
|
| 3164 |
|
|
3177 |
|
|
| 3165 |
|
|
3178 |
|
|
| 3166 |
|
|
3179 |
|
|
| 3167 |
|
hash_value( T const& jv ) noexcept
|
3180 |
|
hash_value( T const& jv ) noexcept
|
| 3168 |
|
|
3181 |
|
|
| 3169 |
|
|
3182 |
|
|
| 3170 |
|
|
3183 |
|
|
| 3171 |
|
|
3184 |
|
|
| 3172 |
|
hash_value( value const& jv ) noexcept
|
3185 |
|
hash_value( value const& jv ) noexcept
|
| 3173 |
|
|
3186 |
|
|
| 3174 |
|
|
3187 |
|
|
| 3175 |
|
return detail::hash_value_impl(jv);
|
3188 |
|
return detail::hash_value_impl(jv);
|
| 3176 |
|
|
3189 |
|
|
| 3177 |
|
|
3190 |
|
|
| 3178 |
|
|
3191 |
|
|
| 3179 |
|
|
3192 |
|
|
| 3180 |
|
|
3193 |
|
|
| 3181 |
|
|
3194 |
|
|
| 3182 |
|
|
3195 |
|
|
| 3183 |
|
value const& src) noexcept
|
3196 |
|
value const& src) noexcept
|
| 3184 |
|
|
3197 |
|
|
| 3185 |
|
|
3198 |
|
|
| 3186 |
|
static_cast<void*>(dest),
|
3199 |
|
static_cast<void*>(dest),
|
| 3187 |
|
|
3200 |
|
|
| 3188 |
|
|
3201 |
|
|
| 3189 |
|
|
3202 |
|
|
| 3190 |
|
|
3203 |
|
|
| 3191 |
|
|
3204 |
|
|
| 3192 |
|
|
3205 |
|
|
| 3193 |
|
|
3206 |
|
|
| 3194 |
|
|
3207 |
|
|
| 3195 |
|
|
3208 |
|
|
| 3196 |
|
|
3209 |
|
|
| 3197 |
|
equal(value const& other) const noexcept;
|
3210 |
|
equal(value const& other) const noexcept;
|
| 3198 |
|
|
3211 |
|
|
| 3199 |
|
|
3212 |
|
|
| 3200 |
|
|
3213 |
|
|
| 3201 |
|
to_number(error& e) const noexcept ->
|
3214 |
|
to_number(error& e) const noexcept ->
|
| 3202 |
|
|
3215 |
|
|
| 3203 |
|
std::is_signed<T>::value &&
|
3216 |
|
std::is_signed<T>::value &&
|
| 3204 |
|
! std::is_floating_point<T>::value,
|
3217 |
|
! std::is_floating_point<T>::value,
|
| 3205 |
|
|
3218 |
|
|
| 3206 |
|
|
3219 |
|
|
| 3207 |
|
if(sca_.k == json::kind::int64)
|
3220 |
|
if(sca_.k == json::kind::int64)
|
| 3208 |
|
|
3221 |
|
|
| 3209 |
|
|
3222 |
|
|
| 3210 |
|
if( i >= (std::numeric_limits<T>::min)() &&
|
3223 |
|
if( i >= (std::numeric_limits<T>::min)() &&
|
| 3211 |
|
i <= (std::numeric_limits<T>::max)())
|
3224 |
|
i <= (std::numeric_limits<T>::max)())
|
| 3212 |
|
|
3225 |
|
|
| 3213 |
|
|
3226 |
|
|
| 3214 |
|
return static_cast<T>(i);
|
3227 |
|
return static_cast<T>(i);
|
| 3215 |
|
|
3228 |
|
|
| 3216 |
|
|
3229 |
|
|
| 3217 |
|
|
3230 |
|
|
| 3218 |
|
else if(sca_.k == json::kind::uint64)
|
3231 |
|
else if(sca_.k == json::kind::uint64)
|
| 3219 |
|
|
3232 |
|
|
| 3220 |
|
|
3233 |
|
|
| 3221 |
|
if(u <= static_cast<std::uint64_t>((
|
3234 |
|
if(u <= static_cast<std::uint64_t>((
|
| 3222 |
|
std::numeric_limits<T>::max)()))
|
3235 |
|
std::numeric_limits<T>::max)()))
|
| 3223 |
|
|
3236 |
|
|
| 3224 |
|
|
3237 |
|
|
| 3225 |
|
return static_cast<T>(u);
|
3238 |
|
return static_cast<T>(u);
|
| 3226 |
|
|
3239 |
|
|
| 3227 |
|
|
3240 |
|
|
| 3228 |
|
|
3241 |
|
|
| 3229 |
|
else if(sca_.k == json::kind::double_)
|
3242 |
|
else if(sca_.k == json::kind::double_)
|
| 3230 |
|
|
3243 |
|
|
| 3231 |
|
|
3244 |
|
|
| 3232 |
|
if( d >= static_cast<double>(
|
3245 |
|
if( d >= static_cast<double>(
|
| 3233 |
|
(detail::to_number_limit<T>::min)()) &&
|
3246 |
|
(detail::to_number_limit<T>::min)()) &&
|
| 3234 |
|
d <= static_cast<double>(
|
3247 |
|
d <= static_cast<double>(
|
| 3235 |
|
(detail::to_number_limit<T>::max)()) &&
|
3248 |
|
(detail::to_number_limit<T>::max)()) &&
|
| 3236 |
|
|
3249 |
|
|
| 3237 |
|
|
3250 |
|
|
| 3238 |
|
|
3251 |
|
|
| 3239 |
|
return static_cast<T>(d);
|
3252 |
|
return static_cast<T>(d);
|
| 3240 |
|
|
3253 |
|
|
| 3241 |
|
|
3254 |
|
|
| 3242 |
|
|
3255 |
|
|
| 3243 |
|
|
3256 |
|
|
| 3244 |
|
|
3257 |
|
|
| 3245 |
|
|
3258 |
|
|
| 3246 |
|
|
3259 |
|
|
| 3247 |
|
|
3260 |
|
|
| 3248 |
|
|
3261 |
|
|
| 3249 |
|
|
3262 |
|
|
| 3250 |
|
|
3263 |
|
|
| 3251 |
|
|
3264 |
|
|
| 3252 |
|
to_number(error& e) const noexcept ->
|
3265 |
|
to_number(error& e) const noexcept ->
|
| 3253 |
|
|
3266 |
|
|
| 3254 |
|
std::is_unsigned<T>::value &&
|
3267 |
|
std::is_unsigned<T>::value &&
|
| 3255 |
|
! std::is_same<T, bool>::value,
|
3268 |
|
! std::is_same<T, bool>::value,
|
| 3256 |
|
|
3269 |
|
|
| 3257 |
|
|
3270 |
|
|
| 3258 |
|
if(sca_.k == json::kind::int64)
|
3271 |
|
if(sca_.k == json::kind::int64)
|
| 3259 |
|
|
3272 |
|
|
| 3260 |
|
|
3273 |
|
|
| 3261 |
|
if( i >= 0 && static_cast<std::uint64_t>(i) <=
|
3274 |
|
if( i >= 0 && static_cast<std::uint64_t>(i) <=
|
| 3262 |
|
(std::numeric_limits<T>::max)())
|
3275 |
|
(std::numeric_limits<T>::max)())
|
| 3263 |
|
|
3276 |
|
|
| 3264 |
|
|
3277 |
|
|
| 3265 |
|
return static_cast<T>(i);
|
3278 |
|
return static_cast<T>(i);
|
| 3266 |
|
|
3279 |
|
|
| 3267 |
|
|
3280 |
|
|
| 3268 |
|
|
3281 |
|
|
| 3269 |
|
else if(sca_.k == json::kind::uint64)
|
3282 |
|
else if(sca_.k == json::kind::uint64)
|
| 3270 |
|
|
3283 |
|
|
| 3271 |
|
|
3284 |
|
|
| 3272 |
|
if(u <= (std::numeric_limits<T>::max)())
|
3285 |
|
if(u <= (std::numeric_limits<T>::max)())
|
| 3273 |
|
|
3286 |
|
|
| 3274 |
|
|
3287 |
|
|
| 3275 |
|
return static_cast<T>(u);
|
3288 |
|
return static_cast<T>(u);
|
| 3276 |
|
|
3289 |
|
|
| 3277 |
|
|
3290 |
|
|
| 3278 |
|
|
3291 |
|
|
| 3279 |
|
else if(sca_.k == json::kind::double_)
|
3292 |
|
else if(sca_.k == json::kind::double_)
|
| 3280 |
|
|
3293 |
|
|
| 3281 |
|
|
3294 |
|
|
| 3282 |
|
|
3295 |
|
|
| 3283 |
|
d <= (detail::to_number_limit<T>::max)() &&
|
3296 |
|
d <= (detail::to_number_limit<T>::max)() &&
|
| 3284 |
|
|
3297 |
|
|
| 3285 |
|
|
3298 |
|
|
| 3286 |
|
|
3299 |
|
|
| 3287 |
|
return static_cast<T>(d);
|
3300 |
|
return static_cast<T>(d);
|
| 3288 |
|
|
3301 |
|
|
| 3289 |
|
|
3302 |
|
|
| 3290 |
|
|
3303 |
|
|
| 3291 |
|
|
3304 |
|
|
| 3292 |
|
|
3305 |
|
|
| 3293 |
|
|
3306 |
|
|
| 3294 |
|
|
3307 |
|
|
| 3295 |
|
|
3308 |
|
|
| 3296 |
|
|
3309 |
|
|
| 3297 |
|
|
3310 |
|
|
| 3298 |
|
|
3311 |
|
|
| 3299 |
|
|
3312 |
|
|
| 3300 |
|
to_number(error& e) const noexcept ->
|
3313 |
|
to_number(error& e) const noexcept ->
|
| 3301 |
|
|
3314 |
|
|
| 3302 |
|
|
3315 |
|
|
| 3303 |
|
|
3316 |
|
|
| 3304 |
|
|
3317 |
|
|
| 3305 |
|
if(sca_.k == json::kind::int64)
|
3318 |
|
if(sca_.k == json::kind::int64)
|
| 3306 |
|
|
3319 |
|
|
| 3307 |
|
|
3320 |
|
|
| 3308 |
|
return static_cast<T>(sca_.i);
|
3321 |
|
return static_cast<T>(sca_.i);
|
| 3309 |
|
|
3322 |
|
|
| 3310 |
|
if(sca_.k == json::kind::uint64)
|
3323 |
|
if(sca_.k == json::kind::uint64)
|
| 3311 |
|
|
3324 |
|
|
| 3312 |
|
|
3325 |
|
|
| 3313 |
|
return static_cast<T>(sca_.u);
|
3326 |
|
return static_cast<T>(sca_.u);
|
| 3314 |
|
|
3327 |
|
|
| 3315 |
|
if(sca_.k == json::kind::double_)
|
3328 |
|
if(sca_.k == json::kind::double_)
|
| 3316 |
|
|
3329 |
|
|
| 3317 |
|
|
3330 |
|
|
| 3318 |
|
return static_cast<T>(sca_.d);
|
3331 |
|
return static_cast<T>(sca_.d);
|
| 3319 |
|
|
3332 |
|
|
| 3320 |
|
|
3333 |
|
|
| 3321 |
|
|
3334 |
|
|
| 3322 |
|
|
3335 |
|
|
| 3323 |
|
|
3336 |
|
|
| 3324 |
|
|
3337 |
|
|
| 3325 |
|
// Make sure things are as big as we think they should be
|
3338 |
|
// Make sure things are as big as we think they should be
|
| 3326 |
|
#if BOOST_JSON_ARCH == 64
|
3339 |
|
#if BOOST_JSON_ARCH == 64
|
| 3327 |
|
BOOST_CORE_STATIC_ASSERT( sizeof(value) == 24 );
|
3340 |
|
BOOST_CORE_STATIC_ASSERT( sizeof(value) == 24 );
|
| 3328 |
|
#elif BOOST_JSON_ARCH == 32
|
3341 |
|
#elif BOOST_JSON_ARCH == 32
|
| 3329 |
|
BOOST_CORE_STATIC_ASSERT( sizeof(value) == 16 );
|
3342 |
|
BOOST_CORE_STATIC_ASSERT( sizeof(value) == 16 );
|
| 3330 |
|
|
3343 |
|
|
| 3331 |
|
# error Unknown architecture
|
3344 |
|
# error Unknown architecture
|
| 3332 |
|
|
3345 |
|
|
| 3333 |
|
|
3346 |
|
|
| 3334 |
|
//----------------------------------------------------------
|
3347 |
|
//----------------------------------------------------------
|
| 3335 |
|
|
3348 |
|
|
| 3336 |
|
|
3349 |
|
|
| 3337 |
|
|
3350 |
|
|
| 3338 |
|
This is the type of element used by the @ref object container.
|
3351 |
|
This is the type of element used by the @ref object container.
|
| 3339 |
|
|
3352 |
|
|
| 3340 |
|
|
3353 |
|
|
| 3341 |
|
|
3354 |
|
|
| 3342 |
|
|
3355 |
|
|
| 3343 |
|
friend struct detail::access;
|
3356 |
|
friend struct detail::access;
|
| 3344 |
|
using access = detail::access;
|
3357 |
|
using access = detail::access;
|
| 3345 |
|
|
3358 |
|
|
| 3346 |
|
|
3359 |
|
|
| 3347 |
|
|
3360 |
|
|
| 3348 |
|
static char const empty_[1];
|
3361 |
|
static char const empty_[1];
|
| 3349 |
|
|
3362 |
|
|
| 3350 |
|
|
3363 |
|
|
| 3351 |
|
|
3364 |
|
|
| 3352 |
|
|
3365 |
|
|
| 3353 |
|
pilfered<json::value> v) noexcept;
|
3366 |
|
pilfered<json::value> v) noexcept;
|
| 3354 |
|
|
3367 |
|
|
| 3355 |
|
|
3368 |
|
|
| 3356 |
|
|
3369 |
|
|
| 3357 |
|
|
3370 |
|
|
| 3358 |
|
This type is not copy or move-assignable. The copy assignment operator
|
3371 |
|
This type is not copy or move-assignable. The copy assignment operator
|
| 3359 |
|
|
3372 |
|
|
| 3360 |
|
|
3373 |
|
|
| 3361 |
|
|
3374 |
|
|
| 3362 |
|
operator=(key_value_pair const&) = delete;
|
3375 |
|
operator=(key_value_pair const&) = delete;
|
| 3363 |
|
|
3376 |
|
|
| 3364 |
|
|
3377 |
|
|
| 3365 |
|
|
3378 |
|
|
| 3366 |
|
The value is destroyed and all internally allocated memory is freed.
|
3379 |
|
The value is destroyed and all internally allocated memory is freed.
|
| 3367 |
|
|
3380 |
|
|
| 3368 |
|
~key_value_pair() noexcept
|
3381 |
|
~key_value_pair() noexcept
|
| 3369 |
|
|
3382 |
|
|
| 3370 |
|
auto const& sp = value_.storage();
|
3383 |
|
auto const& sp = value_.storage();
|
| 3371 |
|
if(sp.is_not_shared_and_deallocate_is_trivial())
|
3384 |
|
if(sp.is_not_shared_and_deallocate_is_trivial())
|
| 3372 |
|
|
3385 |
|
|
| 3373 |
|
|
3386 |
|
|
| 3374 |
|
|
3387 |
|
|
| 3375 |
|
sp->deallocate(const_cast<char*>(key_),
|
3388 |
|
sp->deallocate(const_cast<char*>(key_),
|
| 3376 |
|
len_ + 1, alignof(char));
|
3389 |
|
len_ + 1, alignof(char));
|
| 3377 |
|
|
3390 |
|
|
| 3378 |
|
|
3391 |
|
|
| 3379 |
|
|
3392 |
|
|
| 3380 |
|
|
3393 |
|
|
| 3381 |
|
Construct a key/value pair.
|
3394 |
|
Construct a key/value pair.
|
| 3382 |
|
|
3395 |
|
|
| 3383 |
|
@li **(1)** uses a copy of the characters of `key`, and constructs the
|
3396 |
|
@li **(1)** uses a copy of the characters of `key`, and constructs the
|
| 3384 |
|
value as if by `value(std::forward<Args>(args)...)`.
|
3397 |
|
value as if by `value(std::forward<Args>(args)...)`.
|
| 3385 |
|
@li **(2)** equivalent to `key_value_pair(p.first, p.second, sp)`.
|
3398 |
|
@li **(2)** equivalent to `key_value_pair(p.first, p.second, sp)`.
|
| 3386 |
|
@li **(3)** equivalent to
|
3399 |
|
@li **(3)** equivalent to
|
| 3387 |
|
`key_value_pair(p.first, std::move(p.second), sp)`.
|
3400 |
|
`key_value_pair(p.first, std::move(p.second), sp)`.
|
| 3388 |
|
@li **(4)** equivalent to
|
3401 |
|
@li **(4)** equivalent to
|
| 3389 |
|
`key_value_pair(other.key(), other.value(), sp)`.
|
3402 |
|
`key_value_pair(other.key(), other.value(), sp)`.
|
| 3390 |
|
@li **(5)** equivalent to
|
3403 |
|
@li **(5)** equivalent to
|
| 3391 |
|
`key_value_pair(other.key(), other.value(), other.storage())`.
|
3404 |
|
`key_value_pair(other.key(), other.value(), other.storage())`.
|
| 3392 |
|
@li **(6)** the pair s constructed by acquiring ownership of the
|
3405 |
|
@li **(6)** the pair s constructed by acquiring ownership of the
|
| 3393 |
|
contents of `other` using move semantics.
|
3406 |
|
contents of `other` using move semantics.
|
| 3394 |
|
@li **(7)** the pair is constructed by acquiring ownership of the
|
3407 |
|
@li **(7)** the pair is constructed by acquiring ownership of the
|
| 3395 |
|
contents of `other` using pilfer semantics. This is more efficient
|
3408 |
|
contents of `other` using pilfer semantics. This is more efficient
|
| 3396 |
|
than move construction, when it is known that the moved-from object
|
3409 |
|
than move construction, when it is known that the moved-from object
|
| 3397 |
|
will be immediately destroyed afterwards.
|
3410 |
|
will be immediately destroyed afterwards.
|
| 3398 |
|
|
3411 |
|
|
| 3399 |
|
With **(2)**, **(3)**, **(4)** the pair uses the memory resource of
|
3412 |
|
With **(2)**, **(3)**, **(4)** the pair uses the memory resource of
|
| 3400 |
|
`sp`. With **(5)**, **(6)**, **(7)** it uses the memory resource of
|
3413 |
|
`sp`. With **(5)**, **(6)**, **(7)** it uses the memory resource of
|
| 3401 |
|
`other.storage()`. With **(1)** it uses whatever memory resource
|
3414 |
|
`other.storage()`. With **(1)** it uses whatever memory resource
|
| 3402 |
|
`value(std::forward<Args>(args)...)` would use. In any case the pair
|
3415 |
|
`value(std::forward<Args>(args)...)` would use. In any case the pair
|
| 3403 |
|
acquires shared ownership of its memory resource
|
3416 |
|
acquires shared ownership of its memory resource
|
| 3404 |
|
|
3417 |
|
|
| 3405 |
|
After **(6)** `other` holds an empty key, and a null value with its
|
3418 |
|
After **(6)** `other` holds an empty key, and a null value with its
|
| 3406 |
|
|
3419 |
|
|
| 3407 |
|
|
3420 |
|
|
| 3408 |
|
After **(7)** `other` is not in a usable state and may only be destroyed.
|
3421 |
|
After **(7)** `other` is not in a usable state and may only be destroyed.
|
| 3409 |
|
|
3422 |
|
|
| 3410 |
|
|
3423 |
|
|
| 3411 |
|
|
3424 |
|
|
| 3412 |
|
|
3425 |
|
|
| 3413 |
|
|
3426 |
|
|
| 3414 |
|
Strong guarantee. Calls to `memory_resource::allocate` may throw.
|
3427 |
|
Strong guarantee. Calls to `memory_resource::allocate` may throw.
|
| 3415 |
|
@param key The key string to use.
|
3428 |
|
@param key The key string to use.
|
| 3416 |
|
@param args Optional arguments forwarded to the @ref value constructor.
|
3429 |
|
@param args Optional arguments forwarded to the @ref value constructor.
|
| 3417 |
|
|
3430 |
|
|
| 3418 |
|
@throw boost::system::system_error The size of the key would exceed
|
3431 |
|
@throw boost::system::system_error The size of the key would exceed
|
| 3419 |
|
|
3432 |
|
|
| 3420 |
|
|
3433 |
|
|
| 3421 |
|
|
3434 |
|
|
| 3422 |
|
[Valueless Variants Considered Harmful](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0308r0.html).
|
3435 |
|
[Valueless Variants Considered Harmful](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0308r0.html).
|
| 3423 |
|
|
3436 |
|
|
| 3424 |
|
|
3437 |
|
|
| 3425 |
|
|
3438 |
|
|
| 3426 |
|
|
3439 |
|
|
| 3427 |
|
|
3440 |
|
|
| 3428 |
|
|
3441 |
|
|
| 3429 |
|
|
3442 |
|
|
| 3430 |
|
|
3443 |
|
|
| 3431 |
|
: value_(std::forward<Args>(args)...)
|
3444 |
|
: value_(std::forward<Args>(args)...)
|
| 3432 |
|
|
3445 |
|
|
| 3433 |
|
if(key.size() > string::max_size())
|
3446 |
|
if(key.size() > string::max_size())
|
| 3434 |
|
|
3447 |
|
|
| 3435 |
|
BOOST_STATIC_CONSTEXPR source_location loc = BOOST_CURRENT_LOCATION;
|
3448 |
|
BOOST_STATIC_CONSTEXPR source_location loc = BOOST_CURRENT_LOCATION;
|
| 3436 |
|
detail::throw_system_error( error::key_too_large, &loc );
|
3449 |
|
detail::throw_system_error( error::key_too_large, &loc );
|
| 3437 |
|
|
3450 |
|
|
| 3438 |
|
auto s = reinterpret_cast<
|
3451 |
|
auto s = reinterpret_cast<
|
| 3439 |
|
char*>(value_.storage()->
|
3452 |
|
char*>(value_.storage()->
|
| 3440 |
|
allocate(key.size() + 1, alignof(char)));
|
3453 |
|
allocate(key.size() + 1, alignof(char)));
|
| 3441 |
|
std::memcpy(s, key.data(), key.size());
|
3454 |
|
std::memcpy(s, key.data(), key.size());
|
| 3442 |
|
|
3455 |
|
|
| 3443 |
|
|
3456 |
|
|
| 3444 |
|
|
3457 |
|
|
| 3445 |
|
std::uint32_t>(key.size());
|
3458 |
|
std::uint32_t>(key.size());
|
| 3446 |
|
|
3459 |
|
|
| 3447 |
|
|
3460 |
|
|
| 3448 |
|
|
3461 |
|
|
| 3449 |
|
|
3462 |
|
|
| 3450 |
|
@param p A `std::pair` with the key string and @ref value to construct
|
3463 |
|
@param p A `std::pair` with the key string and @ref value to construct
|
| 3451 |
|
|
3464 |
|
|
| 3452 |
|
@param sp A pointer to the @ref boost::container::pmr::memory_resource
|
3465 |
|
@param sp A pointer to the @ref boost::container::pmr::memory_resource
|
| 3453 |
|
|
3466 |
|
|
| 3454 |
|
|
3467 |
|
|
| 3455 |
|
|
3468 |
|
|
| 3456 |
|
|
3469 |
|
|
| 3457 |
|
|
3470 |
|
|
| 3458 |
|
|
3471 |
|
|
| 3459 |
|
|
3472 |
|
|
| 3460 |
|
|
3473 |
|
|
| 3461 |
|
|
3474 |
|
|
| 3462 |
|
|
3475 |
|
|
| 3463 |
|
|
3476 |
|
|
| 3464 |
|
|
3477 |
|
|
| 3465 |
|
|
3478 |
|
|
| 3466 |
|
|
3479 |
|
|
| 3467 |
|
|
3480 |
|
|
| 3468 |
|
|
3481 |
|
|
| 3469 |
|
|
3482 |
|
|
| 3470 |
|
|
3483 |
|
|
| 3471 |
|
|
3484 |
|
|
| 3472 |
|
|
3485 |
|
|
| 3473 |
|
|
3486 |
|
|
| 3474 |
|
|
3487 |
|
|
| 3475 |
|
|
3488 |
|
|
| 3476 |
|
|
3489 |
|
|
| 3477 |
|
|
3490 |
|
|
| 3478 |
|
|
3491 |
|
|
| 3479 |
|
|
3492 |
|
|
| 3480 |
|
|
3493 |
|
|
| 3481 |
|
|
3494 |
|
|
| 3482 |
|
|
3495 |
|
|
| 3483 |
|
|
3496 |
|
|
| 3484 |
|
@param other Another key/value pair.
|
3497 |
|
@param other Another key/value pair.
|
| 3485 |
|
|
3498 |
|
|
| 3486 |
|
|
3499 |
|
|
| 3487 |
|
|
3500 |
|
|
| 3488 |
|
|
3501 |
|
|
| 3489 |
|
key_value_pair const& other,
|
3502 |
|
key_value_pair const& other,
|
| 3490 |
|
|
3503 |
|
|
| 3491 |
|
|
3504 |
|
|
| 3492 |
|
|
3505 |
|
|
| 3493 |
|
|
3506 |
|
|
| 3494 |
|
key_value_pair const& other)
|
3507 |
|
key_value_pair const& other)
|
| 3495 |
|
|
3508 |
|
|
| 3496 |
|
|
3509 |
|
|
| 3497 |
|
|
3510 |
|
|
| 3498 |
|
|
3511 |
|
|
| 3499 |
|
|
3512 |
|
|
| 3500 |
|
|
3513 |
|
|
| 3501 |
|
|
3514 |
|
|
| 3502 |
|
key_value_pair&& other) noexcept
|
3515 |
|
key_value_pair&& other) noexcept
|
| 3503 |
|
: value_(std::move(other.value_))
|
3516 |
|
: value_(std::move(other.value_))
|
| 3504 |
|
|
3517 |
|
|
| 3505 |
|
|
3518 |
|
|
| 3506 |
|
|
3519 |
|
|
| 3507 |
|
|
3520 |
|
|
| 3508 |
|
|
3521 |
|
|
| 3509 |
|
|
3522 |
|
|
| 3510 |
|
|
3523 |
|
|
| 3511 |
|
|
3524 |
|
|
| 3512 |
|
|
3525 |
|
|
| 3513 |
|
pilfered<key_value_pair> other) noexcept
|
3526 |
|
pilfered<key_value_pair> other) noexcept
|
| 3514 |
|
: value_(pilfer(other.get().value_))
|
3527 |
|
: value_(pilfer(other.get().value_))
|
| 3515 |
|
|
3528 |
|
|
| 3516 |
|
other.get().key_, empty_))
|
3529 |
|
other.get().key_, empty_))
|
| 3517 |
|
|
3530 |
|
|
| 3518 |
|
|
3531 |
|
|
| 3519 |
|
|
3532 |
|
|
| 3520 |
|
|
3533 |
|
|
| 3521 |
|
|
3534 |
|
|
| 3522 |
|
|
3535 |
|
|
| 3523 |
|
/** The associated memory resource.
|
3536 |
|
/** The associated memory resource.
|
| 3524 |
|
|
3537 |
|
|
| 3525 |
|
Returns a pointer to the memory resource used to construct the value.
|
3538 |
|
Returns a pointer to the memory resource used to construct the value.
|
| 3526 |
|
|
3539 |
|
|
| 3527 |
|
|
3540 |
|
|
| 3528 |
|
|
3541 |
|
|
| 3529 |
|
|
3542 |
|
|
| 3530 |
|
|
3543 |
|
|
| 3531 |
|
|
3544 |
|
|
| 3532 |
|
|
3545 |
|
|
| 3533 |
|
|
3546 |
|
|
| 3534 |
|
|
3547 |
|
|
| 3535 |
|
|
3548 |
|
|
| 3536 |
|
|
3549 |
|
|
| 3537 |
|
|
3550 |
|
|
| 3538 |
|
|
3551 |
|
|
| 3539 |
|
|
3552 |
|
|
| 3540 |
|
|
3553 |
|
|
| 3541 |
|
After construction, the key may not be modified.
|
3554 |
|
After construction, the key may not be modified.
|
| 3542 |
|
|
3555 |
|
|
| 3543 |
|
|
3556 |
|
|
| 3544 |
|
|
3557 |
|
|
| 3545 |
|
|
3558 |
|
|
| 3546 |
|
|
3559 |
|
|
| 3547 |
|
|
3560 |
|
|
| 3548 |
|
|
3561 |
|
|
| 3549 |
|
|
3562 |
|
|
| 3550 |
|
|
3563 |
|
|
| 3551 |
|
|
3564 |
|
|
| 3552 |
|
|
3565 |
|
|
| 3553 |
|
|
3566 |
|
|
| 3554 |
|
|
3567 |
|
|
| 3555 |
|
/** The pair's key as a null-terminated string.
|
3568 |
|
/** The pair's key as a null-terminated string.
|
| 3556 |
|
|
3569 |
|
|
| 3557 |
|
|
3570 |
|
|
| 3558 |
|
|
3571 |
|
|
| 3559 |
|
|
3572 |
|
|
| 3560 |
|
|
3573 |
|
|
| 3561 |
|
|
3574 |
|
|
| 3562 |
|
|
3575 |
|
|
| 3563 |
|
|
3576 |
|
|
| 3564 |
|
key_c_str() const noexcept
|
3577 |
|
key_c_str() const noexcept
|
| 3565 |
|
|
3578 |
|
|
| 3566 |
|
|
3579 |
|
|
| 3567 |
|
|
3580 |
|
|
| 3568 |
|
|
3581 |
|
|
| 3569 |
|
|
3582 |
|
|
| 3570 |
|
|
3583 |
|
|
| 3571 |
|
|
3584 |
|
|
| 3572 |
|
|
3585 |
|
|
| 3573 |
|
|
3586 |
|
|
| 3574 |
|
|
3587 |
|
|
| 3575 |
|
|
3588 |
|
|
| 3576 |
|
|
3589 |
|
|
| 3577 |
|
|
3590 |
|
|
| 3578 |
|
|
3591 |
|
|
| 3579 |
|
|
3592 |
|
|
| 3580 |
|
|
3593 |
|
|
| 3581 |
|
|
3594 |
|
|
| 3582 |
|
|
3595 |
|
|
| 3583 |
|
|
3596 |
|
|
| 3584 |
|
|
3597 |
|
|
| 3585 |
|
|
3598 |
|
|
| 3586 |
|
|
3599 |
|
|
| 3587 |
|
|
3600 |
|
|
| 3588 |
|
return std::move( value() );
|
3601 |
|
return std::move( value() );
|
| 3589 |
|
|
3602 |
|
|
| 3590 |
|
|
3603 |
|
|
| 3591 |
|
|
3604 |
|
|
| 3592 |
|
|
3605 |
|
|
| 3593 |
|
|
3606 |
|
|
| 3594 |
|
|
3607 |
|
|
| 3595 |
|
|
3608 |
|
|
| 3596 |
|
|
3609 |
|
|
| 3597 |
|
|
3610 |
|
|
| 3598 |
|
|
3611 |
|
|
| 3599 |
|
|
3612 |
|
|
| 3600 |
|
|
3613 |
|
|
| 3601 |
|
|
3614 |
|
|
| 3602 |
|
|
3615 |
|
|
| 3603 |
|
|
3616 |
|
|
| 3604 |
|
|
3617 |
|
|
| 3605 |
|
//----------------------------------------------------------
|
3618 |
|
//----------------------------------------------------------
|
| 3606 |
|
|
3619 |
|
|
| 3607 |
|
|
3620 |
|
|
| 3608 |
|
|
3621 |
|
|
| 3609 |
|
/** Tuple-like element access.
|
3622 |
|
/** Tuple-like element access.
|
| 3610 |
|
|
3623 |
|
|
| 3611 |
|
This overload of `get` permits the key and value of a @ref key_value_pair
|
3624 |
|
This overload of `get` permits the key and value of a @ref key_value_pair
|
| 3612 |
|
to be accessed by index. For example:
|
3625 |
|
to be accessed by index. For example:
|
| 3613 |
|
|
3626 |
|
|
| 3614 |
|
|
3627 |
|
|
| 3615 |
|
key_value_pair kvp("num", 42);
|
3628 |
|
key_value_pair kvp("num", 42);
|
| 3616 |
|
string_view key = get<0>(kvp);
|
3629 |
|
string_view key = get<0>(kvp);
|
| 3617 |
|
|
3630 |
|
|
| 3618 |
|
|
3631 |
|
|
| 3619 |
|
|
3632 |
|
|
| 3620 |
|
|
3633 |
|
|
| 3621 |
|
When using C++17 or greater, objects of type @ref key_value_pair may be
|
3634 |
|
When using C++17 or greater, objects of type @ref key_value_pair may be
|
| 3622 |
|
used to initialize structured bindings:
|
3635 |
|
used to initialize structured bindings:
|
| 3623 |
|
|
3636 |
|
|
| 3624 |
|
|
3637 |
|
|
| 3625 |
|
key_value_pair kvp("num", 42);
|
3638 |
|
key_value_pair kvp("num", 42);
|
| 3626 |
|
auto& [key, value] = kvp;
|
3639 |
|
auto& [key, value] = kvp;
|
| 3627 |
|
|
3640 |
|
|
| 3628 |
|
|
3641 |
|
|
| 3629 |
|
Depending on the value of `I`, the return type will be:
|
3642 |
|
Depending on the value of `I`, the return type will be:
|
| 3630 |
|
|
3643 |
|
|
| 3631 |
|
@li `string_view const` if `I == 0`, or
|
3644 |
|
@li `string_view const` if `I == 0`, or
|
| 3632 |
|
@li `value&`, `value const&`, or `value&&` if `I == 1`.
|
3645 |
|
@li `value&`, `value const&`, or `value&&` if `I == 1`.
|
| 3633 |
|
|
3646 |
|
|
| 3634 |
|
Using any other value for `I` is ill-formed.
|
3647 |
|
Using any other value for `I` is ill-formed.
|
| 3635 |
|
|
3648 |
|
|
| 3636 |
|
|
3649 |
|
|
| 3637 |
|
`std::is_same_v< std::remove_cvref_t<T>, key_value_pair >`
|
3650 |
|
`std::is_same_v< std::remove_cvref_t<T>, key_value_pair >`
|
| 3638 |
|
|
3651 |
|
|
| 3639 |
|
@tparam I The element index to access.
|
3652 |
|
@tparam I The element index to access.
|
| 3640 |
|
|
3653 |
|
|
| 3641 |
|
@return `kvp.key()` if `I == 0`, or `kvp.value()` if `I == 1`.
|
3654 |
|
@return `kvp.key()` if `I == 0`, or `kvp.value()` if `I == 1`.
|
| 3642 |
|
|
3655 |
|
|
| 3643 |
|
@param kvp The @ref key_value_pair object to access.
|
3656 |
|
@param kvp The @ref key_value_pair object to access.
|
| 3644 |
|
|
3657 |
|
|
| 3645 |
|
|
3658 |
|
|
| 3646 |
|
|
3659 |
|
|
| 3647 |
|
|
3660 |
|
|
| 3648 |
|
|
3661 |
|
|
| 3649 |
|
|
3662 |
|
|
| 3650 |
|
|
3663 |
|
|
| 3651 |
|
|
3664 |
|
|
| 3652 |
|
|
3665 |
|
|
| 3653 |
|
|
3666 |
|
|
| 3654 |
|
|
3667 |
|
|
| 3655 |
|
get(key_value_pair const&) noexcept ->
|
3668 |
|
get(key_value_pair const&) noexcept ->
|
| 3656 |
|
typename std::conditional<I == 0,
|
3669 |
|
typename std::conditional<I == 0,
|
| 3657 |
|
|
3670 |
|
|
| 3658 |
|
|
3671 |
|
|
| 3659 |
|
|
3672 |
|
|
| 3660 |
|
|
3673 |
|
|
| 3661 |
|
"key_value_pair index out of range");
|
3674 |
|
"key_value_pair index out of range");
|
| 3662 |
|
|
3675 |
|
|
| 3663 |
|
|
3676 |
|
|
| 3664 |
|
|
3677 |
|
|
| 3665 |
|
|
3678 |
|
|
| 3666 |
|
get(key_value_pair&) noexcept ->
|
3679 |
|
get(key_value_pair&) noexcept ->
|
| 3667 |
|
typename std::conditional<I == 0,
|
3680 |
|
typename std::conditional<I == 0,
|
| 3668 |
|
|
3681 |
|
|
| 3669 |
|
|
3682 |
|
|
| 3670 |
|
|
3683 |
|
|
| 3671 |
|
|
3684 |
|
|
| 3672 |
|
"key_value_pair index out of range");
|
3685 |
|
"key_value_pair index out of range");
|
| 3673 |
|
|
3686 |
|
|
| 3674 |
|
|
3687 |
|
|
| 3675 |
|
|
3688 |
|
|
| 3676 |
|
|
3689 |
|
|
| 3677 |
|
get(key_value_pair&&) noexcept ->
|
3690 |
|
get(key_value_pair&&) noexcept ->
|
| 3678 |
|
typename std::conditional<I == 0,
|
3691 |
|
typename std::conditional<I == 0,
|
| 3679 |
|
|
3692 |
|
|
| 3680 |
|
|
3693 |
|
|
| 3681 |
|
|
3694 |
|
|
| 3682 |
|
|
3695 |
|
|
| 3683 |
|
"key_value_pair index out of range");
|
3696 |
|
"key_value_pair index out of range");
|
| 3684 |
|
|
3697 |
|
|
| 3685 |
|
|
3698 |
|
|
| 3686 |
|
/** Extracts a key_value_pair's key using tuple-like interface
|
3699 |
|
/** Extracts a key_value_pair's key using tuple-like interface
|
| 3687 |
|
|
3700 |
|
|
| 3688 |
|
|
3701 |
|
|
| 3689 |
|
|
3702 |
|
|
| 3690 |
|
|
3703 |
|
|
| 3691 |
|
get<0>(key_value_pair const& kvp) noexcept
|
3704 |
|
get<0>(key_value_pair const& kvp) noexcept
|
| 3692 |
|
|
3705 |
|
|
| 3693 |
|
|
3706 |
|
|
| 3694 |
|
|
3707 |
|
|
| 3695 |
|
|
3708 |
|
|
| 3696 |
|
/** Extracts a key_value_pair's key using tuple-like interface
|
3709 |
|
/** Extracts a key_value_pair's key using tuple-like interface
|
| 3697 |
|
|
3710 |
|
|
| 3698 |
|
|
3711 |
|
|
| 3699 |
|
|
3712 |
|
|
| 3700 |
|
|
3713 |
|
|
| 3701 |
|
get<0>(key_value_pair& kvp) noexcept
|
3714 |
|
get<0>(key_value_pair& kvp) noexcept
|
| 3702 |
|
|
3715 |
|
|
| 3703 |
|
|
3716 |
|
|
| 3704 |
|
|
3717 |
|
|
| 3705 |
|
|
3718 |
|
|
| 3706 |
|
/** Extracts a key_value_pair's key using tuple-like interface
|
3719 |
|
/** Extracts a key_value_pair's key using tuple-like interface
|
| 3707 |
|
|
3720 |
|
|
| 3708 |
|
|
3721 |
|
|
| 3709 |
|
|
3722 |
|
|
| 3710 |
|
|
3723 |
|
|
| 3711 |
|
get<0>(key_value_pair&& kvp) noexcept
|
3724 |
|
get<0>(key_value_pair&& kvp) noexcept
|
| 3712 |
|
|
3725 |
|
|
| 3713 |
|
|
3726 |
|
|
| 3714 |
|
|
3727 |
|
|
| 3715 |
|
|
3728 |
|
|
| 3716 |
|
/** Extracts a key_value_pair's value using tuple-like interface
|
3729 |
|
/** Extracts a key_value_pair's value using tuple-like interface
|
| 3717 |
|
|
3730 |
|
|
| 3718 |
|
|
3731 |
|
|
| 3719 |
|
|
3732 |
|
|
| 3720 |
|
|
3733 |
|
|
| 3721 |
|
get<1>(key_value_pair const& kvp) noexcept
|
3734 |
|
get<1>(key_value_pair const& kvp) noexcept
|
| 3722 |
|
|
3735 |
|
|
| 3723 |
|
|
3736 |
|
|
| 3724 |
|
|
3737 |
|
|
| 3725 |
|
|
3738 |
|
|
| 3726 |
|
/** Extracts a key_value_pair's value using tuple-like interface
|
3739 |
|
/** Extracts a key_value_pair's value using tuple-like interface
|
| 3727 |
|
|
3740 |
|
|
| 3728 |
|
|
3741 |
|
|
| 3729 |
|
|
3742 |
|
|
| 3730 |
|
|
3743 |
|
|
| 3731 |
|
get<1>(key_value_pair& kvp) noexcept
|
3744 |
|
get<1>(key_value_pair& kvp) noexcept
|
| 3732 |
|
|
3745 |
|
|
| 3733 |
|
|
3746 |
|
|
| 3734 |
|
|
3747 |
|
|
| 3735 |
|
|
3748 |
|
|
| 3736 |
|
/** Extracts a key_value_pair's value using tuple-like interface
|
3749 |
|
/** Extracts a key_value_pair's value using tuple-like interface
|
| 3737 |
|
|
3750 |
|
|
| 3738 |
|
|
3751 |
|
|
| 3739 |
|
|
3752 |
|
|
| 3740 |
|
|
3753 |
|
|
| 3741 |
|
get<1>(key_value_pair&& kvp) noexcept
|
3754 |
|
get<1>(key_value_pair&& kvp) noexcept
|
| 3742 |
|
|
3755 |
|
|
| 3743 |
|
return std::move(kvp.value());
|
3756 |
|
return std::move(kvp.value());
|
| 3744 |
|
|
3757 |
|
|
| 3745 |
|
|
3758 |
|
|
| 3746 |
|
|
3759 |
|
|
| 3747 |
|
|
3760 |
|
|
| 3748 |
|
|
3761 |
|
|
| 3749 |
|
|
3762 |
|
|
| 3750 |
|
|
3763 |
|
|
| 3751 |
|
|
3764 |
|
|
| 3752 |
|
# pragma clang diagnostic push
|
3765 |
|
# pragma clang diagnostic push
|
| 3753 |
|
# pragma clang diagnostic ignored "-Wmismatched-tags"
|
3766 |
|
# pragma clang diagnostic ignored "-Wmismatched-tags"
|
| 3754 |
|
|
3767 |
|
|
| 3755 |
|
|
3768 |
|
|
| 3756 |
|
|
3769 |
|
|
| 3757 |
|
|
3770 |
|
|
| 3758 |
|
|
3771 |
|
|
| 3759 |
|
|
3772 |
|
|
| 3760 |
|
/** Tuple-like size access for key_value_pair
|
3773 |
|
/** Tuple-like size access for key_value_pair
|
| 3761 |
|
|
3774 |
|
|
| 3762 |
|
|
3775 |
|
|
| 3763 |
|
struct tuple_size< ::boost::json::key_value_pair >
|
3776 |
|
struct tuple_size< ::boost::json::key_value_pair >
|
| 3764 |
|
: std::integral_constant<std::size_t, 2>
|
3777 |
|
: std::integral_constant<std::size_t, 2>
|
| 3765 |
|
|
3778 |
|
|
| 3766 |
|
|
3779 |
|
|
| 3767 |
|
|
3780 |
|
|
| 3768 |
|
/** Tuple-like access for the key type of key_value_pair
|
3781 |
|
/** Tuple-like access for the key type of key_value_pair
|
| 3769 |
|
|
3782 |
|
|
| 3770 |
|
|
3783 |
|
|
| 3771 |
|
struct tuple_element<0, ::boost::json::key_value_pair>
|
3784 |
|
struct tuple_element<0, ::boost::json::key_value_pair>
|
| 3772 |
|
|
3785 |
|
|
| 3773 |
|
using type = ::boost::json::string_view const;
|
3786 |
|
using type = ::boost::json::string_view const;
|
| 3774 |
|
|
3787 |
|
|
| 3775 |
|
|
3788 |
|
|
| 3776 |
|
/** Tuple-like access for the value type of key_value_pair
|
3789 |
|
/** Tuple-like access for the value type of key_value_pair
|
| 3777 |
|
|
3790 |
|
|
| 3778 |
|
|
3791 |
|
|
| 3779 |
|
struct tuple_element<1, ::boost::json::key_value_pair>
|
3792 |
|
struct tuple_element<1, ::boost::json::key_value_pair>
|
| 3780 |
|
|
3793 |
|
|
| 3781 |
|
using type = ::boost::json::value&;
|
3794 |
|
using type = ::boost::json::value&;
|
| 3782 |
|
|
3795 |
|
|
| 3783 |
|
|
3796 |
|
|
| 3784 |
|
/** Tuple-like access for the value type of key_value_pair
|
3797 |
|
/** Tuple-like access for the value type of key_value_pair
|
| 3785 |
|
|
3798 |
|
|
| 3786 |
|
|
3799 |
|
|
| 3787 |
|
struct tuple_element<1, ::boost::json::key_value_pair const>
|
3800 |
|
struct tuple_element<1, ::boost::json::key_value_pair const>
|
| 3788 |
|
|
3801 |
|
|
| 3789 |
|
using type = ::boost::json::value const&;
|
3802 |
|
using type = ::boost::json::value const&;
|
| 3790 |
|
|
3803 |
|
|
| 3791 |
|
|
3804 |
|
|
| 3792 |
|
|
3805 |
|
|
| 3793 |
|
|
3806 |
|
|
| 3794 |
|
|
3807 |
|
|
| 3795 |
|
|
3808 |
|
|
| 3796 |
|
// std::hash specialization
|
3809 |
|
// std::hash specialization
|
| 3797 |
|
|
3810 |
|
|
| 3798 |
|
|
3811 |
|
|
| 3799 |
|
|
3812 |
|
|
| 3800 |
|
struct hash< ::boost::json::value > {
|
3813 |
|
struct hash< ::boost::json::value > {
|
| 3801 |
|
|
3814 |
|
|
| 3802 |
|
|
3815 |
|
|
| 3803 |
|
operator()(::boost::json::value const& jv) const noexcept;
|
3816 |
|
operator()(::boost::json::value const& jv) const noexcept;
|
| 3804 |
|
|
3817 |
|
|
| 3805 |
|
|
3818 |
|
|
| 3806 |
|
|
3819 |
|
|
| 3807 |
|
|
3820 |
|
|
| 3808 |
|
|
3821 |
|
|
| 3809 |
|
|
3822 |
|
|
| 3810 |
|
# pragma clang diagnostic pop
|
3823 |
|
# pragma clang diagnostic pop
|
| 3811 |
|
|
3824 |
|
|
| 3812 |
|
|
3825 |
|
|
| 3813 |
|
// These are here because value, array,
|
3826 |
|
// These are here because value, array,
|
| 3814 |
|
// and object form cyclic references.
|
3827 |
|
// and object form cyclic references.
|
| 3815 |
|
|
3828 |
|
|
| 3816 |
|
#include <boost/json/detail/impl/array.hpp>
|
3829 |
|
#include <boost/json/detail/impl/array.hpp>
|
| 3817 |
|
#include <boost/json/impl/array.hpp>
|
3830 |
|
#include <boost/json/impl/array.hpp>
|
| 3818 |
|
#include <boost/json/impl/object.hpp>
|
3831 |
|
#include <boost/json/impl/object.hpp>
|
| 3819 |
|
#include <boost/json/impl/value.hpp>
|
3832 |
|
#include <boost/json/impl/value.hpp>
|
| 3820 |
|
|
3833 |
|
|
| 3821 |
|
// These must come after array and object
|
3834 |
|
// These must come after array and object
|
| 3822 |
|
#include <boost/json/impl/value_ref.hpp>
|
3835 |
|
#include <boost/json/impl/value_ref.hpp>
|
| 3823 |
|
|
3836 |
|
|
| 3824 |
|
|
3837 |
|
|