/src/boost/boost/variant2/variant.hpp
Line | Count | Source |
1 | | #ifndef BOOST_VARIANT2_VARIANT_HPP_INCLUDED |
2 | | #define BOOST_VARIANT2_VARIANT_HPP_INCLUDED |
3 | | |
4 | | // Copyright 2017-2026 Peter Dimov. |
5 | | // Distributed under the Boost Software License, Version 1.0. |
6 | | // https://www.boost.org/LICENSE_1_0.txt |
7 | | |
8 | | #if defined(_MSC_VER) && _MSC_VER < 1910 |
9 | | # pragma warning( push ) |
10 | | # pragma warning( disable: 4521 4522 ) // multiple copy operators |
11 | | #endif |
12 | | |
13 | | #include <boost/mp11.hpp> |
14 | | #include <boost/assert.hpp> |
15 | | #include <boost/assert/source_location.hpp> |
16 | | #include <boost/config.hpp> |
17 | | #include <boost/config/workaround.hpp> |
18 | | #include <cstddef> |
19 | | #include <type_traits> |
20 | | #include <exception> |
21 | | #include <utility> |
22 | | #include <typeindex> // std::hash |
23 | | #include <iosfwd> |
24 | | #include <cstdint> |
25 | | #include <cerrno> |
26 | | #include <limits> |
27 | | |
28 | | // |
29 | | |
30 | | // constexpr destructors |
31 | | #if defined(__cpp_constexpr_dynamic_alloc) && __cpp_constexpr_dynamic_alloc >= 201907L |
32 | | # define BOOST_VARIANT2_CXX20_CONSTEXPR constexpr |
33 | | #else |
34 | | # define BOOST_VARIANT2_CXX20_CONSTEXPR |
35 | | #endif |
36 | | |
37 | | // |
38 | | |
39 | | namespace boost |
40 | | { |
41 | | |
42 | | #ifdef BOOST_NO_EXCEPTIONS |
43 | | |
44 | | BOOST_NORETURN void throw_exception( std::exception const & e ); // user defined |
45 | | |
46 | | #endif |
47 | | |
48 | | template<class T> struct hash; |
49 | | |
50 | | namespace variant2 |
51 | | { |
52 | | |
53 | | // bad_variant_access |
54 | | |
55 | | class bad_variant_access: public std::exception |
56 | | { |
57 | | public: |
58 | | |
59 | | bad_variant_access() noexcept |
60 | 0 | { |
61 | 0 | } |
62 | | |
63 | | char const * what() const noexcept |
64 | 0 | { |
65 | 0 | return "bad_variant_access"; |
66 | 0 | } |
67 | | }; |
68 | | |
69 | | namespace detail |
70 | | { |
71 | | |
72 | | BOOST_NORETURN inline void throw_bad_variant_access() |
73 | 0 | { |
74 | 0 | #ifdef BOOST_NO_EXCEPTIONS |
75 | 0 |
|
76 | 0 | boost::throw_exception( bad_variant_access() ); |
77 | 0 |
|
78 | 0 | #else |
79 | 0 |
|
80 | 0 | throw bad_variant_access(); |
81 | 0 |
|
82 | 0 | #endif |
83 | 0 | } |
84 | | |
85 | | } // namespace detail |
86 | | |
87 | | // monostate |
88 | | |
89 | | struct monostate |
90 | | { |
91 | | }; |
92 | | |
93 | | #if !BOOST_WORKAROUND(BOOST_MSVC, < 1960) |
94 | | |
95 | 0 | constexpr bool operator<(monostate, monostate) noexcept { return false; } |
96 | 0 | constexpr bool operator>(monostate, monostate) noexcept { return false; } |
97 | 0 | constexpr bool operator<=(monostate, monostate) noexcept { return true; } |
98 | 0 | constexpr bool operator>=(monostate, monostate) noexcept { return true; } |
99 | 0 | constexpr bool operator==(monostate, monostate) noexcept { return true; } |
100 | 0 | constexpr bool operator!=(monostate, monostate) noexcept { return false; } |
101 | | |
102 | | #else |
103 | | |
104 | | constexpr bool operator<(monostate const&, monostate const&) noexcept { return false; } |
105 | | constexpr bool operator>(monostate const&, monostate const&) noexcept { return false; } |
106 | | constexpr bool operator<=(monostate const&, monostate const&) noexcept { return true; } |
107 | | constexpr bool operator>=(monostate const&, monostate const&) noexcept { return true; } |
108 | | constexpr bool operator==(monostate const&, monostate const&) noexcept { return true; } |
109 | | constexpr bool operator!=(monostate const&, monostate const&) noexcept { return false; } |
110 | | |
111 | | #endif |
112 | | |
113 | | // variant forward declaration |
114 | | |
115 | | template<class... T> class variant; |
116 | | |
117 | | // variant_size |
118 | | |
119 | | template<class T> struct variant_size |
120 | | { |
121 | | }; |
122 | | |
123 | | template<class T> struct variant_size<T const>: variant_size<T> |
124 | | { |
125 | | }; |
126 | | |
127 | | template<class T> struct variant_size<T volatile>: variant_size<T> |
128 | | { |
129 | | }; |
130 | | |
131 | | template<class T> struct variant_size<T const volatile>: variant_size<T> |
132 | | { |
133 | | }; |
134 | | |
135 | | template<class T> struct variant_size<T&>: variant_size<T> |
136 | | { |
137 | | }; |
138 | | |
139 | | template<class T> struct variant_size<T&&>: variant_size<T> |
140 | | { |
141 | | }; |
142 | | |
143 | | #if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) |
144 | | |
145 | | template <class T> /*inline*/ constexpr std::size_t variant_size_v = variant_size<T>::value; |
146 | | |
147 | | #endif |
148 | | |
149 | | template <class... T> struct variant_size<variant<T...>>: mp11::mp_size<variant<T...>> |
150 | | { |
151 | | }; |
152 | | |
153 | | // variant_alternative |
154 | | |
155 | | template<std::size_t I, class T> struct variant_alternative; |
156 | | |
157 | | template<std::size_t I, class T> using variant_alternative_t = typename variant_alternative<I, T>::type; |
158 | | |
159 | | #if BOOST_WORKAROUND(BOOST_GCC, < 40900) |
160 | | |
161 | | namespace detail |
162 | | { |
163 | | |
164 | | template<std::size_t I, class T, bool E> struct variant_alternative_impl |
165 | | { |
166 | | }; |
167 | | |
168 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...>, true> |
169 | | { |
170 | | using type = mp11::mp_at_c<variant<T...>, I>; |
171 | | }; |
172 | | |
173 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const, true>: std::add_const< mp11::mp_at_c<variant<T...>, I> > |
174 | | { |
175 | | }; |
176 | | |
177 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> volatile, true>: std::add_volatile< mp11::mp_at_c<variant<T...>, I> > |
178 | | { |
179 | | }; |
180 | | |
181 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const volatile, true>: std::add_cv< mp11::mp_at_c<variant<T...>, I> > |
182 | | { |
183 | | }; |
184 | | |
185 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...>&, true>: std::add_lvalue_reference< mp11::mp_at_c<variant<T...>, I> > |
186 | | { |
187 | | }; |
188 | | |
189 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const&, true>: std::add_lvalue_reference< mp11::mp_at_c<variant<T...>, I> const > |
190 | | { |
191 | | }; |
192 | | |
193 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> volatile&, true>: std::add_lvalue_reference< mp11::mp_at_c<variant<T...>, I> volatile > |
194 | | { |
195 | | }; |
196 | | |
197 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const volatile&, true>: std::add_lvalue_reference< mp11::mp_at_c<variant<T...>, I> const volatile > |
198 | | { |
199 | | }; |
200 | | |
201 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...>&&, true>: std::add_rvalue_reference< mp11::mp_at_c<variant<T...>, I> > |
202 | | { |
203 | | }; |
204 | | |
205 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const&&, true>: std::add_rvalue_reference< mp11::mp_at_c<variant<T...>, I> const > |
206 | | { |
207 | | }; |
208 | | |
209 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> volatile&&, true>: std::add_rvalue_reference< mp11::mp_at_c<variant<T...>, I> volatile > |
210 | | { |
211 | | }; |
212 | | |
213 | | template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const volatile&&, true>: std::add_rvalue_reference< mp11::mp_at_c<variant<T...>, I> const volatile > |
214 | | { |
215 | | }; |
216 | | |
217 | | } // namespace detail |
218 | | |
219 | | template<std::size_t I, class T> struct variant_alternative |
220 | | { |
221 | | }; |
222 | | |
223 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...>>: public detail::variant_alternative_impl<I, variant<T...>, (I < sizeof...(T))> |
224 | | { |
225 | | }; |
226 | | |
227 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const>: public detail::variant_alternative_impl<I, variant<T...> const, (I < sizeof...(T))> |
228 | | { |
229 | | }; |
230 | | |
231 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> volatile>: public detail::variant_alternative_impl<I, variant<T...> volatile, (I < sizeof...(T))> |
232 | | { |
233 | | }; |
234 | | |
235 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const volatile>: public detail::variant_alternative_impl<I, variant<T...> const volatile, (I < sizeof...(T))> |
236 | | { |
237 | | }; |
238 | | |
239 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...>&>: public detail::variant_alternative_impl<I, variant<T...>&, (I < sizeof...(T))> |
240 | | { |
241 | | }; |
242 | | |
243 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const&>: public detail::variant_alternative_impl<I, variant<T...> const&, (I < sizeof...(T))> |
244 | | { |
245 | | }; |
246 | | |
247 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> volatile&>: public detail::variant_alternative_impl<I, variant<T...> volatile&, (I < sizeof...(T))> |
248 | | { |
249 | | }; |
250 | | |
251 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const volatile&>: public detail::variant_alternative_impl<I, variant<T...> const volatile&, (I < sizeof...(T))> |
252 | | { |
253 | | }; |
254 | | |
255 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...>&&>: public detail::variant_alternative_impl<I, variant<T...>&&, (I < sizeof...(T))> |
256 | | { |
257 | | }; |
258 | | |
259 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const&&>: public detail::variant_alternative_impl<I, variant<T...> const&&, (I < sizeof...(T))> |
260 | | { |
261 | | }; |
262 | | |
263 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> volatile&&>: public detail::variant_alternative_impl<I, variant<T...> volatile&&, (I < sizeof...(T))> |
264 | | { |
265 | | }; |
266 | | |
267 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const volatile&&>: public detail::variant_alternative_impl<I, variant<T...> const volatile&&, (I < sizeof...(T))> |
268 | | { |
269 | | }; |
270 | | |
271 | | #else |
272 | | |
273 | | namespace detail |
274 | | { |
275 | | |
276 | | #if defined( BOOST_MP11_VERSION ) && BOOST_MP11_VERSION >= 107000 |
277 | | |
278 | | template<class I, class T, class Q> using var_alt_impl = mp11::mp_invoke_q<Q, variant_alternative_t<I::value, T>>; |
279 | | |
280 | | #else |
281 | | |
282 | | template<class I, class T, class Q> using var_alt_impl = mp11::mp_invoke<Q, variant_alternative_t<I::value, T>>; |
283 | | |
284 | | #endif |
285 | | |
286 | | } // namespace detail |
287 | | |
288 | | template<std::size_t I, class T> struct variant_alternative |
289 | | { |
290 | | }; |
291 | | |
292 | | template<std::size_t I, class T> struct variant_alternative<I, T const>: mp11::mp_defer<detail::var_alt_impl, mp11::mp_size_t<I>, T, mp11::mp_quote_trait<std::add_const>> |
293 | | { |
294 | | }; |
295 | | |
296 | | template<std::size_t I, class T> struct variant_alternative<I, T volatile>: mp11::mp_defer<detail::var_alt_impl, mp11::mp_size_t<I>, T, mp11::mp_quote_trait<std::add_volatile>> |
297 | | { |
298 | | }; |
299 | | |
300 | | template<std::size_t I, class T> struct variant_alternative<I, T const volatile>: mp11::mp_defer<detail::var_alt_impl, mp11::mp_size_t<I>, T, mp11::mp_quote_trait<std::add_cv>> |
301 | | { |
302 | | }; |
303 | | |
304 | | template<std::size_t I, class T> struct variant_alternative<I, T&>: mp11::mp_defer<detail::var_alt_impl, mp11::mp_size_t<I>, T, mp11::mp_quote_trait<std::add_lvalue_reference>> |
305 | | { |
306 | | }; |
307 | | |
308 | | template<std::size_t I, class T> struct variant_alternative<I, T&&>: mp11::mp_defer<detail::var_alt_impl, mp11::mp_size_t<I>, T, mp11::mp_quote_trait<std::add_rvalue_reference>> |
309 | | { |
310 | | }; |
311 | | |
312 | | template<std::size_t I, class... T> struct variant_alternative<I, variant<T...>>: mp11::mp_defer<mp11::mp_at, variant<T...>, mp11::mp_size_t<I>> |
313 | | { |
314 | | }; |
315 | | |
316 | | #endif |
317 | | |
318 | | // variant_npos |
319 | | |
320 | | constexpr std::size_t variant_npos = ~static_cast<std::size_t>( 0 ); |
321 | | |
322 | | // holds_alternative |
323 | | |
324 | | #if !defined(BOOST_MP11_HAS_CXX14_CONSTEXPR) |
325 | | |
326 | | template<class U, class... T> constexpr bool holds_alternative( variant<T...> const& v ) noexcept |
327 | | { |
328 | | static_assert( mp11::mp_contains<variant<T...>, U>::value, "The type must be present in the list of variant alternatives" ); |
329 | | |
330 | | using A = bool[]; |
331 | | return A{ std::is_same<U, T>::value... }[ v.index() ]; |
332 | | } |
333 | | |
334 | | #else |
335 | | |
336 | | namespace detail |
337 | | { |
338 | | |
339 | | template<class U, class V> struct holds_alternative_L |
340 | | { |
341 | | template<class I> constexpr bool operator()( I ) const noexcept |
342 | | { |
343 | | return std::is_same< U, mp11::mp_at<V, I> >::value; |
344 | | } |
345 | | }; |
346 | | |
347 | | } // namespace detail |
348 | | |
349 | | template<class U, class... T> constexpr bool holds_alternative( variant<T...> const& v ) noexcept |
350 | | { |
351 | | using V = variant<T...>; |
352 | | static_assert( mp11::mp_contains<V, U>::value, "The type must be present in the list of variant alternatives" ); |
353 | | |
354 | | return mp11::mp_with_index<sizeof...(T)>( v.index(), detail::holds_alternative_L<U, V>() ); |
355 | | } |
356 | | |
357 | | #endif |
358 | | |
359 | | // get (index) |
360 | | |
361 | | template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>>& get(variant<T...>& v) |
362 | | { |
363 | | static_assert( I < sizeof...(T), "Index out of bounds" ); |
364 | | return ( v.index() != I? detail::throw_bad_variant_access(): (void)0 ), v._get_impl( mp11::mp_size_t<I>() ); |
365 | | } |
366 | | |
367 | | template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>>&& get(variant<T...>&& v) |
368 | | { |
369 | | static_assert( I < sizeof...(T), "Index out of bounds" ); |
370 | | |
371 | | #if !BOOST_WORKAROUND(BOOST_MSVC, < 1930) |
372 | | |
373 | | return ( v.index() != I? detail::throw_bad_variant_access(): (void)0 ), std::move( v._get_impl( mp11::mp_size_t<I>() ) ); |
374 | | |
375 | | #else |
376 | | |
377 | | if( v.index() != I ) detail::throw_bad_variant_access(); |
378 | | return std::move( v._get_impl( mp11::mp_size_t<I>() ) ); |
379 | | |
380 | | #endif |
381 | | } |
382 | | |
383 | | template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>> const& get(variant<T...> const& v) |
384 | | { |
385 | | static_assert( I < sizeof...(T), "Index out of bounds" ); |
386 | | return ( v.index() != I? detail::throw_bad_variant_access(): (void)0 ), v._get_impl( mp11::mp_size_t<I>() ); |
387 | | } |
388 | | |
389 | | template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>> const&& get(variant<T...> const&& v) |
390 | | { |
391 | | static_assert( I < sizeof...(T), "Index out of bounds" ); |
392 | | |
393 | | #if !BOOST_WORKAROUND(BOOST_MSVC, < 1930) |
394 | | |
395 | | return ( v.index() != I? detail::throw_bad_variant_access(): (void)0 ), std::move( v._get_impl( mp11::mp_size_t<I>() ) ); |
396 | | |
397 | | #else |
398 | | |
399 | | if( v.index() != I ) detail::throw_bad_variant_access(); |
400 | | return std::move( v._get_impl( mp11::mp_size_t<I>() ) ); |
401 | | |
402 | | #endif |
403 | | } |
404 | | |
405 | | // unsafe_get |
406 | | |
407 | | #if !defined(BOOST_NO_CXX14_CONSTEXPR) |
408 | 0 | # define BOOST_VARIANT2_CX14_ASSERT(expr) BOOST_ASSERT(expr); |
409 | | #else |
410 | | # define BOOST_VARIANT2_CX14_ASSERT(expr) |
411 | | #endif |
412 | | |
413 | | template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>>& unsafe_get(variant<T...>& v) |
414 | 0 | { |
415 | 0 | static_assert( I < sizeof...(T), "Index out of bounds" ); |
416 | |
|
417 | 0 | BOOST_VARIANT2_CX14_ASSERT( v.index() == I ) |
418 | |
|
419 | 0 | return v._get_impl( mp11::mp_size_t<I>() ); |
420 | 0 | } Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<long, boost::system::error_code> >::type& boost::variant2::unsafe_get<0ul, long, boost::system::error_code>(boost::variant2::variant<long, boost::system::error_code>&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<long, boost::system::error_code> >::type& boost::variant2::unsafe_get<1ul, long, boost::system::error_code>(boost::variant2::variant<long, boost::system::error_code>&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<unsigned long, boost::system::error_code> >::type& boost::variant2::unsafe_get<0ul, unsigned long, boost::system::error_code>(boost::variant2::variant<unsigned long, boost::system::error_code>&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<unsigned long, boost::system::error_code> >::type& boost::variant2::unsafe_get<1ul, unsigned long, boost::system::error_code>(boost::variant2::variant<unsigned long, boost::system::error_code>&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<double, boost::system::error_code> >::type& boost::variant2::unsafe_get<0ul, double, boost::system::error_code>(boost::variant2::variant<double, boost::system::error_code>&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<double, boost::system::error_code> >::type& boost::variant2::unsafe_get<1ul, double, boost::system::error_code>(boost::variant2::variant<double, boost::system::error_code>&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<bool, boost::system::error_code> >::type& boost::variant2::unsafe_get<0ul, bool, boost::system::error_code>(boost::variant2::variant<bool, boost::system::error_code>&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<bool, boost::system::error_code> >::type& boost::variant2::unsafe_get<1ul, bool, boost::system::error_code>(boost::variant2::variant<bool, boost::system::error_code>&) |
421 | | |
422 | | template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>>&& unsafe_get(variant<T...>&& v) |
423 | | { |
424 | | static_assert( I < sizeof...(T), "Index out of bounds" ); |
425 | | |
426 | | BOOST_VARIANT2_CX14_ASSERT( v.index() == I ) |
427 | | |
428 | | return std::move( v._get_impl( mp11::mp_size_t<I>() ) ); |
429 | | } |
430 | | |
431 | | template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>> const& unsafe_get(variant<T...> const& v) |
432 | 0 | { |
433 | 0 | static_assert( I < sizeof...(T), "Index out of bounds" ); |
434 | |
|
435 | 0 | BOOST_VARIANT2_CX14_ASSERT( v.index() == I ) |
436 | |
|
437 | 0 | return v._get_impl( mp11::mp_size_t<I>() ); |
438 | 0 | } Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<boost::json::value const*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, boost::json::value const*, boost::system::error_code>(boost::variant2::variant<boost::json::value const*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<boost::json::value const*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, boost::json::value const*, boost::system::error_code>(boost::variant2::variant<boost::json::value const*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<boost::json::value*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, boost::json::value*, boost::system::error_code>(boost::variant2::variant<boost::json::value*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<boost::json::value*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, boost::json::value*, boost::system::error_code>(boost::variant2::variant<boost::json::value*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<char const*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, char const*, boost::system::error_code>(boost::variant2::variant<char const*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<char const*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, char const*, boost::system::error_code>(boost::variant2::variant<char const*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<boost::json::object*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, boost::json::object*, boost::system::error_code>(boost::variant2::variant<boost::json::object*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<boost::json::object*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, boost::json::object*, boost::system::error_code>(boost::variant2::variant<boost::json::object*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<boost::json::object const*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, boost::json::object const*, boost::system::error_code>(boost::variant2::variant<boost::json::object const*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<boost::json::object const*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, boost::json::object const*, boost::system::error_code>(boost::variant2::variant<boost::json::object const*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<boost::json::array*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, boost::json::array*, boost::system::error_code>(boost::variant2::variant<boost::json::array*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<boost::json::array*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, boost::json::array*, boost::system::error_code>(boost::variant2::variant<boost::json::array*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<boost::json::array const*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, boost::json::array const*, boost::system::error_code>(boost::variant2::variant<boost::json::array const*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<boost::json::array const*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, boost::json::array const*, boost::system::error_code>(boost::variant2::variant<boost::json::array const*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<boost::json::string const*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, boost::json::string const*, boost::system::error_code>(boost::variant2::variant<boost::json::string const*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<boost::json::string const*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, boost::json::string const*, boost::system::error_code>(boost::variant2::variant<boost::json::string const*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<long*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, long*, boost::system::error_code>(boost::variant2::variant<long*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<long*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, long*, boost::system::error_code>(boost::variant2::variant<long*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<unsigned long*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, unsigned long*, boost::system::error_code>(boost::variant2::variant<unsigned long*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<unsigned long*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, unsigned long*, boost::system::error_code>(boost::variant2::variant<unsigned long*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<double*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, double*, boost::system::error_code>(boost::variant2::variant<double*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<double*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, double*, boost::system::error_code>(boost::variant2::variant<double*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<0ul, boost::variant2::variant<bool*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<0ul, bool*, boost::system::error_code>(boost::variant2::variant<bool*, boost::system::error_code> const&) Unexecuted instantiation: boost::variant2::variant_alternative<1ul, boost::variant2::variant<bool*, boost::system::error_code> >::type const& boost::variant2::unsafe_get<1ul, bool*, boost::system::error_code>(boost::variant2::variant<bool*, boost::system::error_code> const&) |
439 | | |
440 | | template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>> const&& unsafe_get(variant<T...> const&& v) |
441 | | { |
442 | | static_assert( I < sizeof...(T), "Index out of bounds" ); |
443 | | |
444 | | BOOST_VARIANT2_CX14_ASSERT( v.index() == I ) |
445 | | |
446 | | return std::move( v._get_impl( mp11::mp_size_t<I>() ) ); |
447 | | } |
448 | | |
449 | | // get (type) |
450 | | |
451 | | namespace detail |
452 | | { |
453 | | |
454 | | template<class U, class V> struct get_if_impl_L1 |
455 | | { |
456 | | V& v_; |
457 | | |
458 | | template<class I> constexpr U* fn( I, mp11::mp_true ) const noexcept |
459 | | { |
460 | | return &v_._get_impl( I() ); |
461 | | } |
462 | | |
463 | | template<class I> constexpr U* fn( I, mp11::mp_false ) const noexcept |
464 | | { |
465 | | return nullptr; |
466 | | } |
467 | | |
468 | | template<class I> constexpr U* operator()( I ) const noexcept |
469 | | { |
470 | | return this->fn( I(), std::is_same<U, mp11::mp_at<V, I>>() ); |
471 | | } |
472 | | }; |
473 | | |
474 | | template<class U, class... T> constexpr U* get_if_impl( variant<T...>& v ) noexcept |
475 | | { |
476 | | return mp11::mp_with_index<sizeof...(T)>( v.index(), get_if_impl_L1< U, variant<T...> >{ v } ); |
477 | | } |
478 | | |
479 | | template<class U, class V> struct get_if_impl_L2 |
480 | | { |
481 | | V const& v_; |
482 | | |
483 | | template<class I> constexpr U const* fn( I, mp11::mp_true ) const noexcept |
484 | | { |
485 | | return &v_._get_impl( I() ); |
486 | | } |
487 | | |
488 | | template<class I> constexpr U const* fn( I, mp11::mp_false ) const noexcept |
489 | | { |
490 | | return nullptr; |
491 | | } |
492 | | |
493 | | template<class I> constexpr U const* operator()( I ) const noexcept |
494 | | { |
495 | | return this->fn( I(), std::is_same<U, mp11::mp_at<V, I>>() ); |
496 | | } |
497 | | }; |
498 | | |
499 | | template<class U, class... T> constexpr U const* get_if_impl( variant<T...> const& v ) noexcept |
500 | | { |
501 | | return mp11::mp_with_index<sizeof...(T)>( v.index(), get_if_impl_L2< U, variant<T...> >{ v } ); |
502 | | } |
503 | | |
504 | | } // namespace detail |
505 | | |
506 | | template<class U, class... T> constexpr U& get(variant<T...>& v) |
507 | | { |
508 | | static_assert( mp11::mp_contains<variant<T...>, U>::value, "The type must be present in the list of variant alternatives" ); |
509 | | return ( !holds_alternative<U>( v )? detail::throw_bad_variant_access(): (void)0 ), *detail::get_if_impl<U>( v ); |
510 | | } |
511 | | |
512 | | template<class U, class... T> constexpr U&& get(variant<T...>&& v) |
513 | | { |
514 | | static_assert( mp11::mp_contains<variant<T...>, U>::value, "The type must be present in the list of variant alternatives" ); |
515 | | |
516 | | #if !BOOST_WORKAROUND(BOOST_MSVC, < 1930) |
517 | | |
518 | | return ( !holds_alternative<U>( v )? detail::throw_bad_variant_access(): (void)0 ), std::move( *detail::get_if_impl<U>( v ) ); |
519 | | |
520 | | #else |
521 | | |
522 | | if( !holds_alternative<U>( v ) ) detail::throw_bad_variant_access(); |
523 | | return std::move( *detail::get_if_impl<U>( v ) ); |
524 | | |
525 | | #endif |
526 | | } |
527 | | |
528 | | template<class U, class... T> constexpr U const& get(variant<T...> const& v) |
529 | | { |
530 | | static_assert( mp11::mp_contains<variant<T...>, U>::value, "The type must be present in the list of variant alternatives" ); |
531 | | return ( !holds_alternative<U>( v )? detail::throw_bad_variant_access(): (void)0 ), *detail::get_if_impl<U>( v ); |
532 | | } |
533 | | |
534 | | template<class U, class... T> constexpr U const&& get(variant<T...> const&& v) |
535 | | { |
536 | | static_assert( mp11::mp_contains<variant<T...>, U>::value, "The type must be present in the list of variant alternatives" ); |
537 | | |
538 | | #if !BOOST_WORKAROUND(BOOST_MSVC, < 1930) |
539 | | |
540 | | return ( !holds_alternative<U>( v )? detail::throw_bad_variant_access(): (void)0 ), std::move( *detail::get_if_impl<U>( v ) ); |
541 | | |
542 | | #else |
543 | | |
544 | | if( !holds_alternative<U>( v ) ) detail::throw_bad_variant_access(); |
545 | | return std::move( *detail::get_if_impl<U>( v ) ); |
546 | | |
547 | | #endif |
548 | | } |
549 | | |
550 | | // get_if (index) |
551 | | |
552 | | template<std::size_t I, class... T> constexpr typename std::add_pointer<variant_alternative_t<I, variant<T...>>>::type get_if(variant<T...>* v) noexcept |
553 | | { |
554 | | static_assert( I < sizeof...(T), "Index out of bounds" ); |
555 | | return v && v->index() == I? &v->_get_impl( mp11::mp_size_t<I>() ): 0; |
556 | | } |
557 | | |
558 | | template<std::size_t I, class... T> constexpr typename std::add_pointer<const variant_alternative_t<I, variant<T...>>>::type get_if(variant<T...> const * v) noexcept |
559 | | { |
560 | | static_assert( I < sizeof...(T), "Index out of bounds" ); |
561 | | return v && v->index() == I? &v->_get_impl( mp11::mp_size_t<I>() ): 0; |
562 | | } |
563 | | |
564 | | // get_if (type) |
565 | | |
566 | | template<class U, class... T> constexpr typename std::add_pointer<U>::type get_if(variant<T...>* v) noexcept |
567 | | { |
568 | | static_assert( mp11::mp_contains<variant<T...>, U>::value, "The type must be present in the list of variant alternatives" ); |
569 | | return v && holds_alternative<U>( *v )? detail::get_if_impl<U>( *v ): 0; |
570 | | } |
571 | | |
572 | | template<class U, class... T> constexpr typename std::add_pointer<U const>::type get_if(variant<T...> const* v) noexcept |
573 | | { |
574 | | static_assert( mp11::mp_contains<variant<T...>, U>::value, "The type must be present in the list of variant alternatives" ); |
575 | | return v && holds_alternative<U>( *v )? detail::get_if_impl<U>( *v ): 0; |
576 | | } |
577 | | |
578 | | // |
579 | | |
580 | | namespace detail |
581 | | { |
582 | | |
583 | | // trivially_* |
584 | | |
585 | | #if defined( BOOST_LIBSTDCXX_VERSION ) && BOOST_LIBSTDCXX_VERSION < 50000 |
586 | | |
587 | | template<class T> struct is_trivially_copy_constructible: mp11::mp_bool<std::is_copy_constructible<T>::value && std::has_trivial_copy_constructor<T>::value> |
588 | | { |
589 | | }; |
590 | | |
591 | | template<class T> struct is_trivially_copy_assignable: mp11::mp_bool<std::is_copy_assignable<T>::value && std::has_trivial_copy_assign<T>::value> |
592 | | { |
593 | | }; |
594 | | |
595 | | template<class T> struct is_trivially_move_constructible: mp11::mp_bool<std::is_move_constructible<T>::value && std::is_trivial<T>::value> |
596 | | { |
597 | | }; |
598 | | |
599 | | template<class T> struct is_trivially_move_assignable: mp11::mp_bool<std::is_move_assignable<T>::value && std::is_trivial<T>::value> |
600 | | { |
601 | | }; |
602 | | |
603 | | #else |
604 | | |
605 | | using std::is_trivially_copy_constructible; |
606 | | using std::is_trivially_copy_assignable; |
607 | | using std::is_trivially_move_constructible; |
608 | | using std::is_trivially_move_assignable; |
609 | | |
610 | | #endif |
611 | | |
612 | | // variant_storage |
613 | | |
614 | | template<class D, class... T> union variant_storage_impl; |
615 | | |
616 | | template<class... T> using variant_storage = variant_storage_impl<mp11::mp_all<std::is_trivially_destructible<T>...>, T...>; |
617 | | |
618 | | template<class D> union variant_storage_impl<D> |
619 | | { |
620 | | }; |
621 | | |
622 | | // not all trivially destructible |
623 | | template<class T1, class... T> union variant_storage_impl<mp11::mp_false, T1, T...> |
624 | | { |
625 | | T1 first_; |
626 | | variant_storage<T...> rest_; |
627 | | |
628 | | #if defined(BOOST_GCC) && (__GNUC__ >= 12) |
629 | | // false positive, see https://github.com/boostorg/variant2/issues/55 |
630 | | # pragma GCC diagnostic push |
631 | | # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" |
632 | | #endif |
633 | | |
634 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): first_( std::forward<A>(a)... ) |
635 | | { |
636 | | } |
637 | | |
638 | | #if defined(BOOST_GCC) && (__GNUC__ >= 12) |
639 | | # pragma GCC diagnostic pop |
640 | | #endif |
641 | | |
642 | | template<std::size_t I, class... A> constexpr variant_storage_impl( mp11::mp_size_t<I>, A&&... a ): rest_( mp11::mp_size_t<I-1>(), std::forward<A>(a)... ) |
643 | | { |
644 | | } |
645 | | |
646 | | BOOST_VARIANT2_CXX20_CONSTEXPR ~variant_storage_impl() |
647 | | { |
648 | | } |
649 | | |
650 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<0>, A&&... a ) |
651 | | { |
652 | | ::new( &first_ ) T1( std::forward<A>(a)... ); |
653 | | } |
654 | | |
655 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<I>, A&&... a ) |
656 | | { |
657 | | rest_.emplace( mp11::mp_size_t<I-1>(), std::forward<A>(a)... ); |
658 | | } |
659 | | |
660 | 0 | BOOST_CXX14_CONSTEXPR T1& get( mp11::mp_size_t<0> ) noexcept { return first_; }Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::value, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::json::value, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::object, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::json::object, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::array, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::json::array, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::string, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::json::string, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) |
661 | | constexpr T1 const& get( mp11::mp_size_t<0> ) const noexcept { return first_; } |
662 | | |
663 | 0 | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<mp11::mp_list<T...>, I-1>& get( mp11::mp_size_t<I> ) noexcept { return rest_.get( mp11::mp_size_t<I-1>() ); }Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::value, boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::value, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::json::value, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::value, boost::system::error_code>, (2ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::value, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::object, boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::object, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::json::object, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::object, boost::system::error_code>, (2ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::object, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::array, boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::array, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::json::array, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::array, boost::system::error_code>, (2ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::array, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::string, boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::string, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::json::string, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::string, boost::system::error_code>, (2ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, false>, boost::variant2::detail::none, boost::json::string, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) |
664 | | template<std::size_t I> constexpr mp11::mp_at_c<mp11::mp_list<T...>, I-1> const& get( mp11::mp_size_t<I> ) const noexcept { return rest_.get( mp11::mp_size_t<I-1>() ); } |
665 | | }; |
666 | | |
667 | | template<class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class... T> union variant_storage_impl<mp11::mp_false, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T...> |
668 | | { |
669 | | T0 t0_; |
670 | | T1 t1_; |
671 | | T2 t2_; |
672 | | T3 t3_; |
673 | | T4 t4_; |
674 | | T5 t5_; |
675 | | T6 t6_; |
676 | | T7 t7_; |
677 | | T8 t8_; |
678 | | T9 t9_; |
679 | | |
680 | | variant_storage<T...> rest_; |
681 | | |
682 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): t0_( std::forward<A>(a)... ) {} |
683 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<1>, A&&... a ): t1_( std::forward<A>(a)... ) {} |
684 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<2>, A&&... a ): t2_( std::forward<A>(a)... ) {} |
685 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<3>, A&&... a ): t3_( std::forward<A>(a)... ) {} |
686 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<4>, A&&... a ): t4_( std::forward<A>(a)... ) {} |
687 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<5>, A&&... a ): t5_( std::forward<A>(a)... ) {} |
688 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<6>, A&&... a ): t6_( std::forward<A>(a)... ) {} |
689 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<7>, A&&... a ): t7_( std::forward<A>(a)... ) {} |
690 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<8>, A&&... a ): t8_( std::forward<A>(a)... ) {} |
691 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<9>, A&&... a ): t9_( std::forward<A>(a)... ) {} |
692 | | |
693 | | template<std::size_t I, class... A> constexpr variant_storage_impl( mp11::mp_size_t<I>, A&&... a ): rest_( mp11::mp_size_t<I-10>(), std::forward<A>(a)... ) {} |
694 | | |
695 | | BOOST_VARIANT2_CXX20_CONSTEXPR ~variant_storage_impl() |
696 | | { |
697 | | } |
698 | | |
699 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<0>, A&&... a ) { ::new( &t0_ ) T0( std::forward<A>(a)... ); } |
700 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<1>, A&&... a ) { ::new( &t1_ ) T1( std::forward<A>(a)... ); } |
701 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<2>, A&&... a ) { ::new( &t2_ ) T2( std::forward<A>(a)... ); } |
702 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<3>, A&&... a ) { ::new( &t3_ ) T3( std::forward<A>(a)... ); } |
703 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<4>, A&&... a ) { ::new( &t4_ ) T4( std::forward<A>(a)... ); } |
704 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<5>, A&&... a ) { ::new( &t5_ ) T5( std::forward<A>(a)... ); } |
705 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<6>, A&&... a ) { ::new( &t6_ ) T6( std::forward<A>(a)... ); } |
706 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<7>, A&&... a ) { ::new( &t7_ ) T7( std::forward<A>(a)... ); } |
707 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<8>, A&&... a ) { ::new( &t8_ ) T8( std::forward<A>(a)... ); } |
708 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<9>, A&&... a ) { ::new( &t9_ ) T9( std::forward<A>(a)... ); } |
709 | | |
710 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<I>, A&&... a ) |
711 | | { |
712 | | rest_.emplace( mp11::mp_size_t<I-10>(), std::forward<A>(a)... ); |
713 | | } |
714 | | |
715 | | BOOST_CXX14_CONSTEXPR T0& get( mp11::mp_size_t<0> ) noexcept { return t0_; } |
716 | | constexpr T0 const& get( mp11::mp_size_t<0> ) const noexcept { return t0_; } |
717 | | |
718 | | BOOST_CXX14_CONSTEXPR T1& get( mp11::mp_size_t<1> ) noexcept { return t1_; } |
719 | | constexpr T1 const& get( mp11::mp_size_t<1> ) const noexcept { return t1_; } |
720 | | |
721 | | BOOST_CXX14_CONSTEXPR T2& get( mp11::mp_size_t<2> ) noexcept { return t2_; } |
722 | | constexpr T2 const& get( mp11::mp_size_t<2> ) const noexcept { return t2_; } |
723 | | |
724 | | BOOST_CXX14_CONSTEXPR T3& get( mp11::mp_size_t<3> ) noexcept { return t3_; } |
725 | | constexpr T3 const& get( mp11::mp_size_t<3> ) const noexcept { return t3_; } |
726 | | |
727 | | BOOST_CXX14_CONSTEXPR T4& get( mp11::mp_size_t<4> ) noexcept { return t4_; } |
728 | | constexpr T4 const& get( mp11::mp_size_t<4> ) const noexcept { return t4_; } |
729 | | |
730 | | BOOST_CXX14_CONSTEXPR T5& get( mp11::mp_size_t<5> ) noexcept { return t5_; } |
731 | | constexpr T5 const& get( mp11::mp_size_t<5> ) const noexcept { return t5_; } |
732 | | |
733 | | BOOST_CXX14_CONSTEXPR T6& get( mp11::mp_size_t<6> ) noexcept { return t6_; } |
734 | | constexpr T6 const& get( mp11::mp_size_t<6> ) const noexcept { return t6_; } |
735 | | |
736 | | BOOST_CXX14_CONSTEXPR T7& get( mp11::mp_size_t<7> ) noexcept { return t7_; } |
737 | | constexpr T7 const& get( mp11::mp_size_t<7> ) const noexcept { return t7_; } |
738 | | |
739 | | BOOST_CXX14_CONSTEXPR T8& get( mp11::mp_size_t<8> ) noexcept { return t8_; } |
740 | | constexpr T8 const& get( mp11::mp_size_t<8> ) const noexcept { return t8_; } |
741 | | |
742 | | BOOST_CXX14_CONSTEXPR T9& get( mp11::mp_size_t<9> ) noexcept { return t9_; } |
743 | | constexpr T9 const& get( mp11::mp_size_t<9> ) const noexcept { return t9_; } |
744 | | |
745 | | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<mp11::mp_list<T...>, I-10>& get( mp11::mp_size_t<I> ) noexcept { return rest_.get( mp11::mp_size_t<I-10>() ); } |
746 | | template<std::size_t I> constexpr mp11::mp_at_c<mp11::mp_list<T...>, I-10> const& get( mp11::mp_size_t<I> ) const noexcept { return rest_.get( mp11::mp_size_t<I-10>() ); } |
747 | | }; |
748 | | |
749 | | // all trivially destructible |
750 | | template<class T1, class... T> union variant_storage_impl<mp11::mp_true, T1, T...> |
751 | | { |
752 | | T1 first_; |
753 | | variant_storage<T...> rest_; |
754 | | |
755 | 0 | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): first_( std::forward<A>(a)... ) |
756 | 0 | { |
757 | 0 | } Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::value*, boost::system::error_code>::variant_storage_impl<boost::json::value*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::value*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::value const*, boost::system::error_code>::variant_storage_impl<boost::json::value const*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::value const*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, char*, boost::system::error_code>::variant_storage_impl<char*>(std::__1::integral_constant<unsigned long, 0ul>, char*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, char const*, boost::system::error_code>::variant_storage_impl<char const*>(std::__1::integral_constant<unsigned long, 0ul>, char const*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::array*, boost::system::error_code>::variant_storage_impl<boost::json::array*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::array*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::array const*, boost::system::error_code>::variant_storage_impl<boost::json::array const*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::array const*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::object*, boost::system::error_code>::variant_storage_impl<boost::json::object*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::object*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::object const*, boost::system::error_code>::variant_storage_impl<boost::json::object const*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::object const*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::string*, boost::system::error_code>::variant_storage_impl<boost::json::string*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::string*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::string const*, boost::system::error_code>::variant_storage_impl<boost::json::string const*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::string const*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, long*, boost::system::error_code>::variant_storage_impl<long*>(std::__1::integral_constant<unsigned long, 0ul>, long*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, long, boost::system::error_code>::variant_storage_impl<long const&>(std::__1::integral_constant<unsigned long, 0ul>, long const&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, unsigned long*, boost::system::error_code>::variant_storage_impl<unsigned long*>(std::__1::integral_constant<unsigned long, 0ul>, unsigned long*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, unsigned long, boost::system::error_code>::variant_storage_impl<unsigned long const&>(std::__1::integral_constant<unsigned long, 0ul>, unsigned long const&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, double*, boost::system::error_code>::variant_storage_impl<double*>(std::__1::integral_constant<unsigned long, 0ul>, double*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, double, boost::system::error_code>::variant_storage_impl<double const&>(std::__1::integral_constant<unsigned long, 0ul>, double const&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, bool*, boost::system::error_code>::variant_storage_impl<bool*>(std::__1::integral_constant<unsigned long, 0ul>, bool*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, bool, boost::system::error_code>::variant_storage_impl<bool const&>(std::__1::integral_constant<unsigned long, 0ul>, bool const&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, decltype(nullptr), boost::system::error_code>::variant_storage_impl<decltype(nullptr)>(std::__1::integral_constant<unsigned long, 0ul>, decltype(nullptr)&&) |
758 | | |
759 | 0 | template<std::size_t I, class... A> constexpr variant_storage_impl( mp11::mp_size_t<I>, A&&... a ): rest_( mp11::mp_size_t<I-1>(), std::forward<A>(a)... ) |
760 | 0 | { |
761 | 0 | } Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::value*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::value*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::value*, boost::system::error_code>::variant_storage_impl<1ul, boost::json::value*>(std::__1::integral_constant<unsigned long, 1ul>, boost::json::value*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::value const*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::value const*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::value const*, boost::system::error_code>::variant_storage_impl<1ul, boost::json::value const*>(std::__1::integral_constant<unsigned long, 1ul>, boost::json::value const*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, char*, boost::system::error_code>::variant_storage_impl<1ul, char*>(std::__1::integral_constant<unsigned long, 1ul>, char*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, char*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, char*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, char const*, boost::system::error_code>::variant_storage_impl<1ul, char const*>(std::__1::integral_constant<unsigned long, 1ul>, char const*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, char const*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, char const*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::array*, boost::system::error_code>::variant_storage_impl<1ul, boost::json::array*>(std::__1::integral_constant<unsigned long, 1ul>, boost::json::array*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::array*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::array*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::array const*, boost::system::error_code>::variant_storage_impl<1ul, boost::json::array const*>(std::__1::integral_constant<unsigned long, 1ul>, boost::json::array const*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::array const*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::array const*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::object*, boost::system::error_code>::variant_storage_impl<1ul, boost::json::object*>(std::__1::integral_constant<unsigned long, 1ul>, boost::json::object*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::object*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::object*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::object const*, boost::system::error_code>::variant_storage_impl<1ul, boost::json::object const*>(std::__1::integral_constant<unsigned long, 1ul>, boost::json::object const*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::object const*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::object const*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::string*, boost::system::error_code>::variant_storage_impl<1ul, boost::json::string*>(std::__1::integral_constant<unsigned long, 1ul>, boost::json::string*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::string*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::string*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::string const*, boost::system::error_code>::variant_storage_impl<1ul, boost::json::string const*>(std::__1::integral_constant<unsigned long, 1ul>, boost::json::string const*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::string const*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::string const*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, long*, boost::system::error_code>::variant_storage_impl<1ul, long*>(std::__1::integral_constant<unsigned long, 1ul>, long*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, long*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, long*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, long, boost::system::error_code>::variant_storage_impl<1ul, long const&>(std::__1::integral_constant<unsigned long, 1ul>, long const&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, long, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, long, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, unsigned long*, boost::system::error_code>::variant_storage_impl<1ul, unsigned long*>(std::__1::integral_constant<unsigned long, 1ul>, unsigned long*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, unsigned long*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, unsigned long*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, unsigned long, boost::system::error_code>::variant_storage_impl<1ul, unsigned long const&>(std::__1::integral_constant<unsigned long, 1ul>, unsigned long const&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, unsigned long, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, unsigned long, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, double*, boost::system::error_code>::variant_storage_impl<1ul, double*>(std::__1::integral_constant<unsigned long, 1ul>, double*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, double*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, double*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, double, boost::system::error_code>::variant_storage_impl<1ul, double const&>(std::__1::integral_constant<unsigned long, 1ul>, double const&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, double, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, double, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, bool*, boost::system::error_code>::variant_storage_impl<1ul, bool*>(std::__1::integral_constant<unsigned long, 1ul>, bool*&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, bool*, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, bool*, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, bool, boost::system::error_code>::variant_storage_impl<1ul, bool const&>(std::__1::integral_constant<unsigned long, 1ul>, bool const&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, bool, boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, bool, boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, decltype(nullptr), boost::system::error_code>::variant_storage_impl<1ul, decltype(nullptr)>(std::__1::integral_constant<unsigned long, 1ul>, decltype(nullptr)&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, decltype(nullptr), boost::system::error_code>::variant_storage_impl<2ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 2ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, decltype(nullptr), boost::system::error_code>::variant_storage_impl<1ul, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) |
762 | | |
763 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<0>, A&&... a ) |
764 | | { |
765 | | ::new( &first_ ) T1( std::forward<A>(a)... ); |
766 | | } |
767 | | |
768 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<I>, A&&... a ) |
769 | | { |
770 | | rest_.emplace( mp11::mp_size_t<I-1>(), std::forward<A>(a)... ); |
771 | | } |
772 | | |
773 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_true, mp11::mp_size_t<I>, A&&... a ) |
774 | | { |
775 | | #if defined(BOOST_GCC) && (__GNUC__ >= 7) |
776 | | # pragma GCC diagnostic push |
777 | | // False positive in at least GCC 7 and GCC 10 ASAN triggered by monostate (via result<void>) |
778 | | # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" |
779 | | #if __GNUC__ >= 12 |
780 | | // False positive in at least GCC 12 and GCC 13 ASAN and -Og triggered by monostate (via result<void>) |
781 | | # pragma GCC diagnostic ignored "-Wuninitialized" |
782 | | #endif |
783 | | #endif |
784 | | |
785 | | *this = variant_storage_impl( mp11::mp_size_t<I>(), std::forward<A>(a)... ); |
786 | | |
787 | | #if defined(BOOST_GCC) && (__GNUC__ >= 7) |
788 | | # pragma GCC diagnostic pop |
789 | | #endif |
790 | | } |
791 | | |
792 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<I>, A&&... a ) |
793 | | { |
794 | | this->emplace_impl( mp11::mp_all<detail::is_trivially_move_assignable<T1>, detail::is_trivially_move_assignable<T>...>(), mp11::mp_size_t<I>(), std::forward<A>(a)... ); |
795 | | } |
796 | | |
797 | 0 | BOOST_CXX14_CONSTEXPR T1& get( mp11::mp_size_t<0> ) noexcept { return first_; }Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, long, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, unsigned long, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, double, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, bool, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) |
798 | 0 | constexpr T1 const& get( mp11::mp_size_t<0> ) const noexcept { return first_; }Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::value const*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::value*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, char const*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::object*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::object const*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::array*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::array const*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::string const*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, long*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, unsigned long*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, double*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, bool*, boost::system::error_code>::get(std::__1::integral_constant<unsigned long, 0ul>) const |
799 | | |
800 | 0 | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<mp11::mp_list<T...>, I-1>& get( mp11::mp_size_t<I> ) noexcept { return rest_.get( mp11::mp_size_t<I-1>() ); }Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<long, boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, long, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<long, boost::system::error_code>, (2ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, long, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, long, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<unsigned long, boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, unsigned long, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<unsigned long, boost::system::error_code>, (2ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, unsigned long, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, unsigned long, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<double, boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, double, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<double, boost::system::error_code>, (2ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, double, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, double, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<bool, boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, bool, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<bool, boost::system::error_code>, (2ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, bool, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, bool, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) |
801 | 0 | template<std::size_t I> constexpr mp11::mp_at_c<mp11::mp_list<T...>, I-1> const& get( mp11::mp_size_t<I> ) const noexcept { return rest_.get( mp11::mp_size_t<I-1>() ); }Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::value const*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::value const*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::value const*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::value const*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::value const*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::value*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::value*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::value*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::value*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::value*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<char const*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, char const*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<char const*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, char const*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, char const*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::object*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::object*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::object*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::object*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::object*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::object const*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::object const*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::object const*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::object const*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::object const*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::array*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::array*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::array*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::array*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::array*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::array const*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::array const*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::array const*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::array const*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::array const*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::string const*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::string const*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::json::string const*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, boost::json::string const*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::json::string const*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<long*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, long*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<long*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, long*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, long*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<unsigned long*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, unsigned long*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<unsigned long*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, unsigned long*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, unsigned long*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<double*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, double*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<double*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, double*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, double*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<bool*, boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, bool*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((2ul)-(1))<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<bool*, boost::system::error_code>, (2ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, boost::variant2::detail::none, bool*, boost::system::error_code>::get<2ul>(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<((1ul)-(1))<std::__1::integral_constant<unsigned long, 1ul>::value, boost::mp11::detail::mp_at_c_impl<boost::mp11::mp_list<boost::system::error_code>, (1ul)-(1)>, void>::type::type const& boost::variant2::detail::variant_storage_impl<std::__1::integral_constant<bool, true>, bool*, boost::system::error_code>::get<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const |
802 | | }; |
803 | | |
804 | | template<class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class... T> union variant_storage_impl<mp11::mp_true, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T...> |
805 | | { |
806 | | T0 t0_; |
807 | | T1 t1_; |
808 | | T2 t2_; |
809 | | T3 t3_; |
810 | | T4 t4_; |
811 | | T5 t5_; |
812 | | T6 t6_; |
813 | | T7 t7_; |
814 | | T8 t8_; |
815 | | T9 t9_; |
816 | | |
817 | | variant_storage<T...> rest_; |
818 | | |
819 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): t0_( std::forward<A>(a)... ) {} |
820 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<1>, A&&... a ): t1_( std::forward<A>(a)... ) {} |
821 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<2>, A&&... a ): t2_( std::forward<A>(a)... ) {} |
822 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<3>, A&&... a ): t3_( std::forward<A>(a)... ) {} |
823 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<4>, A&&... a ): t4_( std::forward<A>(a)... ) {} |
824 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<5>, A&&... a ): t5_( std::forward<A>(a)... ) {} |
825 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<6>, A&&... a ): t6_( std::forward<A>(a)... ) {} |
826 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<7>, A&&... a ): t7_( std::forward<A>(a)... ) {} |
827 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<8>, A&&... a ): t8_( std::forward<A>(a)... ) {} |
828 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<9>, A&&... a ): t9_( std::forward<A>(a)... ) {} |
829 | | |
830 | | template<std::size_t I, class... A> constexpr variant_storage_impl( mp11::mp_size_t<I>, A&&... a ): rest_( mp11::mp_size_t<I-10>(), std::forward<A>(a)... ) {} |
831 | | |
832 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<0>, A&&... a ) { ::new( &t0_ ) T0( std::forward<A>(a)... ); } |
833 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<1>, A&&... a ) { ::new( &t1_ ) T1( std::forward<A>(a)... ); } |
834 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<2>, A&&... a ) { ::new( &t2_ ) T2( std::forward<A>(a)... ); } |
835 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<3>, A&&... a ) { ::new( &t3_ ) T3( std::forward<A>(a)... ); } |
836 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<4>, A&&... a ) { ::new( &t4_ ) T4( std::forward<A>(a)... ); } |
837 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<5>, A&&... a ) { ::new( &t5_ ) T5( std::forward<A>(a)... ); } |
838 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<6>, A&&... a ) { ::new( &t6_ ) T6( std::forward<A>(a)... ); } |
839 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<7>, A&&... a ) { ::new( &t7_ ) T7( std::forward<A>(a)... ); } |
840 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<8>, A&&... a ) { ::new( &t8_ ) T8( std::forward<A>(a)... ); } |
841 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<9>, A&&... a ) { ::new( &t9_ ) T9( std::forward<A>(a)... ); } |
842 | | |
843 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<I>, A&&... a ) |
844 | | { |
845 | | rest_.emplace( mp11::mp_size_t<I-10>(), std::forward<A>(a)... ); |
846 | | } |
847 | | |
848 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_true, mp11::mp_size_t<I>, A&&... a ) |
849 | | { |
850 | | *this = variant_storage_impl( mp11::mp_size_t<I>(), std::forward<A>(a)... ); |
851 | | } |
852 | | |
853 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<I>, A&&... a ) |
854 | | { |
855 | | this->emplace_impl( mp11::mp_all< |
856 | | detail::is_trivially_move_assignable<T0>, |
857 | | detail::is_trivially_move_assignable<T1>, |
858 | | detail::is_trivially_move_assignable<T2>, |
859 | | detail::is_trivially_move_assignable<T3>, |
860 | | detail::is_trivially_move_assignable<T4>, |
861 | | detail::is_trivially_move_assignable<T5>, |
862 | | detail::is_trivially_move_assignable<T6>, |
863 | | detail::is_trivially_move_assignable<T7>, |
864 | | detail::is_trivially_move_assignable<T8>, |
865 | | detail::is_trivially_move_assignable<T9>, |
866 | | detail::is_trivially_move_assignable<T>...>(), mp11::mp_size_t<I>(), std::forward<A>(a)... ); |
867 | | } |
868 | | |
869 | | BOOST_CXX14_CONSTEXPR T0& get( mp11::mp_size_t<0> ) noexcept { return t0_; } |
870 | | constexpr T0 const& get( mp11::mp_size_t<0> ) const noexcept { return t0_; } |
871 | | |
872 | | BOOST_CXX14_CONSTEXPR T1& get( mp11::mp_size_t<1> ) noexcept { return t1_; } |
873 | | constexpr T1 const& get( mp11::mp_size_t<1> ) const noexcept { return t1_; } |
874 | | |
875 | | BOOST_CXX14_CONSTEXPR T2& get( mp11::mp_size_t<2> ) noexcept { return t2_; } |
876 | | constexpr T2 const& get( mp11::mp_size_t<2> ) const noexcept { return t2_; } |
877 | | |
878 | | BOOST_CXX14_CONSTEXPR T3& get( mp11::mp_size_t<3> ) noexcept { return t3_; } |
879 | | constexpr T3 const& get( mp11::mp_size_t<3> ) const noexcept { return t3_; } |
880 | | |
881 | | BOOST_CXX14_CONSTEXPR T4& get( mp11::mp_size_t<4> ) noexcept { return t4_; } |
882 | | constexpr T4 const& get( mp11::mp_size_t<4> ) const noexcept { return t4_; } |
883 | | |
884 | | BOOST_CXX14_CONSTEXPR T5& get( mp11::mp_size_t<5> ) noexcept { return t5_; } |
885 | | constexpr T5 const& get( mp11::mp_size_t<5> ) const noexcept { return t5_; } |
886 | | |
887 | | BOOST_CXX14_CONSTEXPR T6& get( mp11::mp_size_t<6> ) noexcept { return t6_; } |
888 | | constexpr T6 const& get( mp11::mp_size_t<6> ) const noexcept { return t6_; } |
889 | | |
890 | | BOOST_CXX14_CONSTEXPR T7& get( mp11::mp_size_t<7> ) noexcept { return t7_; } |
891 | | constexpr T7 const& get( mp11::mp_size_t<7> ) const noexcept { return t7_; } |
892 | | |
893 | | BOOST_CXX14_CONSTEXPR T8& get( mp11::mp_size_t<8> ) noexcept { return t8_; } |
894 | | constexpr T8 const& get( mp11::mp_size_t<8> ) const noexcept { return t8_; } |
895 | | |
896 | | BOOST_CXX14_CONSTEXPR T9& get( mp11::mp_size_t<9> ) noexcept { return t9_; } |
897 | | constexpr T9 const& get( mp11::mp_size_t<9> ) const noexcept { return t9_; } |
898 | | |
899 | | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<mp11::mp_list<T...>, I-10>& get( mp11::mp_size_t<I> ) noexcept { return rest_.get( mp11::mp_size_t<I-10>() ); } |
900 | | template<std::size_t I> constexpr mp11::mp_at_c<mp11::mp_list<T...>, I-10> const& get( mp11::mp_size_t<I> ) const noexcept { return rest_.get( mp11::mp_size_t<I-10>() ); } |
901 | | }; |
902 | | |
903 | | // resolve_overload_* |
904 | | |
905 | | template<class... T> struct overload; |
906 | | |
907 | | template<> struct overload<> |
908 | | { |
909 | | void operator()() const; |
910 | | }; |
911 | | |
912 | | template<class T1, class... T> struct overload<T1, T...>: overload<T...> |
913 | | { |
914 | | using overload<T...>::operator(); |
915 | | mp11::mp_identity<T1> operator()(T1) const; |
916 | | }; |
917 | | |
918 | | #if BOOST_WORKAROUND( BOOST_MSVC, < 1930 ) |
919 | | |
920 | | template<class U, class... T> using resolve_overload_type_ = decltype( overload<T...>()(std::declval<U>()) ); |
921 | | |
922 | | template<class U, class... T> struct resolve_overload_type_impl: mp11::mp_defer< resolve_overload_type_, U, T... > |
923 | | { |
924 | | }; |
925 | | |
926 | | template<class U, class... T> using resolve_overload_type = typename resolve_overload_type_impl<U, T...>::type::type; |
927 | | |
928 | | #else |
929 | | |
930 | | template<class U, class... T> using resolve_overload_type = typename decltype( overload<T...>()(std::declval<U>()) )::type; |
931 | | |
932 | | #endif |
933 | | |
934 | | template<class U, class... T> using resolve_overload_index = mp11::mp_find<mp11::mp_list<T...>, resolve_overload_type<U, T...>>; |
935 | | |
936 | | // index_type |
937 | | |
938 | | template<std::size_t N> using get_smallest_unsigned_type = mp11::mp_cond< |
939 | | |
940 | | mp11::mp_bool< N <= (std::numeric_limits<unsigned char>::max)() >, unsigned char, |
941 | | mp11::mp_bool< N <= (std::numeric_limits<unsigned short>::max)() >, unsigned short, |
942 | | mp11::mp_true, unsigned |
943 | | |
944 | | >; |
945 | | |
946 | | #if BOOST_WORKAROUND( BOOST_CLANG_VERSION, < 30800 ) |
947 | | |
948 | | template<bool Double, class... T> using get_index_type = unsigned short; |
949 | | |
950 | | #else |
951 | | |
952 | | template<bool Double, class... T> using get_index_type = get_smallest_unsigned_type< (Double + 1) * sizeof...(T) >; |
953 | | |
954 | | #endif |
955 | | |
956 | | // variant_base |
957 | | |
958 | | template<bool is_trivially_destructible, bool is_single_buffered, class... T> struct variant_base_impl; |
959 | | template<class... T> using variant_base = variant_base_impl<mp11::mp_all<std::is_trivially_destructible<T>...>::value, mp11::mp_all<std::is_nothrow_move_constructible<T>...>::value, T...>; |
960 | | |
961 | | struct none {}; |
962 | | |
963 | | // trivially destructible, single buffered |
964 | | template<class... T> struct variant_base_impl<true, true, T...> |
965 | | { |
966 | | using index_type = get_index_type<false, T...>; |
967 | | |
968 | | variant_storage<none, T...> st_; |
969 | | index_type ix_; |
970 | | |
971 | | constexpr variant_base_impl(): st_( mp11::mp_size_t<0>() ), ix_( 0 ) |
972 | | { |
973 | | } |
974 | | |
975 | 0 | template<class I, class... A> constexpr explicit variant_base_impl( I, A&&... a ): st_( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ), ix_( I::value + 1 ) |
976 | 0 | { |
977 | 0 | } Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::value*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::value*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, boost::json::value*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::value*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::value const*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::value const*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, boost::json::value const*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::value const*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, char*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, char*>(std::__1::integral_constant<unsigned long, 0ul>, char*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, char*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, char const*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, char const*>(std::__1::integral_constant<unsigned long, 0ul>, char const*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, char const*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::array*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, boost::json::array*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::array*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::array*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::array const*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, boost::json::array const*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::array const*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::array const*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::object*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, boost::json::object*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::object*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::object*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::object const*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, boost::json::object const*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::object const*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::object const*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::string*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, boost::json::string*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::string*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::string*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::string const*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, boost::json::string const*>(std::__1::integral_constant<unsigned long, 0ul>, boost::json::string const*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::string const*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, long*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, long*>(std::__1::integral_constant<unsigned long, 0ul>, long*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, long*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, long, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, long const&>(std::__1::integral_constant<unsigned long, 0ul>, long const&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, long, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, unsigned long*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, unsigned long*>(std::__1::integral_constant<unsigned long, 0ul>, unsigned long*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, unsigned long*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, unsigned long, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, unsigned long const&>(std::__1::integral_constant<unsigned long, 0ul>, unsigned long const&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, unsigned long, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, double*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, double*>(std::__1::integral_constant<unsigned long, 0ul>, double*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, double*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, double, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, double const&>(std::__1::integral_constant<unsigned long, 0ul>, double const&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, double, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, bool*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, bool*>(std::__1::integral_constant<unsigned long, 0ul>, bool*&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, bool*, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, bool, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, bool const&>(std::__1::integral_constant<unsigned long, 0ul>, bool const&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, bool, boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, decltype(nullptr), boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 0ul>, decltype(nullptr)>(std::__1::integral_constant<unsigned long, 0ul>, decltype(nullptr)&&) Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, decltype(nullptr), boost::system::error_code>::variant_base_impl<std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code>(std::__1::integral_constant<unsigned long, 1ul>, boost::system::error_code&&) |
978 | | |
979 | | // requires: ix_ == 0 |
980 | | template<class I, class... A> BOOST_CXX14_CONSTEXPR void _replace( I, A&&... a ) |
981 | | { |
982 | | ::new( &st_ ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); |
983 | | |
984 | | static_assert( I::value + 1 <= (std::numeric_limits<index_type>::max)(), "" ); |
985 | | ix_ = I::value + 1; |
986 | | } |
987 | | |
988 | | constexpr std::size_t index() const noexcept |
989 | 0 | { |
990 | 0 | return ix_ - 1; |
991 | 0 | } Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::value const*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::value*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, char const*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::object*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::object const*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::array*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::array const*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, boost::json::string const*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, long*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, long, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, unsigned long*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, unsigned long, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, double*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, double, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, bool*, boost::system::error_code>::index() const Unexecuted instantiation: boost::variant2::detail::variant_base_impl<true, true, bool, boost::system::error_code>::index() const |
992 | | |
993 | | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept |
994 | 0 | { |
995 | 0 | std::size_t const J = I+1; |
996 | |
|
997 | 0 | BOOST_ASSERT( ix_ == J ); |
998 | |
|
999 | 0 | return st_.get( mp11::mp_size_t<J>() ); |
1000 | 0 | } Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<long, boost::system::error_code>, 0ul>, void>::type::type& boost::variant2::detail::variant_base_impl<true, true, long, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<long, boost::system::error_code>, 1ul>, void>::type::type& boost::variant2::detail::variant_base_impl<true, true, long, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<unsigned long, boost::system::error_code>, 0ul>, void>::type::type& boost::variant2::detail::variant_base_impl<true, true, unsigned long, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<unsigned long, boost::system::error_code>, 1ul>, void>::type::type& boost::variant2::detail::variant_base_impl<true, true, unsigned long, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<double, boost::system::error_code>, 0ul>, void>::type::type& boost::variant2::detail::variant_base_impl<true, true, double, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<double, boost::system::error_code>, 1ul>, void>::type::type& boost::variant2::detail::variant_base_impl<true, true, double, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<bool, boost::system::error_code>, 0ul>, void>::type::type& boost::variant2::detail::variant_base_impl<true, true, bool, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<bool, boost::system::error_code>, 1ul>, void>::type::type& boost::variant2::detail::variant_base_impl<true, true, bool, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) |
1001 | | |
1002 | | template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept |
1003 | 0 | { |
1004 | | // std::size_t const J = I+1; |
1005 | |
|
1006 | 0 | BOOST_VARIANT2_CX14_ASSERT( ix_ == I+1 ) |
1007 | |
|
1008 | 0 | return st_.get( mp11::mp_size_t<I+1>() ); |
1009 | 0 | } Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::value const*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::value const*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::value const*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::value const*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::value*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::value*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::value*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::value*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<char const*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, char const*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<char const*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, char const*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::object*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::object*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::object*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::object*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::object const*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::object const*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::object const*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::object const*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::array*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::array*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::array*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::array*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::array const*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::array const*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::array const*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::array const*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::string const*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::string const*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<boost::json::string const*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, boost::json::string const*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<long*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, long*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<long*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, long*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<unsigned long*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, unsigned long*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<unsigned long*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, unsigned long*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<double*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, double*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<double*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, double*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(0ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<bool*, boost::system::error_code>, 0ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, bool*, boost::system::error_code>::_get_impl<0ul>(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: boost::mp11::detail::mp_if_c_impl<(1ul)<std::__1::integral_constant<unsigned long, 2ul>::value, boost::mp11::detail::mp_at_c_impl<boost::variant2::variant<bool*, boost::system::error_code>, 1ul>, void>::type::type const& boost::variant2::detail::variant_base_impl<true, true, bool*, boost::system::error_code>::_get_impl<1ul>(std::__1::integral_constant<unsigned long, 1ul>) const |
1010 | | |
1011 | | template<std::size_t J, class U, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_true, A&&... a ) |
1012 | | { |
1013 | | static_assert( std::is_nothrow_constructible<U, A&&...>::value, "Logic error: U must be nothrow constructible from A&&..." ); |
1014 | | |
1015 | | st_.emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); |
1016 | | |
1017 | | static_assert( J <= (std::numeric_limits<index_type>::max)(), "" ); |
1018 | | ix_ = J; |
1019 | | } |
1020 | | |
1021 | | template<std::size_t J, class U, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, A&&... a ) |
1022 | | { |
1023 | | static_assert( std::is_nothrow_move_constructible<U>::value, "Logic error: U must be nothrow move constructible" ); |
1024 | | |
1025 | | U tmp( std::forward<A>(a)... ); |
1026 | | |
1027 | | st_.emplace( mp11::mp_size_t<J>(), std::move(tmp) ); |
1028 | | |
1029 | | static_assert( J <= (std::numeric_limits<index_type>::max)(), "" ); |
1030 | | ix_ = J; |
1031 | | } |
1032 | | |
1033 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a ) |
1034 | | { |
1035 | | std::size_t const J = I+1; |
1036 | | using U = mp11::mp_at_c<variant<T...>, I>; |
1037 | | |
1038 | | this->emplace_impl<J, U>( std::is_nothrow_constructible<U, A&&...>(), std::forward<A>(a)... ); |
1039 | | } |
1040 | | |
1041 | | static constexpr bool uses_double_storage() noexcept |
1042 | | { |
1043 | | return false; |
1044 | | } |
1045 | | }; |
1046 | | |
1047 | | // trivially destructible, double buffered |
1048 | | template<class... T> struct variant_base_impl<true, false, T...> |
1049 | | { |
1050 | | using index_type = get_index_type<true, T...>; |
1051 | | |
1052 | | variant_storage<none, T...> st_[ 2 ]; |
1053 | | index_type ix_; |
1054 | | |
1055 | | constexpr variant_base_impl(): st_{ { mp11::mp_size_t<0>() }, { mp11::mp_size_t<0>() } }, ix_( 0 ) |
1056 | | { |
1057 | | } |
1058 | | |
1059 | | template<class I, class... A> constexpr explicit variant_base_impl( I, A&&... a ): st_{ { mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... }, { mp11::mp_size_t<0>() } }, ix_( ( I::value + 1 ) * 2 ) |
1060 | | { |
1061 | | } |
1062 | | |
1063 | | // requires: ix_ == 0 |
1064 | | template<class I, class... A> BOOST_CXX14_CONSTEXPR void _replace( I, A&&... a ) |
1065 | | { |
1066 | | ::new( &st_[ 0 ] ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); |
1067 | | |
1068 | | static_assert( ( I::value + 1 ) * 2 <= (std::numeric_limits<index_type>::max)(), "" ); |
1069 | | ix_ = ( I::value + 1 ) * 2; |
1070 | | } |
1071 | | |
1072 | | constexpr std::size_t index() const noexcept |
1073 | | { |
1074 | | return ix_ / 2 - 1; |
1075 | | } |
1076 | | |
1077 | | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept |
1078 | | { |
1079 | | BOOST_ASSERT( index() == I ); |
1080 | | |
1081 | | std::size_t const J = I+1; |
1082 | | |
1083 | | constexpr mp11::mp_size_t<J> j{}; |
1084 | | return st_[ ix_ & 1 ].get( j ); |
1085 | | } |
1086 | | |
1087 | | template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept |
1088 | | { |
1089 | | BOOST_VARIANT2_CX14_ASSERT( index() == I ) |
1090 | | |
1091 | | // std::size_t const J = I+1; |
1092 | | // constexpr mp_size_t<J> j{}; |
1093 | | |
1094 | | return st_[ ix_ & 1 ].get( mp11::mp_size_t<I+1>() ); |
1095 | | } |
1096 | | |
1097 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a ) |
1098 | | { |
1099 | | std::size_t const J = I+1; |
1100 | | |
1101 | | unsigned i2 = 1 - ( ix_ & 1 ); |
1102 | | |
1103 | | st_[ i2 ].emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); |
1104 | | |
1105 | | static_assert( J * 2 + 1 <= (std::numeric_limits<index_type>::max)(), "" ); |
1106 | | ix_ = static_cast<index_type>( J * 2 + i2 ); |
1107 | | } |
1108 | | |
1109 | | static constexpr bool uses_double_storage() noexcept |
1110 | | { |
1111 | | return true; |
1112 | | } |
1113 | | }; |
1114 | | |
1115 | | // not trivially destructible, single buffered |
1116 | | template<class... T> struct variant_base_impl<false, true, T...> |
1117 | | { |
1118 | | using index_type = get_index_type<false, T...>; |
1119 | | |
1120 | | variant_storage<none, T...> st_; |
1121 | | index_type ix_; |
1122 | | |
1123 | | constexpr variant_base_impl(): st_( mp11::mp_size_t<0>() ), ix_( 0 ) |
1124 | | { |
1125 | | } |
1126 | | |
1127 | | template<class I, class... A> constexpr explicit variant_base_impl( I, A&&... a ): st_( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ), ix_( I::value + 1 ) |
1128 | | { |
1129 | | } |
1130 | | |
1131 | | // requires: ix_ == 0 |
1132 | | template<class I, class... A> BOOST_CXX14_CONSTEXPR void _replace( I, A&&... a ) |
1133 | | { |
1134 | | ::new( &st_ ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); |
1135 | | |
1136 | | static_assert( I::value + 1 <= (std::numeric_limits<index_type>::max)(), "" ); |
1137 | | ix_ = I::value + 1; |
1138 | | } |
1139 | | |
1140 | | //[&]( auto I ){ |
1141 | | // using U = mp_at_c<mp_list<none, T...>, I>; |
1142 | | // st1_.get( I ).~U(); |
1143 | | //} |
1144 | | |
1145 | | struct _destroy_L1 |
1146 | | { |
1147 | | variant_base_impl * this_; |
1148 | | |
1149 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I ) const noexcept |
1150 | 0 | { |
1151 | 0 | using U = mp11::mp_at<mp11::mp_list<none, T...>, I>; |
1152 | 0 |
|
1153 | 0 | #if defined(BOOST_GCC) && (__GNUC__ >= 12) |
1154 | 0 | // false positive, see https://github.com/boostorg/variant2/issues/55 |
1155 | 0 | # pragma GCC diagnostic push |
1156 | 0 | # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" |
1157 | 0 | #endif |
1158 | 0 |
|
1159 | 0 | this_->st_.get( I() ).~U(); |
1160 | 0 |
|
1161 | 0 | #if defined(BOOST_GCC) && (__GNUC__ >= 12) |
1162 | 0 | # pragma GCC diagnostic pop |
1163 | 0 | #endif |
1164 | 0 | } Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::value, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 0ul> >(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::value, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 1ul> >(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::value, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 2ul> >(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::object, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 0ul> >(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::object, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 1ul> >(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::object, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 2ul> >(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::array, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 0ul> >(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::array, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 1ul> >(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::array, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 2ul> >(std::__1::integral_constant<unsigned long, 2ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::string, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 0ul> >(std::__1::integral_constant<unsigned long, 0ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::string, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 1ul> >(std::__1::integral_constant<unsigned long, 1ul>) const Unexecuted instantiation: void boost::variant2::detail::variant_base_impl<false, true, boost::json::string, boost::system::error_code>::_destroy_L1::operator()<std::__1::integral_constant<unsigned long, 2ul> >(std::__1::integral_constant<unsigned long, 2ul>) const |
1165 | | }; |
1166 | | |
1167 | | BOOST_CXX14_CONSTEXPR void _destroy() noexcept |
1168 | 0 | { |
1169 | 0 | if( ix_ > 0 ) |
1170 | 0 | { |
1171 | 0 | mp11::mp_with_index<1 + sizeof...(T)>( ix_, _destroy_L1{ this } ); |
1172 | 0 | } |
1173 | 0 | } Unexecuted instantiation: boost::variant2::detail::variant_base_impl<false, true, boost::json::value, boost::system::error_code>::_destroy() Unexecuted instantiation: boost::variant2::detail::variant_base_impl<false, true, boost::json::object, boost::system::error_code>::_destroy() Unexecuted instantiation: boost::variant2::detail::variant_base_impl<false, true, boost::json::array, boost::system::error_code>::_destroy() Unexecuted instantiation: boost::variant2::detail::variant_base_impl<false, true, boost::json::string, boost::system::error_code>::_destroy() |
1174 | | |
1175 | | BOOST_VARIANT2_CXX20_CONSTEXPR ~variant_base_impl() noexcept |
1176 | | { |
1177 | | _destroy(); |
1178 | | } |
1179 | | |
1180 | | constexpr std::size_t index() const noexcept |
1181 | | { |
1182 | | return ix_ - 1; |
1183 | | } |
1184 | | |
1185 | | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept |
1186 | | { |
1187 | | std::size_t const J = I+1; |
1188 | | |
1189 | | BOOST_ASSERT( ix_ == J ); |
1190 | | |
1191 | | return st_.get( mp11::mp_size_t<J>() ); |
1192 | | } |
1193 | | |
1194 | | template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept |
1195 | | { |
1196 | | // std::size_t const J = I+1; |
1197 | | |
1198 | | BOOST_VARIANT2_CX14_ASSERT( ix_ == I+1 ) |
1199 | | |
1200 | | return st_.get( mp11::mp_size_t<I+1>() ); |
1201 | | } |
1202 | | |
1203 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a ) |
1204 | | { |
1205 | | std::size_t const J = I+1; |
1206 | | |
1207 | | using U = mp11::mp_at_c<variant<T...>, I>; |
1208 | | |
1209 | | static_assert( std::is_nothrow_move_constructible<U>::value, "Logic error: U must be nothrow move constructible" ); |
1210 | | |
1211 | | #if defined(BOOST_GCC) && (__GNUC__ >= 12) |
1212 | | // false positive, see https://github.com/boostorg/variant2/issues/55 |
1213 | | # pragma GCC diagnostic push |
1214 | | # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" |
1215 | | #endif |
1216 | | |
1217 | | U tmp( std::forward<A>(a)... ); |
1218 | | |
1219 | | #if defined(BOOST_GCC) && (__GNUC__ >= 12) |
1220 | | # pragma GCC diagnostic pop |
1221 | | #endif |
1222 | | |
1223 | | _destroy(); |
1224 | | |
1225 | | st_.emplace( mp11::mp_size_t<J>(), std::move(tmp) ); |
1226 | | |
1227 | | static_assert( J <= (std::numeric_limits<index_type>::max)(), "" ); |
1228 | | ix_ = J; |
1229 | | } |
1230 | | |
1231 | | static constexpr bool uses_double_storage() noexcept |
1232 | | { |
1233 | | return false; |
1234 | | } |
1235 | | }; |
1236 | | |
1237 | | // not trivially destructible, double buffered |
1238 | | template<class... T> struct variant_base_impl<false, false, T...> |
1239 | | { |
1240 | | using index_type = get_index_type<true, T...>; |
1241 | | |
1242 | | #if defined(__GNUC__) && __GNUC__ < 11 && !defined(__clang__) && !defined(__INTEL_COMPILER) |
1243 | | |
1244 | | // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707 :-( |
1245 | | |
1246 | | variant_storage<none, T...> st1_, st2_; |
1247 | | index_type ix_; |
1248 | | |
1249 | | constexpr variant_base_impl(): st1_( mp11::mp_size_t<0>() ), st2_( mp11::mp_size_t<0>() ), ix_( 0 ) |
1250 | | { |
1251 | | } |
1252 | | |
1253 | | template<class I, class... A> constexpr explicit variant_base_impl( I, A&&... a ): st1_( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ), st2_( mp11::mp_size_t<0>() ), ix_( ( I::value + 1 ) * 2 ) |
1254 | | { |
1255 | | } |
1256 | | |
1257 | | BOOST_CXX14_CONSTEXPR variant_storage<none, T...>& storage( unsigned i2 ) noexcept |
1258 | | { |
1259 | | return i2 == 0? st1_: st2_; |
1260 | | } |
1261 | | |
1262 | | constexpr variant_storage<none, T...> const& storage( unsigned i2 ) const noexcept |
1263 | | { |
1264 | | return i2 == 0? st1_: st2_; |
1265 | | } |
1266 | | |
1267 | | #else |
1268 | | |
1269 | | variant_storage<none, T...> st_[ 2 ]; |
1270 | | index_type ix_; |
1271 | | |
1272 | | constexpr variant_base_impl(): st_{ { mp11::mp_size_t<0>() }, { mp11::mp_size_t<0>() } }, ix_( 0 ) |
1273 | | { |
1274 | | } |
1275 | | |
1276 | | template<class I, class... A> constexpr explicit variant_base_impl( I, A&&... a ): st_{ { mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... }, { mp11::mp_size_t<0>() } }, ix_( ( I::value + 1 ) * 2 ) |
1277 | | { |
1278 | | } |
1279 | | |
1280 | | BOOST_CXX14_CONSTEXPR variant_storage<none, T...>& storage( unsigned i2 ) noexcept |
1281 | | { |
1282 | | return st_[ i2 ]; |
1283 | | } |
1284 | | |
1285 | | constexpr variant_storage<none, T...> const& storage( unsigned i2 ) const noexcept |
1286 | | { |
1287 | | return st_[ i2 ]; |
1288 | | } |
1289 | | |
1290 | | #endif |
1291 | | |
1292 | | // requires: ix_ == 0 |
1293 | | template<class I, class... A> BOOST_CXX14_CONSTEXPR void _replace( I, A&&... a ) |
1294 | | { |
1295 | | ::new( &storage( 0 ) ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); |
1296 | | |
1297 | | static_assert( ( I::value + 1 ) * 2 <= (std::numeric_limits<index_type>::max)(), "" ); |
1298 | | ix_ = ( I::value + 1 ) * 2; |
1299 | | } |
1300 | | |
1301 | | //[&]( auto I ){ |
1302 | | // using U = mp_at_c<mp_list<none, T...>, I>; |
1303 | | // st1_.get( I ).~U(); |
1304 | | //} |
1305 | | |
1306 | | struct _destroy_L1 |
1307 | | { |
1308 | | variant_base_impl * this_; |
1309 | | unsigned i2_; |
1310 | | |
1311 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I ) const noexcept |
1312 | | { |
1313 | | using U = mp11::mp_at<mp11::mp_list<none, T...>, I>; |
1314 | | this_->storage( i2_ ).get( I() ).~U(); |
1315 | | } |
1316 | | }; |
1317 | | |
1318 | | BOOST_CXX14_CONSTEXPR void _destroy() noexcept |
1319 | | { |
1320 | | mp11::mp_with_index<1 + sizeof...(T)>( ix_ / 2, _destroy_L1{ this, static_cast<unsigned>( ix_ & 1 ) } ); |
1321 | | } |
1322 | | |
1323 | | BOOST_VARIANT2_CXX20_CONSTEXPR ~variant_base_impl() noexcept |
1324 | | { |
1325 | | _destroy(); |
1326 | | } |
1327 | | |
1328 | | constexpr std::size_t index() const noexcept |
1329 | | { |
1330 | | return ix_ / 2 - 1; |
1331 | | } |
1332 | | |
1333 | | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept |
1334 | | { |
1335 | | BOOST_ASSERT( index() == I ); |
1336 | | |
1337 | | std::size_t const J = I+1; |
1338 | | |
1339 | | constexpr mp11::mp_size_t<J> j{}; |
1340 | | return storage( ix_ & 1 ).get( j ); |
1341 | | } |
1342 | | |
1343 | | template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept |
1344 | | { |
1345 | | BOOST_VARIANT2_CX14_ASSERT( index() == I ) |
1346 | | |
1347 | | // std::size_t const J = I+1; |
1348 | | // constexpr mp_size_t<J> j{}; |
1349 | | |
1350 | | return storage( ix_ & 1 ).get( mp11::mp_size_t<I+1>() ); |
1351 | | } |
1352 | | |
1353 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a ) |
1354 | | { |
1355 | | std::size_t const J = I+1; |
1356 | | |
1357 | | unsigned i2 = 1 - ( ix_ & 1 ); |
1358 | | |
1359 | | storage( i2 ).emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); |
1360 | | _destroy(); |
1361 | | |
1362 | | static_assert( J * 2 + 1 <= (std::numeric_limits<index_type>::max)(), "" ); |
1363 | | ix_ = static_cast<index_type>( J * 2 + i2 ); |
1364 | | } |
1365 | | |
1366 | | static constexpr bool uses_double_storage() noexcept |
1367 | | { |
1368 | | return true; |
1369 | | } |
1370 | | }; |
1371 | | |
1372 | | } // namespace detail |
1373 | | |
1374 | | // in_place_type_t |
1375 | | |
1376 | | template<class T> struct in_place_type_t |
1377 | | { |
1378 | | }; |
1379 | | |
1380 | | #if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) |
1381 | | |
1382 | | template<class T> constexpr in_place_type_t<T> in_place_type{}; |
1383 | | |
1384 | | #endif |
1385 | | |
1386 | | namespace detail |
1387 | | { |
1388 | | |
1389 | | template<class T> struct is_in_place_type: std::false_type {}; |
1390 | | template<class T> struct is_in_place_type<in_place_type_t<T>>: std::true_type {}; |
1391 | | |
1392 | | } // namespace detail |
1393 | | |
1394 | | // in_place_index_t |
1395 | | |
1396 | | template<std::size_t I> struct in_place_index_t |
1397 | | { |
1398 | | }; |
1399 | | |
1400 | | #if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) |
1401 | | |
1402 | | template<std::size_t I> constexpr in_place_index_t<I> in_place_index{}; |
1403 | | |
1404 | | #endif |
1405 | | |
1406 | | namespace detail |
1407 | | { |
1408 | | |
1409 | | template<class T> struct is_in_place_index: std::false_type {}; |
1410 | | template<std::size_t I> struct is_in_place_index<in_place_index_t<I>>: std::true_type {}; |
1411 | | |
1412 | | } // namespace detail |
1413 | | |
1414 | | // is_nothrow_swappable |
1415 | | |
1416 | | namespace detail |
1417 | | { |
1418 | | |
1419 | | namespace det2 |
1420 | | { |
1421 | | |
1422 | | using std::swap; |
1423 | | |
1424 | | template<class T> using is_swappable_impl = decltype(swap(std::declval<T&>(), std::declval<T&>())); |
1425 | | |
1426 | | #if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) |
1427 | | |
1428 | | template<class T> struct is_nothrow_swappable_impl_ |
1429 | | { |
1430 | | static constexpr bool value = noexcept(swap(std::declval<T&>(), std::declval<T&>())); |
1431 | | }; |
1432 | | |
1433 | | template<class T> using is_nothrow_swappable_impl = mp11::mp_bool< is_nothrow_swappable_impl_<T>::value >; |
1434 | | |
1435 | | #else |
1436 | | |
1437 | | template<class T> using is_nothrow_swappable_impl = typename std::enable_if<noexcept(swap(std::declval<T&>(), std::declval<T&>()))>::type; |
1438 | | |
1439 | | #endif |
1440 | | |
1441 | | } // namespace det2 |
1442 | | |
1443 | | template<class T> struct is_swappable: mp11::mp_valid<det2::is_swappable_impl, T> |
1444 | | { |
1445 | | }; |
1446 | | |
1447 | | #if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) |
1448 | | |
1449 | | template<class T> struct is_nothrow_swappable: mp11::mp_eval_if<mp11::mp_not<is_swappable<T>>, mp11::mp_false, det2::is_nothrow_swappable_impl, T> |
1450 | | { |
1451 | | }; |
1452 | | |
1453 | | #else |
1454 | | |
1455 | | template<class T> struct is_nothrow_swappable: mp11::mp_valid<det2::is_nothrow_swappable_impl, T> |
1456 | | { |
1457 | | }; |
1458 | | |
1459 | | #endif |
1460 | | |
1461 | | // variant_cc_base |
1462 | | |
1463 | | template<bool CopyConstructible, bool TriviallyCopyConstructible, class... T> struct variant_cc_base_impl; |
1464 | | |
1465 | | template<class... T> using variant_cc_base = variant_cc_base_impl< |
1466 | | mp11::mp_all<std::is_copy_constructible<T>...>::value, |
1467 | | mp11::mp_all<detail::is_trivially_copy_constructible<T>...>::value, |
1468 | | T...>; |
1469 | | |
1470 | | template<class... T> struct variant_cc_base_impl<true, true, T...>: public variant_base<T...> |
1471 | | { |
1472 | | using variant_base = detail::variant_base<T...>; |
1473 | | using variant_base::variant_base; |
1474 | | |
1475 | | variant_cc_base_impl() = default; |
1476 | | variant_cc_base_impl( variant_cc_base_impl const& ) = default; |
1477 | | variant_cc_base_impl( variant_cc_base_impl && ) = default; |
1478 | | variant_cc_base_impl& operator=( variant_cc_base_impl const& ) = default; |
1479 | | variant_cc_base_impl& operator=( variant_cc_base_impl && ) = default; |
1480 | | }; |
1481 | | |
1482 | | template<bool B, class... T> struct variant_cc_base_impl<false, B, T...>: public variant_base<T...> |
1483 | | { |
1484 | | using variant_base = detail::variant_base<T...>; |
1485 | | using variant_base::variant_base; |
1486 | | |
1487 | | variant_cc_base_impl() = default; |
1488 | | variant_cc_base_impl( variant_cc_base_impl const& ) = delete; |
1489 | | variant_cc_base_impl( variant_cc_base_impl && ) = default; |
1490 | | variant_cc_base_impl& operator=( variant_cc_base_impl const& ) = default; |
1491 | | variant_cc_base_impl& operator=( variant_cc_base_impl && ) = default; |
1492 | | }; |
1493 | | |
1494 | | template<class... T> struct variant_cc_base_impl<true, false, T...>: public variant_base<T...> |
1495 | | { |
1496 | | using variant_base = detail::variant_base<T...>; |
1497 | | using variant_base::variant_base; |
1498 | | |
1499 | | public: |
1500 | | |
1501 | | // constructors |
1502 | | |
1503 | | variant_cc_base_impl() = default; |
1504 | | |
1505 | | // copy constructor |
1506 | | |
1507 | | private: |
1508 | | |
1509 | | struct L1 |
1510 | | { |
1511 | | variant_base * this_; |
1512 | | variant_base const & r; |
1513 | | |
1514 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1515 | | { |
1516 | | this_->_replace( i, r._get_impl( i ) ); |
1517 | | } |
1518 | | }; |
1519 | | |
1520 | | public: |
1521 | | |
1522 | | BOOST_CXX14_CONSTEXPR variant_cc_base_impl( variant_cc_base_impl const& r ) |
1523 | | noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<T>...>::value ) |
1524 | | : variant_base() |
1525 | | { |
1526 | | mp11::mp_with_index<sizeof...(T)>( r.index(), L1{ this, r } ); |
1527 | | } |
1528 | | |
1529 | | // move constructor |
1530 | | |
1531 | | variant_cc_base_impl( variant_cc_base_impl && ) = default; |
1532 | | |
1533 | | // assignment |
1534 | | |
1535 | | variant_cc_base_impl& operator=( variant_cc_base_impl const & ) = default; |
1536 | | variant_cc_base_impl& operator=( variant_cc_base_impl && ) = default; |
1537 | | }; |
1538 | | |
1539 | | // variant_ca_base |
1540 | | |
1541 | | template<bool CopyAssignable, bool TriviallyCopyAssignable, class... T> struct variant_ca_base_impl; |
1542 | | |
1543 | | template<class... T> using variant_ca_base = variant_ca_base_impl< |
1544 | | mp11::mp_all<std::is_copy_constructible<T>..., std::is_copy_assignable<T>...>::value, |
1545 | | mp11::mp_all<std::is_trivially_destructible<T>..., detail::is_trivially_copy_constructible<T>..., detail::is_trivially_copy_assignable<T>...>::value, |
1546 | | T...>; |
1547 | | |
1548 | | template<class... T> struct variant_ca_base_impl<true, true, T...>: public variant_cc_base<T...> |
1549 | | { |
1550 | | using variant_base = detail::variant_cc_base<T...>; |
1551 | | using variant_base::variant_base; |
1552 | | |
1553 | | variant_ca_base_impl() = default; |
1554 | | variant_ca_base_impl( variant_ca_base_impl const& ) = default; |
1555 | | variant_ca_base_impl( variant_ca_base_impl && ) = default; |
1556 | | variant_ca_base_impl& operator=( variant_ca_base_impl const& ) = default; |
1557 | | variant_ca_base_impl& operator=( variant_ca_base_impl && ) = default; |
1558 | | }; |
1559 | | |
1560 | | template<bool B, class... T> struct variant_ca_base_impl<false, B, T...>: public variant_cc_base<T...> |
1561 | | { |
1562 | | using variant_base = detail::variant_cc_base<T...>; |
1563 | | using variant_base::variant_base; |
1564 | | |
1565 | | variant_ca_base_impl() = default; |
1566 | | variant_ca_base_impl( variant_ca_base_impl const& ) = default; |
1567 | | variant_ca_base_impl( variant_ca_base_impl && ) = default; |
1568 | | variant_ca_base_impl& operator=( variant_ca_base_impl const& ) = delete; |
1569 | | variant_ca_base_impl& operator=( variant_ca_base_impl && ) = default; |
1570 | | }; |
1571 | | |
1572 | | template<class... T> struct variant_ca_base_impl<true, false, T...>: public variant_cc_base<T...> |
1573 | | { |
1574 | | using variant_base = detail::variant_cc_base<T...>; |
1575 | | using variant_base::variant_base; |
1576 | | |
1577 | | public: |
1578 | | |
1579 | | // constructors |
1580 | | |
1581 | | variant_ca_base_impl() = default; |
1582 | | variant_ca_base_impl( variant_ca_base_impl const& ) = default; |
1583 | | variant_ca_base_impl( variant_ca_base_impl && ) = default; |
1584 | | |
1585 | | // copy assignment |
1586 | | |
1587 | | private: |
1588 | | |
1589 | | struct L3 |
1590 | | { |
1591 | | variant_base * this_; |
1592 | | variant_base const & r; |
1593 | | |
1594 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1595 | | { |
1596 | | this_->template emplace<I::value>( r._get_impl( i ) ); |
1597 | | } |
1598 | | }; |
1599 | | |
1600 | | public: |
1601 | | |
1602 | | BOOST_CXX14_CONSTEXPR variant_ca_base_impl& operator=( variant_ca_base_impl const & r ) |
1603 | | noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<T>...>::value ) |
1604 | | { |
1605 | | mp11::mp_with_index<sizeof...(T)>( r.index(), L3{ this, r } ); |
1606 | | return *this; |
1607 | | } |
1608 | | |
1609 | | // move assignment |
1610 | | |
1611 | | variant_ca_base_impl& operator=( variant_ca_base_impl && ) = default; |
1612 | | }; |
1613 | | |
1614 | | // variant_mc_base |
1615 | | |
1616 | | template<bool MoveConstructible, bool TriviallyMoveConstructible, class... T> struct variant_mc_base_impl; |
1617 | | |
1618 | | template<class... T> using variant_mc_base = variant_mc_base_impl< |
1619 | | mp11::mp_all<std::is_move_constructible<T>...>::value, |
1620 | | mp11::mp_all<detail::is_trivially_move_constructible<T>...>::value, |
1621 | | T...>; |
1622 | | |
1623 | | template<class... T> struct variant_mc_base_impl<true, true, T...>: public variant_ca_base<T...> |
1624 | | { |
1625 | | using variant_base = detail::variant_ca_base<T...>; |
1626 | | using variant_base::variant_base; |
1627 | | |
1628 | | variant_mc_base_impl() = default; |
1629 | | variant_mc_base_impl( variant_mc_base_impl const& ) = default; |
1630 | | variant_mc_base_impl( variant_mc_base_impl && ) = default; |
1631 | | variant_mc_base_impl& operator=( variant_mc_base_impl const& ) = default; |
1632 | | variant_mc_base_impl& operator=( variant_mc_base_impl && ) = default; |
1633 | | }; |
1634 | | |
1635 | | template<bool B, class... T> struct variant_mc_base_impl<false, B, T...>: public variant_ca_base<T...> |
1636 | | { |
1637 | | using variant_base = detail::variant_ca_base<T...>; |
1638 | | using variant_base::variant_base; |
1639 | | |
1640 | | variant_mc_base_impl() = default; |
1641 | | variant_mc_base_impl( variant_mc_base_impl const& ) = default; |
1642 | | variant_mc_base_impl( variant_mc_base_impl && ) = delete; |
1643 | | variant_mc_base_impl& operator=( variant_mc_base_impl const& ) = default; |
1644 | | variant_mc_base_impl& operator=( variant_mc_base_impl && ) = default; |
1645 | | }; |
1646 | | |
1647 | | template<class... T> struct variant_mc_base_impl<true, false, T...>: public variant_ca_base<T...> |
1648 | | { |
1649 | | using variant_base = detail::variant_ca_base<T...>; |
1650 | | using variant_base::variant_base; |
1651 | | |
1652 | | public: |
1653 | | |
1654 | | // constructors |
1655 | | |
1656 | | variant_mc_base_impl() = default; |
1657 | | variant_mc_base_impl( variant_mc_base_impl const& ) = default; |
1658 | | |
1659 | | // move constructor |
1660 | | |
1661 | | private: |
1662 | | |
1663 | | struct L2 |
1664 | | { |
1665 | | variant_base * this_; |
1666 | | variant_base & r; |
1667 | | |
1668 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1669 | | { |
1670 | | this_->_replace( i, std::move( r._get_impl( i ) ) ); |
1671 | | } |
1672 | | }; |
1673 | | |
1674 | | public: |
1675 | | |
1676 | | BOOST_CXX14_CONSTEXPR variant_mc_base_impl( variant_mc_base_impl && r ) |
1677 | | noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>...>::value ) |
1678 | | { |
1679 | | mp11::mp_with_index<sizeof...(T)>( r.index(), L2{ this, r } ); |
1680 | | } |
1681 | | |
1682 | | // assignment |
1683 | | |
1684 | | variant_mc_base_impl& operator=( variant_mc_base_impl const & ) = default; |
1685 | | variant_mc_base_impl& operator=( variant_mc_base_impl && ) = default; |
1686 | | }; |
1687 | | |
1688 | | // variant_ma_base |
1689 | | |
1690 | | template<bool MoveAssignable, bool TriviallyMoveAssignable, class... T> struct variant_ma_base_impl; |
1691 | | |
1692 | | template<class... T> using variant_ma_base = variant_ma_base_impl< |
1693 | | mp11::mp_all<std::is_move_constructible<T>..., std::is_move_assignable<T>...>::value, |
1694 | | mp11::mp_all<std::is_trivially_destructible<T>..., detail::is_trivially_move_constructible<T>..., detail::is_trivially_move_assignable<T>...>::value, |
1695 | | T...>; |
1696 | | |
1697 | | template<class... T> struct variant_ma_base_impl<true, true, T...>: public variant_mc_base<T...> |
1698 | | { |
1699 | | using variant_base = detail::variant_mc_base<T...>; |
1700 | | using variant_base::variant_base; |
1701 | | |
1702 | | variant_ma_base_impl() = default; |
1703 | | variant_ma_base_impl( variant_ma_base_impl const& ) = default; |
1704 | | variant_ma_base_impl( variant_ma_base_impl && ) = default; |
1705 | | variant_ma_base_impl& operator=( variant_ma_base_impl const& ) = default; |
1706 | | variant_ma_base_impl& operator=( variant_ma_base_impl && ) = default; |
1707 | | }; |
1708 | | |
1709 | | template<bool B, class... T> struct variant_ma_base_impl<false, B, T...>: public variant_mc_base<T...> |
1710 | | { |
1711 | | using variant_base = detail::variant_mc_base<T...>; |
1712 | | using variant_base::variant_base; |
1713 | | |
1714 | | variant_ma_base_impl() = default; |
1715 | | variant_ma_base_impl( variant_ma_base_impl const& ) = default; |
1716 | | variant_ma_base_impl( variant_ma_base_impl && ) = default; |
1717 | | variant_ma_base_impl& operator=( variant_ma_base_impl const& ) = default; |
1718 | | variant_ma_base_impl& operator=( variant_ma_base_impl && ) = delete; |
1719 | | }; |
1720 | | |
1721 | | template<class... T> struct variant_ma_base_impl<true, false, T...>: public variant_mc_base<T...> |
1722 | | { |
1723 | | using variant_base = detail::variant_mc_base<T...>; |
1724 | | using variant_base::variant_base; |
1725 | | |
1726 | | public: |
1727 | | |
1728 | | // constructors |
1729 | | |
1730 | | variant_ma_base_impl() = default; |
1731 | | variant_ma_base_impl( variant_ma_base_impl const& ) = default; |
1732 | | variant_ma_base_impl( variant_ma_base_impl && ) = default; |
1733 | | |
1734 | | // copy assignment |
1735 | | |
1736 | | variant_ma_base_impl& operator=( variant_ma_base_impl const & ) = default; |
1737 | | |
1738 | | // move assignment |
1739 | | |
1740 | | private: |
1741 | | |
1742 | | struct L4 |
1743 | | { |
1744 | | variant_base * this_; |
1745 | | variant_base & r; |
1746 | | |
1747 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1748 | | { |
1749 | | this_->template emplace<I::value>( std::move( r._get_impl( i ) ) ); |
1750 | | } |
1751 | | }; |
1752 | | |
1753 | | public: |
1754 | | |
1755 | | BOOST_CXX14_CONSTEXPR variant_ma_base_impl& operator=( variant_ma_base_impl && r ) |
1756 | | noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>...>::value ) |
1757 | | { |
1758 | | mp11::mp_with_index<sizeof...(T)>( r.index(), L4{ this, r } ); |
1759 | | return *this; |
1760 | | } |
1761 | | }; |
1762 | | |
1763 | | } // namespace detail |
1764 | | |
1765 | | // variant |
1766 | | |
1767 | | template<class... T> class variant: private detail::variant_ma_base<T...> |
1768 | | { |
1769 | | private: |
1770 | | |
1771 | | using variant_base = detail::variant_ma_base<T...>; |
1772 | | |
1773 | | public: |
1774 | | |
1775 | | // constructors |
1776 | | |
1777 | | template<class E1 = void, class E2 = mp11::mp_if<std::is_default_constructible< mp11::mp_first<variant<T...>> >, E1>> |
1778 | | constexpr variant() |
1779 | | noexcept( std::is_nothrow_default_constructible< mp11::mp_first<variant<T...>> >::value ) |
1780 | | : variant_base( mp11::mp_size_t<0>() ) |
1781 | | { |
1782 | | } |
1783 | | |
1784 | | // variant( variant const& ) = default; |
1785 | | // variant( variant && ) = default; |
1786 | | |
1787 | | template<class U, |
1788 | | class Ud = typename std::decay<U>::type, |
1789 | | class E1 = typename std::enable_if< !std::is_same<Ud, variant>::value && !std::is_base_of<variant, Ud>::value && !detail::is_in_place_index<Ud>::value && !detail::is_in_place_type<Ud>::value >::type, |
1790 | | |
1791 | | #if BOOST_WORKAROUND(BOOST_MSVC, < 1960) |
1792 | | |
1793 | | class V = mp11::mp_apply_q< mp11::mp_bind_front<detail::resolve_overload_type, U&&>, variant >, |
1794 | | |
1795 | | #else |
1796 | | |
1797 | | class V = detail::resolve_overload_type<U&&, T...>, |
1798 | | |
1799 | | #endif |
1800 | | |
1801 | | class E2 = typename std::enable_if<std::is_constructible<V, U&&>::value>::type |
1802 | | > |
1803 | | constexpr variant( U&& u ) |
1804 | | noexcept( std::is_nothrow_constructible<V, U&&>::value ) |
1805 | | : variant_base( detail::resolve_overload_index<U&&, T...>(), std::forward<U>(u) ) |
1806 | | { |
1807 | | } |
1808 | | |
1809 | | template<class U, class... A, class I = mp11::mp_find<variant<T...>, U>, class E = typename std::enable_if<std::is_constructible<U, A&&...>::value>::type> |
1810 | | constexpr explicit variant( in_place_type_t<U>, A&&... a ): variant_base( I(), std::forward<A>(a)... ) |
1811 | | { |
1812 | | } |
1813 | | |
1814 | | template<class U, class V, class... A, class I = mp11::mp_find<variant<T...>, U>, class E = typename std::enable_if<std::is_constructible<U, std::initializer_list<V>&, A&&...>::value>::type> |
1815 | | constexpr explicit variant( in_place_type_t<U>, std::initializer_list<V> il, A&&... a ): variant_base( I(), il, std::forward<A>(a)... ) |
1816 | | { |
1817 | | } |
1818 | | |
1819 | | template<std::size_t I, class... A, class E = typename std::enable_if<std::is_constructible<mp11::mp_at_c<variant<T...>, I>, A&&...>::value>::type> |
1820 | 0 | constexpr explicit variant( in_place_index_t<I>, A&&... a ): variant_base( mp11::mp_size_t<I>(), std::forward<A>(a)... ) |
1821 | 0 | { |
1822 | 0 | } Unexecuted instantiation: boost::variant2::variant<boost::json::value*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<boost::json::value*, boost::system::error_code>::variant<0ul, boost::json::value*, void>(boost::variant2::in_place_index_t<0ul>, boost::json::value*&&) Unexecuted instantiation: boost::variant2::variant<boost::json::value const*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<boost::json::value const*, boost::system::error_code>::variant<0ul, boost::json::value const*, void>(boost::variant2::in_place_index_t<0ul>, boost::json::value const*&&) Unexecuted instantiation: boost::variant2::variant<char*, boost::system::error_code>::variant<0ul, char*, void>(boost::variant2::in_place_index_t<0ul>, char*&&) Unexecuted instantiation: boost::variant2::variant<char*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<char const*, boost::system::error_code>::variant<0ul, char const*, void>(boost::variant2::in_place_index_t<0ul>, char const*&&) Unexecuted instantiation: boost::variant2::variant<char const*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<boost::json::array*, boost::system::error_code>::variant<0ul, boost::json::array*, void>(boost::variant2::in_place_index_t<0ul>, boost::json::array*&&) Unexecuted instantiation: boost::variant2::variant<boost::json::array*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<boost::json::array const*, boost::system::error_code>::variant<0ul, boost::json::array const*, void>(boost::variant2::in_place_index_t<0ul>, boost::json::array const*&&) Unexecuted instantiation: boost::variant2::variant<boost::json::array const*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<boost::json::object*, boost::system::error_code>::variant<0ul, boost::json::object*, void>(boost::variant2::in_place_index_t<0ul>, boost::json::object*&&) Unexecuted instantiation: boost::variant2::variant<boost::json::object*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<boost::json::object const*, boost::system::error_code>::variant<0ul, boost::json::object const*, void>(boost::variant2::in_place_index_t<0ul>, boost::json::object const*&&) Unexecuted instantiation: boost::variant2::variant<boost::json::object const*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<boost::json::string*, boost::system::error_code>::variant<0ul, boost::json::string*, void>(boost::variant2::in_place_index_t<0ul>, boost::json::string*&&) Unexecuted instantiation: boost::variant2::variant<boost::json::string*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<boost::json::string const*, boost::system::error_code>::variant<0ul, boost::json::string const*, void>(boost::variant2::in_place_index_t<0ul>, boost::json::string const*&&) Unexecuted instantiation: boost::variant2::variant<boost::json::string const*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<long*, boost::system::error_code>::variant<0ul, long*, void>(boost::variant2::in_place_index_t<0ul>, long*&&) Unexecuted instantiation: boost::variant2::variant<long*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<long, boost::system::error_code>::variant<0ul, long const&, void>(boost::variant2::in_place_index_t<0ul>, long const&) Unexecuted instantiation: boost::variant2::variant<long, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<unsigned long*, boost::system::error_code>::variant<0ul, unsigned long*, void>(boost::variant2::in_place_index_t<0ul>, unsigned long*&&) Unexecuted instantiation: boost::variant2::variant<unsigned long*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<unsigned long, boost::system::error_code>::variant<0ul, unsigned long const&, void>(boost::variant2::in_place_index_t<0ul>, unsigned long const&) Unexecuted instantiation: boost::variant2::variant<unsigned long, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<double*, boost::system::error_code>::variant<0ul, double*, void>(boost::variant2::in_place_index_t<0ul>, double*&&) Unexecuted instantiation: boost::variant2::variant<double*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<double, boost::system::error_code>::variant<0ul, double const&, void>(boost::variant2::in_place_index_t<0ul>, double const&) Unexecuted instantiation: boost::variant2::variant<double, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<bool*, boost::system::error_code>::variant<0ul, bool*, void>(boost::variant2::in_place_index_t<0ul>, bool*&&) Unexecuted instantiation: boost::variant2::variant<bool*, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<bool, boost::system::error_code>::variant<0ul, bool const&, void>(boost::variant2::in_place_index_t<0ul>, bool const&) Unexecuted instantiation: boost::variant2::variant<bool, boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) Unexecuted instantiation: boost::variant2::variant<decltype(nullptr), boost::system::error_code>::variant<0ul, decltype(nullptr), void>(boost::variant2::in_place_index_t<0ul>, decltype(nullptr)&&) Unexecuted instantiation: boost::variant2::variant<decltype(nullptr), boost::system::error_code>::variant<1ul, boost::system::error_code, void>(boost::variant2::in_place_index_t<1ul>, boost::system::error_code&&) |
1823 | | |
1824 | | template<std::size_t I, class V, class... A, class E = typename std::enable_if<std::is_constructible<mp11::mp_at_c<variant<T...>, I>, std::initializer_list<V>&, A&&...>::value>::type> |
1825 | | constexpr explicit variant( in_place_index_t<I>, std::initializer_list<V> il, A&&... a ): variant_base( mp11::mp_size_t<I>(), il, std::forward<A>(a)... ) |
1826 | | { |
1827 | | } |
1828 | | |
1829 | | // assignment |
1830 | | |
1831 | | // variant& operator=( variant const& ) = default; |
1832 | | // variant& operator=( variant && ) = default; |
1833 | | |
1834 | | template<class U, |
1835 | | class E1 = typename std::enable_if<!std::is_same<typename std::decay<U>::type, variant>::value>::type, |
1836 | | class V = detail::resolve_overload_type<U, T...>, |
1837 | | class E2 = typename std::enable_if<std::is_assignable<V&, U&&>::value && std::is_constructible<V, U&&>::value>::type |
1838 | | > |
1839 | | BOOST_CXX14_CONSTEXPR variant& operator=( U&& u ) |
1840 | | noexcept( std::is_nothrow_constructible<V, U&&>::value ) |
1841 | | { |
1842 | | std::size_t const I = detail::resolve_overload_index<U, T...>::value; |
1843 | | this->template emplace<I>( std::forward<U>(u) ); |
1844 | | return *this; |
1845 | | } |
1846 | | |
1847 | | // modifiers |
1848 | | |
1849 | | template<class U, class... A, |
1850 | | class E = typename std::enable_if< mp11::mp_count<variant<T...>, U>::value == 1 && std::is_constructible<U, A&&...>::value >::type> |
1851 | | BOOST_CXX14_CONSTEXPR U& emplace( A&&... a ) |
1852 | | { |
1853 | | using I = mp11::mp_find<variant<T...>, U>; |
1854 | | variant_base::template emplace<I::value>( std::forward<A>(a)... ); |
1855 | | return _get_impl( I() ); |
1856 | | } |
1857 | | |
1858 | | template<class U, class V, class... A, |
1859 | | class E = typename std::enable_if< mp11::mp_count<variant<T...>, U>::value == 1 && std::is_constructible<U, std::initializer_list<V>&, A&&...>::value >::type> |
1860 | | BOOST_CXX14_CONSTEXPR U& emplace( std::initializer_list<V> il, A&&... a ) |
1861 | | { |
1862 | | using I = mp11::mp_find<variant<T...>, U>; |
1863 | | variant_base::template emplace<I::value>( il, std::forward<A>(a)... ); |
1864 | | return _get_impl( I() ); |
1865 | | } |
1866 | | |
1867 | | template<std::size_t I, class... A, class E = typename std::enable_if<std::is_constructible<mp11::mp_at_c<variant<T...>, I>, A&&...>::value>::type> |
1868 | | BOOST_CXX14_CONSTEXPR variant_alternative_t<I, variant<T...>>& emplace( A&&... a ) |
1869 | | { |
1870 | | variant_base::template emplace<I>( std::forward<A>(a)... ); |
1871 | | return _get_impl( mp11::mp_size_t<I>() ); |
1872 | | } |
1873 | | |
1874 | | template<std::size_t I, class V, class... A, class E = typename std::enable_if<std::is_constructible<mp11::mp_at_c<variant<T...>, I>, std::initializer_list<V>&, A&&...>::value>::type> |
1875 | | BOOST_CXX14_CONSTEXPR variant_alternative_t<I, variant<T...>>& emplace( std::initializer_list<V> il, A&&... a ) |
1876 | | { |
1877 | | variant_base::template emplace<I>( il, std::forward<A>(a)... ); |
1878 | | return _get_impl( mp11::mp_size_t<I>() ); |
1879 | | } |
1880 | | |
1881 | | // value status |
1882 | | |
1883 | | constexpr bool valueless_by_exception() const noexcept |
1884 | | { |
1885 | | return false; |
1886 | | } |
1887 | | |
1888 | | using variant_base::index; |
1889 | | |
1890 | | using variant_base::uses_double_storage; |
1891 | | |
1892 | | // swap |
1893 | | |
1894 | | private: |
1895 | | |
1896 | | struct L5 |
1897 | | { |
1898 | | variant * this_; |
1899 | | variant & r; |
1900 | | |
1901 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1902 | | { |
1903 | | using std::swap; |
1904 | | swap( this_->_get_impl( i ), r._get_impl( i ) ); |
1905 | | } |
1906 | | }; |
1907 | | |
1908 | | public: |
1909 | | |
1910 | | BOOST_CXX14_CONSTEXPR void swap( variant& r ) noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>..., detail::is_nothrow_swappable<T>...>::value ) |
1911 | | { |
1912 | | if( index() == r.index() ) |
1913 | | { |
1914 | | mp11::mp_with_index<sizeof...(T)>( index(), L5{ this, r } ); |
1915 | | } |
1916 | | else |
1917 | | { |
1918 | | variant tmp( std::move(*this) ); |
1919 | | *this = std::move( r ); |
1920 | | r = std::move( tmp ); |
1921 | | } |
1922 | | } |
1923 | | |
1924 | | // private accessors |
1925 | | |
1926 | | using variant_base::_get_impl; |
1927 | | |
1928 | | // converting constructors (extension) |
1929 | | |
1930 | | private: |
1931 | | |
1932 | | template<class... U> struct L6 |
1933 | | { |
1934 | | variant_base * this_; |
1935 | | variant<U...> const & r; |
1936 | | |
1937 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1938 | | { |
1939 | | using J = mp11::mp_find<mp11::mp_list<T...>, mp11::mp_at<mp11::mp_list<U...>, I>>; |
1940 | | this_->_replace( J{}, r._get_impl( i ) ); |
1941 | | } |
1942 | | }; |
1943 | | |
1944 | | public: |
1945 | | |
1946 | | template<class... U, |
1947 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
1948 | | BOOST_CXX14_CONSTEXPR variant( variant<U...> const& r ) |
1949 | | noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<U>...>::value ) |
1950 | | { |
1951 | | mp11::mp_with_index<sizeof...(U)>( r.index(), L6<U...>{ this, r } ); |
1952 | | } |
1953 | | |
1954 | | private: |
1955 | | |
1956 | | template<class... U> struct L7 |
1957 | | { |
1958 | | variant_base * this_; |
1959 | | variant<U...> & r; |
1960 | | |
1961 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1962 | | { |
1963 | | using J = mp11::mp_find<mp11::mp_list<T...>, mp11::mp_at<mp11::mp_list<U...>, I>>; |
1964 | | this_->_replace( J{}, std::move( r._get_impl( i ) ) ); |
1965 | | } |
1966 | | }; |
1967 | | |
1968 | | public: |
1969 | | |
1970 | | template<class... U, |
1971 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_move_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
1972 | | BOOST_CXX14_CONSTEXPR variant( variant<U...> && r ) |
1973 | | noexcept( mp11::mp_all<std::is_nothrow_move_constructible<U>...>::value ) |
1974 | | { |
1975 | | mp11::mp_with_index<sizeof...(U)>( r.index(), L7<U...>{ this, r } ); |
1976 | | } |
1977 | | |
1978 | | // subset (extension) |
1979 | | |
1980 | | private: |
1981 | | |
1982 | | template<class... U, class V, std::size_t J, class E = typename std::enable_if<J != sizeof...(U)>::type> static constexpr variant<U...> _subset_impl( mp11::mp_size_t<J>, V && v ) |
1983 | | { |
1984 | | return variant<U...>( in_place_index_t<J>(), std::forward<V>(v) ); |
1985 | | } |
1986 | | |
1987 | | template<class... U, class V> static variant<U...> _subset_impl( mp11::mp_size_t<sizeof...(U)>, V && /*v*/ ) |
1988 | | { |
1989 | | detail::throw_bad_variant_access(); |
1990 | | } |
1991 | | |
1992 | | private: |
1993 | | |
1994 | | template<class... U> struct L8 |
1995 | | { |
1996 | | variant * this_; |
1997 | | |
1998 | | template<class I> BOOST_CXX14_CONSTEXPR variant<U...> operator()( I i ) const |
1999 | | { |
2000 | | using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; |
2001 | | return this_->_subset_impl<U...>( J{}, this_->_get_impl( i ) ); |
2002 | | } |
2003 | | }; |
2004 | | |
2005 | | public: |
2006 | | |
2007 | | template<class... U, |
2008 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
2009 | | BOOST_CXX14_CONSTEXPR variant<U...> subset() & |
2010 | | { |
2011 | | return mp11::mp_with_index<sizeof...(T)>( index(), L8<U...>{ this } ); |
2012 | | } |
2013 | | |
2014 | | private: |
2015 | | |
2016 | | template<class... U> struct L9 |
2017 | | { |
2018 | | variant const * this_; |
2019 | | |
2020 | | template<class I> BOOST_CXX14_CONSTEXPR variant<U...> operator()( I i ) const |
2021 | | { |
2022 | | using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; |
2023 | | return this_->_subset_impl<U...>( J{}, this_->_get_impl( i ) ); |
2024 | | } |
2025 | | }; |
2026 | | |
2027 | | public: |
2028 | | |
2029 | | template<class... U, |
2030 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
2031 | | constexpr variant<U...> subset() const& |
2032 | | { |
2033 | | return mp11::mp_with_index<sizeof...(T)>( index(), L9<U...>{ this } ); |
2034 | | } |
2035 | | |
2036 | | private: |
2037 | | |
2038 | | template<class... U> struct L10 |
2039 | | { |
2040 | | variant * this_; |
2041 | | |
2042 | | template<class I> BOOST_CXX14_CONSTEXPR variant<U...> operator()( I i ) const |
2043 | | { |
2044 | | using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; |
2045 | | return this_->_subset_impl<U...>( J{}, std::move( this_->_get_impl( i ) ) ); |
2046 | | } |
2047 | | }; |
2048 | | |
2049 | | public: |
2050 | | |
2051 | | template<class... U, |
2052 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
2053 | | BOOST_CXX14_CONSTEXPR variant<U...> subset() && |
2054 | | { |
2055 | | return mp11::mp_with_index<sizeof...(T)>( index(), L10<U...>{ this } ); |
2056 | | } |
2057 | | |
2058 | | #if !BOOST_WORKAROUND(BOOST_GCC, < 40900) |
2059 | | |
2060 | | // g++ 4.8 doesn't handle const&& particularly well |
2061 | | |
2062 | | private: |
2063 | | |
2064 | | template<class... U> struct L11 |
2065 | | { |
2066 | | variant const * this_; |
2067 | | |
2068 | | template<class I> BOOST_CXX14_CONSTEXPR variant<U...> operator()( I i ) const |
2069 | | { |
2070 | | using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; |
2071 | | return this_->_subset_impl<U...>( J{}, std::move( this_->_get_impl( i ) ) ); |
2072 | | } |
2073 | | }; |
2074 | | |
2075 | | public: |
2076 | | |
2077 | | template<class... U, |
2078 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
2079 | | constexpr variant<U...> subset() const&& |
2080 | | { |
2081 | | return mp11::mp_with_index<sizeof...(T)>( index(), L11<U...>{ this } ); |
2082 | | } |
2083 | | |
2084 | | #endif |
2085 | | }; |
2086 | | |
2087 | | // relational operators |
2088 | | |
2089 | | namespace detail |
2090 | | { |
2091 | | |
2092 | | template<class... T> struct eq_L |
2093 | | { |
2094 | | variant<T...> const & v; |
2095 | | variant<T...> const & w; |
2096 | | |
2097 | | template<class I> constexpr bool operator()( I i ) const |
2098 | | { |
2099 | | return v._get_impl( i ) == w._get_impl( i ); |
2100 | | } |
2101 | | }; |
2102 | | |
2103 | | } // namespace detail |
2104 | | |
2105 | | template<class... T> constexpr bool operator==( variant<T...> const & v, variant<T...> const & w ) |
2106 | | { |
2107 | | return v.index() == w.index() && mp11::mp_with_index<sizeof...(T)>( v.index(), detail::eq_L<T...>{ v, w } ); |
2108 | | } |
2109 | | |
2110 | | namespace detail |
2111 | | { |
2112 | | |
2113 | | template<class... T> struct ne_L |
2114 | | { |
2115 | | variant<T...> const & v; |
2116 | | variant<T...> const & w; |
2117 | | |
2118 | | template<class I> constexpr bool operator()( I i ) const |
2119 | | { |
2120 | | return v._get_impl( i ) != w._get_impl( i ); |
2121 | | } |
2122 | | }; |
2123 | | |
2124 | | } // namespace detail |
2125 | | |
2126 | | template<class... T> constexpr bool operator!=( variant<T...> const & v, variant<T...> const & w ) |
2127 | | { |
2128 | | return v.index() != w.index() || mp11::mp_with_index<sizeof...(T)>( v.index(), detail::ne_L<T...>{ v, w } ); |
2129 | | } |
2130 | | |
2131 | | namespace detail |
2132 | | { |
2133 | | |
2134 | | template<class... T> struct lt_L |
2135 | | { |
2136 | | variant<T...> const & v; |
2137 | | variant<T...> const & w; |
2138 | | |
2139 | | template<class I> constexpr bool operator()( I i ) const |
2140 | | { |
2141 | | return v._get_impl( i ) < w._get_impl( i ); |
2142 | | } |
2143 | | }; |
2144 | | |
2145 | | } // namespace detail |
2146 | | |
2147 | | template<class... T> constexpr bool operator<( variant<T...> const & v, variant<T...> const & w ) |
2148 | | { |
2149 | | return v.index() < w.index() || ( v.index() == w.index() && mp11::mp_with_index<sizeof...(T)>( v.index(), detail::lt_L<T...>{ v, w } ) ); |
2150 | | } |
2151 | | |
2152 | | template<class... T> constexpr bool operator>( variant<T...> const & v, variant<T...> const & w ) |
2153 | | { |
2154 | | return w < v; |
2155 | | } |
2156 | | |
2157 | | namespace detail |
2158 | | { |
2159 | | |
2160 | | template<class... T> struct le_L |
2161 | | { |
2162 | | variant<T...> const & v; |
2163 | | variant<T...> const & w; |
2164 | | |
2165 | | template<class I> constexpr bool operator()( I i ) const |
2166 | | { |
2167 | | return v._get_impl( i ) <= w._get_impl( i ); |
2168 | | } |
2169 | | }; |
2170 | | |
2171 | | } // namespace detail |
2172 | | |
2173 | | template<class... T> constexpr bool operator<=( variant<T...> const & v, variant<T...> const & w ) |
2174 | | { |
2175 | | return v.index() < w.index() || ( v.index() == w.index() && mp11::mp_with_index<sizeof...(T)>( v.index(), detail::le_L<T...>{ v, w } ) ); |
2176 | | } |
2177 | | |
2178 | | template<class... T> constexpr bool operator>=( variant<T...> const & v, variant<T...> const & w ) |
2179 | | { |
2180 | | return w <= v; |
2181 | | } |
2182 | | |
2183 | | // visitation |
2184 | | namespace detail |
2185 | | { |
2186 | | |
2187 | | template<class T> using remove_cv_ref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type; |
2188 | | |
2189 | | template<class... T> variant<T...> const & extract_variant_base_( variant<T...> const & ); |
2190 | | |
2191 | | #if BOOST_WORKAROUND( BOOST_MSVC, < 1930 ) |
2192 | | |
2193 | | template<class V> struct extract_vbase_impl |
2194 | | { |
2195 | | using type = decltype( extract_variant_base_( std::declval<V>() ) ); |
2196 | | }; |
2197 | | |
2198 | | template<class V> using extract_variant_base = remove_cv_ref_t< typename extract_vbase_impl<V>::type >; |
2199 | | |
2200 | | #else |
2201 | | |
2202 | | template<class V> using extract_variant_base = remove_cv_ref_t< decltype( extract_variant_base_( std::declval<V>() ) ) >; |
2203 | | |
2204 | | #endif |
2205 | | |
2206 | | template<class V> using variant_base_size = variant_size< extract_variant_base<V> >; |
2207 | | |
2208 | | template<class T, class U> struct copy_cv_ref |
2209 | | { |
2210 | | using type = T; |
2211 | | }; |
2212 | | |
2213 | | template<class T, class U> struct copy_cv_ref<T, U const> |
2214 | | { |
2215 | | using type = T const; |
2216 | | }; |
2217 | | |
2218 | | template<class T, class U> struct copy_cv_ref<T, U volatile> |
2219 | | { |
2220 | | using type = T volatile; |
2221 | | }; |
2222 | | |
2223 | | template<class T, class U> struct copy_cv_ref<T, U const volatile> |
2224 | | { |
2225 | | using type = T const volatile; |
2226 | | }; |
2227 | | |
2228 | | template<class T, class U> struct copy_cv_ref<T, U&> |
2229 | | { |
2230 | | using type = typename copy_cv_ref<T, U>::type&; |
2231 | | }; |
2232 | | |
2233 | | template<class T, class U> struct copy_cv_ref<T, U&&> |
2234 | | { |
2235 | | using type = typename copy_cv_ref<T, U>::type&&; |
2236 | | }; |
2237 | | |
2238 | | template<class T, class U> using copy_cv_ref_t = typename copy_cv_ref<T, U>::type; |
2239 | | |
2240 | | template<class F> struct Qret |
2241 | | { |
2242 | | template<class... T> using fn = decltype( std::declval<F>()( std::declval<T>()... ) ); |
2243 | | }; |
2244 | | |
2245 | | template<class L> using front_if_same = mp11::mp_if<mp11::mp_apply<mp11::mp_same, L>, mp11::mp_front<L>>; |
2246 | | |
2247 | | template<class V> using apply_cv_ref = mp11::mp_product<copy_cv_ref_t, extract_variant_base<V>, mp11::mp_list<V>>; |
2248 | | |
2249 | | struct deduced {}; |
2250 | | |
2251 | | #if !BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) |
2252 | | |
2253 | | template<class R, class F, class... V> using Vret = mp11::mp_eval_if_not< std::is_same<R, deduced>, R, front_if_same, mp11::mp_product_q<Qret<F>, apply_cv_ref<V>...> >; |
2254 | | |
2255 | | #else |
2256 | | |
2257 | | template<class R, class F, class... V> struct Vret_impl |
2258 | | { |
2259 | | using type = mp11::mp_eval_if_not< std::is_same<R, deduced>, R, front_if_same, mp11::mp_product_q<Qret<F>, apply_cv_ref<V>...> >; |
2260 | | }; |
2261 | | |
2262 | | template<class R, class F, class... V> using Vret = typename Vret_impl<R, F, V...>::type; |
2263 | | |
2264 | | #endif |
2265 | | |
2266 | | } // namespace detail |
2267 | | |
2268 | | template<class R = detail::deduced, class F> constexpr auto visit( F&& f ) -> detail::Vret<R, F> |
2269 | | { |
2270 | | return std::forward<F>(f)(); |
2271 | | } |
2272 | | |
2273 | | namespace detail |
2274 | | { |
2275 | | |
2276 | | template<class R, class F, class V1> struct visit_L1 |
2277 | | { |
2278 | | F&& f; |
2279 | | V1&& v1; |
2280 | | |
2281 | | template<class I> constexpr auto operator()( I ) const -> Vret<R, F, V1> |
2282 | | { |
2283 | | return std::forward<F>(f)( unsafe_get<I::value>( std::forward<V1>(v1) ) ); |
2284 | | } |
2285 | | }; |
2286 | | |
2287 | | } // namespace detail |
2288 | | |
2289 | | template<class R = detail::deduced, class F, class V1> constexpr auto visit( F&& f, V1&& v1 ) -> detail::Vret<R, F, V1> |
2290 | | { |
2291 | | return mp11::mp_with_index<detail::variant_base_size<V1>>( v1.index(), detail::visit_L1<R, F, V1>{ std::forward<F>(f), std::forward<V1>(v1) } ); |
2292 | | } |
2293 | | |
2294 | | #if defined(BOOST_NO_CXX14_GENERIC_LAMBDAS) || BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) |
2295 | | |
2296 | | namespace detail |
2297 | | { |
2298 | | |
2299 | | template<class F, class A> struct bind_front_ |
2300 | | { |
2301 | | F&& f; |
2302 | | A&& a; |
2303 | | |
2304 | | template<class... T> auto operator()( T&&... t ) -> decltype( std::forward<F>(f)( std::forward<A>(a), std::forward<T>(t)... ) ) |
2305 | | { |
2306 | | return std::forward<F>(f)( std::forward<A>(a), std::forward<T>(t)... ); |
2307 | | } |
2308 | | }; |
2309 | | |
2310 | | template<class F, class A> bind_front_<F, A> bind_front( F&& f, A&& a ) |
2311 | | { |
2312 | | return bind_front_<F, A>{ std::forward<F>(f), std::forward<A>(a) }; |
2313 | | } |
2314 | | |
2315 | | template<class R, class F, class V1, class V2> struct visit_L2 |
2316 | | { |
2317 | | F&& f; |
2318 | | |
2319 | | V1&& v1; |
2320 | | V2&& v2; |
2321 | | |
2322 | | template<class I> auto operator()( I ) const -> Vret<R, F, V1, V2> |
2323 | | { |
2324 | | auto f2 = bind_front( std::forward<F>(f), unsafe_get<I::value>( std::forward<V1>(v1) ) ); |
2325 | | return visit<R>( f2, std::forward<V2>(v2) ); |
2326 | | } |
2327 | | }; |
2328 | | |
2329 | | } // namespace detail |
2330 | | |
2331 | | template<class R = detail::deduced, class F, class V1, class V2> constexpr auto visit( F&& f, V1&& v1, V2&& v2 ) -> detail::Vret<R, F, V1, V2> |
2332 | | { |
2333 | | return mp11::mp_with_index<detail::variant_base_size<V1>>( v1.index(), detail::visit_L2<R, F, V1, V2>{ std::forward<F>(f), std::forward<V1>(v1), std::forward<V2>(v2) } ); |
2334 | | } |
2335 | | |
2336 | | namespace detail |
2337 | | { |
2338 | | |
2339 | | template<class R, class F, class V1, class V2, class V3> struct visit_L3 |
2340 | | { |
2341 | | F&& f; |
2342 | | |
2343 | | V1&& v1; |
2344 | | V2&& v2; |
2345 | | V3&& v3; |
2346 | | |
2347 | | template<class I> auto operator()( I ) const -> Vret<R, F, V1, V2, V3> |
2348 | | { |
2349 | | auto f2 = bind_front( std::forward<F>(f), unsafe_get<I::value>( std::forward<V1>(v1) ) ); |
2350 | | return visit<R>( f2, std::forward<V2>(v2), std::forward<V3>(v3) ); |
2351 | | } |
2352 | | }; |
2353 | | |
2354 | | } // namespace detail |
2355 | | |
2356 | | template<class R = detail::deduced, class F, class V1, class V2, class V3> constexpr auto visit( F&& f, V1&& v1, V2&& v2, V3&& v3 ) -> detail::Vret<R, F, V1, V2, V3> |
2357 | | { |
2358 | | return mp11::mp_with_index<detail::variant_base_size<V1>>( v1.index(), detail::visit_L3<R, F, V1, V2, V3>{ std::forward<F>(f), std::forward<V1>(v1), std::forward<V2>(v2), std::forward<V3>(v3) } ); |
2359 | | } |
2360 | | |
2361 | | namespace detail |
2362 | | { |
2363 | | |
2364 | | template<class R, class F, class V1, class V2, class V3, class V4> struct visit_L4 |
2365 | | { |
2366 | | F&& f; |
2367 | | |
2368 | | V1&& v1; |
2369 | | V2&& v2; |
2370 | | V3&& v3; |
2371 | | V4&& v4; |
2372 | | |
2373 | | template<class I> auto operator()( I ) const -> Vret<R, F, V1, V2, V3, V4> |
2374 | | { |
2375 | | auto f2 = bind_front( std::forward<F>(f), unsafe_get<I::value>( std::forward<V1>(v1) ) ); |
2376 | | return visit<R>( f2, std::forward<V2>(v2), std::forward<V3>(v3), std::forward<V4>(v4) ); |
2377 | | } |
2378 | | }; |
2379 | | |
2380 | | } // namespace detail |
2381 | | |
2382 | | template<class R = detail::deduced, class F, class V1, class V2, class V3, class V4> constexpr auto visit( F&& f, V1&& v1, V2&& v2, V3&& v3, V4&& v4 ) -> detail::Vret<R, F, V1, V2, V3, V4> |
2383 | | { |
2384 | | return mp11::mp_with_index<detail::variant_base_size<V1>>( v1.index(), detail::visit_L4<R, F, V1, V2, V3, V4>{ std::forward<F>(f), std::forward<V1>(v1), std::forward<V2>(v2), std::forward<V3>(v3), std::forward<V4>(v4) } ); |
2385 | | } |
2386 | | |
2387 | | #else |
2388 | | |
2389 | | template<class R = detail::deduced, class F, class V1, class V2, class... V> constexpr auto visit( F&& f, V1&& v1, V2&& v2, V&&... v ) -> detail::Vret<R, F, V1, V2, V...> |
2390 | | { |
2391 | | return mp11::mp_with_index<detail::variant_base_size<V1>>( v1.index(), [&]( auto I ){ |
2392 | | |
2393 | | auto f2 = [&]( auto&&... a ){ return std::forward<F>(f)( unsafe_get<I.value>( std::forward<V1>(v1) ), std::forward<decltype(a)>(a)... ); }; |
2394 | | return visit<R>( f2, std::forward<V2>(v2), std::forward<V>(v)... ); |
2395 | | |
2396 | | }); |
2397 | | } |
2398 | | |
2399 | | #endif |
2400 | | |
2401 | | // specialized algorithms |
2402 | | template<class... T, |
2403 | | class E = typename std::enable_if<mp11::mp_all<std::is_move_constructible<T>..., detail::is_swappable<T>...>::value>::type> |
2404 | | BOOST_CXX14_CONSTEXPR void swap( variant<T...> & v, variant<T...> & w ) |
2405 | | noexcept( noexcept(v.swap(w)) ) |
2406 | | { |
2407 | | v.swap( w ); |
2408 | | } |
2409 | | |
2410 | | // visit_by_index |
2411 | | |
2412 | | namespace detail |
2413 | | { |
2414 | | |
2415 | | template<class R, class V, class... F> using Vret2 = mp11::mp_eval_if_not< std::is_same<R, deduced>, R, front_if_same, mp11::mp_transform<mp11::mp_invoke_q, mp11::mp_list<Qret<F>...>, apply_cv_ref<V>> >; |
2416 | | |
2417 | | template<class R, class V, class... F> struct visit_by_index_L |
2418 | | { |
2419 | | V&& v; |
2420 | | std::tuple<F&&...> tp; |
2421 | | |
2422 | | template<class I> constexpr detail::Vret2<R, V, F...> operator()( I ) const |
2423 | | { |
2424 | | return std::get<I::value>( std::move(tp) )( unsafe_get<I::value>( std::forward<V>(v) ) ); |
2425 | | } |
2426 | | }; |
2427 | | |
2428 | | } // namespace detail |
2429 | | |
2430 | | template<class R = detail::deduced, class V, class... F> constexpr auto visit_by_index( V&& v, F&&... f ) -> detail::Vret2<R, V, F...> |
2431 | | { |
2432 | | static_assert( variant_size<V>::value == sizeof...(F), "Incorrect number of function objects" ); |
2433 | | |
2434 | | return mp11::mp_with_index<variant_size<V>::value>( v.index(), |
2435 | | detail::visit_by_index_L<R, V, F...>{ std::forward<V>(v), std::tuple<F&&...>( std::forward<F>(f)... ) } ); |
2436 | | } |
2437 | | |
2438 | | // output streaming |
2439 | | |
2440 | | namespace detail |
2441 | | { |
2442 | | |
2443 | | template<class Ch, class Tr, class... T> struct ostream_insert_L |
2444 | | { |
2445 | | std::basic_ostream<Ch, Tr>& os; |
2446 | | variant<T...> const& v; |
2447 | | |
2448 | | template<class I> std::basic_ostream<Ch, Tr>& operator()( I ) const |
2449 | | { |
2450 | | return os << unsafe_get<I::value>( v ); |
2451 | | } |
2452 | | }; |
2453 | | |
2454 | | template<class Os, class T, class E = void> struct is_output_streamable: std::false_type |
2455 | | { |
2456 | | }; |
2457 | | |
2458 | | template<class Os, class T> struct is_output_streamable<Os, T, decltype( std::declval<Os&>() << std::declval<T const&>(), (void)0 )>: std::true_type |
2459 | | { |
2460 | | }; |
2461 | | |
2462 | | } // namespace detail |
2463 | | |
2464 | | template<class Ch, class Tr> |
2465 | | std::basic_ostream<Ch, Tr>& operator<<( std::basic_ostream<Ch, Tr>& os, monostate const& ) |
2466 | | { |
2467 | | os << "monostate"; |
2468 | | return os; |
2469 | | } |
2470 | | |
2471 | | template<class Ch, class Tr, class T1, class... T, |
2472 | | class E = typename std::enable_if< mp11::mp_all< detail::is_output_streamable<std::basic_ostream<Ch, Tr>, T>... >::value >::type > |
2473 | | std::basic_ostream<Ch, Tr>& operator<<( std::basic_ostream<Ch, Tr>& os, variant<T1, T...> const& v ) |
2474 | | { |
2475 | | return mp11::mp_with_index<1 + sizeof...(T)>( v.index(), |
2476 | | detail::ostream_insert_L<Ch, Tr, T1, T...>{ os, v } ); |
2477 | | } |
2478 | | |
2479 | | // hashing support |
2480 | | |
2481 | | namespace detail |
2482 | | { |
2483 | | |
2484 | | inline std::size_t hash_value_impl_( mp11::mp_true, std::size_t index, std::size_t value ) |
2485 | 0 | { |
2486 | 0 | unsigned long long hv = 0xCBF29CE484222325ull; |
2487 | 0 | unsigned long long const prime = 0x100000001B3ull; |
2488 | 0 |
|
2489 | 0 | hv ^= index; |
2490 | 0 | hv *= prime; |
2491 | 0 |
|
2492 | 0 | hv ^= value; |
2493 | 0 | hv *= prime; |
2494 | 0 |
|
2495 | 0 | return static_cast<std::size_t>( hv ); |
2496 | 0 | } |
2497 | | |
2498 | | inline std::size_t hash_value_impl_( mp11::mp_false, std::size_t index, std::size_t value ) |
2499 | 0 | { |
2500 | 0 | std::size_t hv = 0x811C9DC5; |
2501 | 0 | std::size_t const prime = 0x01000193; |
2502 | 0 |
|
2503 | 0 | hv ^= index; |
2504 | 0 | hv *= prime; |
2505 | 0 |
|
2506 | 0 | hv ^= value; |
2507 | 0 | hv *= prime; |
2508 | 0 |
|
2509 | 0 | return hv; |
2510 | 0 | } |
2511 | | |
2512 | | inline std::size_t hash_value_impl( std::size_t index, std::size_t value ) |
2513 | 0 | { |
2514 | 0 | return hash_value_impl_( mp11::mp_bool< (SIZE_MAX > UINT32_MAX) >(), index, value ); |
2515 | 0 | } |
2516 | | |
2517 | | template<template<class> class H, class V> struct hash_value_L |
2518 | | { |
2519 | | V const & v; |
2520 | | |
2521 | | template<class I> std::size_t operator()( I ) const |
2522 | | { |
2523 | | auto const & t = unsafe_get<I::value>( v ); |
2524 | | |
2525 | | std::size_t index = I::value; |
2526 | | std::size_t value = H<remove_cv_ref_t<decltype(t)>>()( t ); |
2527 | | |
2528 | | return hash_value_impl( index, value ); |
2529 | | } |
2530 | | }; |
2531 | | |
2532 | | template<class... T> std::size_t hash_value_std( variant<T...> const & v ) |
2533 | | { |
2534 | | return mp11::mp_with_index<sizeof...(T)>( v.index(), detail::hash_value_L< std::hash, variant<T...> >{ v } ); |
2535 | | } |
2536 | | |
2537 | | } // namespace detail |
2538 | | |
2539 | | inline std::size_t hash_value( monostate const & ) |
2540 | 0 | { |
2541 | 0 | return 0xA7EE4757u; |
2542 | 0 | } |
2543 | | |
2544 | | template<class... T> std::size_t hash_value( variant<T...> const & v ) |
2545 | | { |
2546 | | return mp11::mp_with_index<sizeof...(T)>( v.index(), detail::hash_value_L< boost::hash, variant<T...> >{ v } ); |
2547 | | } |
2548 | | |
2549 | | namespace detail |
2550 | | { |
2551 | | |
2552 | | template<class T> using is_hash_enabled = std::is_default_constructible< std::hash<typename std::remove_const<T>::type> >; |
2553 | | |
2554 | | template<class V, bool E = mp11::mp_all_of<V, is_hash_enabled>::value> struct std_hash_impl; |
2555 | | |
2556 | | template<class V> struct std_hash_impl<V, false> |
2557 | | { |
2558 | | std_hash_impl() = delete; |
2559 | | std_hash_impl( std_hash_impl const& ) = delete; |
2560 | | std_hash_impl& operator=( std_hash_impl const& ) = delete; |
2561 | | }; |
2562 | | |
2563 | | template<class V> struct std_hash_impl<V, true> |
2564 | | { |
2565 | | std::size_t operator()( V const & v ) const |
2566 | | { |
2567 | | return detail::hash_value_std( v ); |
2568 | | } |
2569 | | }; |
2570 | | |
2571 | | } // namespace detail |
2572 | | |
2573 | | } // namespace variant2 |
2574 | | } // namespace boost |
2575 | | |
2576 | | namespace std |
2577 | | { |
2578 | | |
2579 | | template<class... T> struct hash< ::boost::variant2::variant<T...> >: public ::boost::variant2::detail::std_hash_impl< ::boost::variant2::variant<T...> > |
2580 | | { |
2581 | | }; |
2582 | | |
2583 | | template<> struct hash< ::boost::variant2::monostate > |
2584 | | { |
2585 | | std::size_t operator()( ::boost::variant2::monostate const & v ) const |
2586 | 0 | { |
2587 | 0 | return hash_value( v ); |
2588 | 0 | } |
2589 | | }; |
2590 | | |
2591 | | } // namespace std |
2592 | | |
2593 | | // JSON support |
2594 | | |
2595 | | namespace boost |
2596 | | { |
2597 | | namespace json |
2598 | | { |
2599 | | |
2600 | | class value; |
2601 | | |
2602 | | struct value_from_tag; |
2603 | | |
2604 | | template<class T> |
2605 | | void value_from( T&& t, value& jv ); |
2606 | | |
2607 | | template<class T> |
2608 | | struct try_value_to_tag; |
2609 | | |
2610 | | template<class T1, class T2> |
2611 | | struct result_for; |
2612 | | |
2613 | | template<class T> |
2614 | | typename result_for<T, value>::type |
2615 | | try_value_to( value const & jv ); |
2616 | | |
2617 | | template<class T> |
2618 | | typename result_for<T, value>::type |
2619 | | result_from_errno( int e, boost::source_location const* loc ) noexcept; |
2620 | | |
2621 | | template<class T> struct is_null_like; |
2622 | | |
2623 | | template<> struct is_null_like<variant2::monostate>: std::true_type {}; |
2624 | | |
2625 | | } // namespace json |
2626 | | |
2627 | | namespace variant2 |
2628 | | { |
2629 | | |
2630 | | namespace detail |
2631 | | { |
2632 | | |
2633 | | struct tag_invoke_L1 |
2634 | | { |
2635 | | boost::json::value& v; |
2636 | | |
2637 | | #if defined(BOOST_MSVC) && BOOST_MSVC / 10 == 191 |
2638 | | // msvc-14.1 with /permissive- needs this |
2639 | | explicit tag_invoke_L1( boost::json::value& v_ ): v( v_ ) {} |
2640 | | #endif |
2641 | | |
2642 | | template<class T> void operator()( T const& t ) const |
2643 | | { |
2644 | | boost::json::value_from( t, v ); |
2645 | | } |
2646 | | }; |
2647 | | |
2648 | | } // namespace detail |
2649 | | |
2650 | | template<class... T> |
2651 | | void tag_invoke( boost::json::value_from_tag const&, boost::json::value& v, variant<T...> const & w ) |
2652 | | { |
2653 | | visit( detail::tag_invoke_L1{ v }, w ); |
2654 | | } |
2655 | | |
2656 | | namespace detail |
2657 | | { |
2658 | | |
2659 | | template<class V> struct tag_invoke_L2 |
2660 | | { |
2661 | | boost::json::value const& v; |
2662 | | typename boost::json::result_for<V, boost::json::value>::type& r; |
2663 | | |
2664 | | template<class I> void operator()( I /*i*/ ) const |
2665 | | { |
2666 | | if( !r ) |
2667 | | { |
2668 | | using Ti = mp11::mp_at_c<V, I::value>; |
2669 | | auto r2 = boost::json::try_value_to<Ti>( v ); |
2670 | | |
2671 | | if( r2 ) |
2672 | | { |
2673 | | r.emplace( in_place_index_t<I::value>{}, std::move( *r2 ) ); |
2674 | | } |
2675 | | } |
2676 | | } |
2677 | | }; |
2678 | | |
2679 | | } // namespace detail |
2680 | | |
2681 | | template<class... T> |
2682 | | typename boost::json::result_for<variant<T...>, boost::json::value>::type |
2683 | | tag_invoke( boost::json::try_value_to_tag<variant<T...>> const&, boost::json::value const& v ) |
2684 | | { |
2685 | | static constexpr boost::source_location loc = BOOST_CURRENT_LOCATION; |
2686 | | auto r = boost::json::result_from_errno< variant<T...> >( EINVAL, &loc ); |
2687 | | |
2688 | | mp11::mp_for_each<mp11::mp_iota_c<sizeof...(T)>>( detail::tag_invoke_L2< variant<T...> >{ v, r } ); |
2689 | | |
2690 | | return r; |
2691 | | } |
2692 | | |
2693 | | } // namespace variant2 |
2694 | | } // namespace boost |
2695 | | |
2696 | | #undef BOOST_VARIANT2_CX14_ASSERT |
2697 | | |
2698 | | #if defined(_MSC_VER) && _MSC_VER < 1910 |
2699 | | # pragma warning( pop ) |
2700 | | #endif |
2701 | | |
2702 | | #endif // #ifndef BOOST_VARIANT2_VARIANT_HPP_INCLUDED |