/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<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::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<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__ >= 7) |
629 | | // false positive, see https://github.com/boostorg/variant2/issues/55 |
630 | | // ... and https://github.com/boostorg/variant2/pull/57 |
631 | | // ... and https://github.com/boostorg/variant2/pull/58 |
632 | | # pragma GCC diagnostic push |
633 | | # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" |
634 | | #endif |
635 | | |
636 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): first_( std::forward<A>(a)... ) |
637 | | { |
638 | | } |
639 | | |
640 | | #if defined(BOOST_GCC) && (__GNUC__ >= 7) |
641 | | # pragma GCC diagnostic pop |
642 | | #endif |
643 | | |
644 | | 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)... ) |
645 | | { |
646 | | } |
647 | | |
648 | | BOOST_VARIANT2_CXX20_CONSTEXPR ~variant_storage_impl() |
649 | | { |
650 | | } |
651 | | |
652 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<0>, A&&... a ) |
653 | | { |
654 | | ::new( &first_ ) T1( std::forward<A>(a)... ); |
655 | | } |
656 | | |
657 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<I>, A&&... a ) |
658 | | { |
659 | | rest_.emplace( mp11::mp_size_t<I-1>(), std::forward<A>(a)... ); |
660 | | } |
661 | | |
662 | 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>) |
663 | | constexpr T1 const& get( mp11::mp_size_t<0> ) const noexcept { return first_; } |
664 | | |
665 | 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>) |
666 | | 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>() ); } |
667 | | }; |
668 | | |
669 | | 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...> |
670 | | { |
671 | | T0 t0_; |
672 | | T1 t1_; |
673 | | T2 t2_; |
674 | | T3 t3_; |
675 | | T4 t4_; |
676 | | T5 t5_; |
677 | | T6 t6_; |
678 | | T7 t7_; |
679 | | T8 t8_; |
680 | | T9 t9_; |
681 | | |
682 | | variant_storage<T...> rest_; |
683 | | |
684 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): t0_( std::forward<A>(a)... ) {} |
685 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<1>, A&&... a ): t1_( std::forward<A>(a)... ) {} |
686 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<2>, A&&... a ): t2_( std::forward<A>(a)... ) {} |
687 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<3>, A&&... a ): t3_( std::forward<A>(a)... ) {} |
688 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<4>, A&&... a ): t4_( std::forward<A>(a)... ) {} |
689 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<5>, A&&... a ): t5_( std::forward<A>(a)... ) {} |
690 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<6>, A&&... a ): t6_( std::forward<A>(a)... ) {} |
691 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<7>, A&&... a ): t7_( std::forward<A>(a)... ) {} |
692 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<8>, A&&... a ): t8_( std::forward<A>(a)... ) {} |
693 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<9>, A&&... a ): t9_( std::forward<A>(a)... ) {} |
694 | | |
695 | | 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)... ) {} |
696 | | |
697 | | BOOST_VARIANT2_CXX20_CONSTEXPR ~variant_storage_impl() |
698 | | { |
699 | | } |
700 | | |
701 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<0>, A&&... a ) { ::new( &t0_ ) T0( std::forward<A>(a)... ); } |
702 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<1>, A&&... a ) { ::new( &t1_ ) T1( std::forward<A>(a)... ); } |
703 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<2>, A&&... a ) { ::new( &t2_ ) T2( std::forward<A>(a)... ); } |
704 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<3>, A&&... a ) { ::new( &t3_ ) T3( std::forward<A>(a)... ); } |
705 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<4>, A&&... a ) { ::new( &t4_ ) T4( std::forward<A>(a)... ); } |
706 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<5>, A&&... a ) { ::new( &t5_ ) T5( std::forward<A>(a)... ); } |
707 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<6>, A&&... a ) { ::new( &t6_ ) T6( std::forward<A>(a)... ); } |
708 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<7>, A&&... a ) { ::new( &t7_ ) T7( std::forward<A>(a)... ); } |
709 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<8>, A&&... a ) { ::new( &t8_ ) T8( std::forward<A>(a)... ); } |
710 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<9>, A&&... a ) { ::new( &t9_ ) T9( std::forward<A>(a)... ); } |
711 | | |
712 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<I>, A&&... a ) |
713 | | { |
714 | | rest_.emplace( mp11::mp_size_t<I-10>(), std::forward<A>(a)... ); |
715 | | } |
716 | | |
717 | | BOOST_CXX14_CONSTEXPR T0& get( mp11::mp_size_t<0> ) noexcept { return t0_; } |
718 | | constexpr T0 const& get( mp11::mp_size_t<0> ) const noexcept { return t0_; } |
719 | | |
720 | | BOOST_CXX14_CONSTEXPR T1& get( mp11::mp_size_t<1> ) noexcept { return t1_; } |
721 | | constexpr T1 const& get( mp11::mp_size_t<1> ) const noexcept { return t1_; } |
722 | | |
723 | | BOOST_CXX14_CONSTEXPR T2& get( mp11::mp_size_t<2> ) noexcept { return t2_; } |
724 | | constexpr T2 const& get( mp11::mp_size_t<2> ) const noexcept { return t2_; } |
725 | | |
726 | | BOOST_CXX14_CONSTEXPR T3& get( mp11::mp_size_t<3> ) noexcept { return t3_; } |
727 | | constexpr T3 const& get( mp11::mp_size_t<3> ) const noexcept { return t3_; } |
728 | | |
729 | | BOOST_CXX14_CONSTEXPR T4& get( mp11::mp_size_t<4> ) noexcept { return t4_; } |
730 | | constexpr T4 const& get( mp11::mp_size_t<4> ) const noexcept { return t4_; } |
731 | | |
732 | | BOOST_CXX14_CONSTEXPR T5& get( mp11::mp_size_t<5> ) noexcept { return t5_; } |
733 | | constexpr T5 const& get( mp11::mp_size_t<5> ) const noexcept { return t5_; } |
734 | | |
735 | | BOOST_CXX14_CONSTEXPR T6& get( mp11::mp_size_t<6> ) noexcept { return t6_; } |
736 | | constexpr T6 const& get( mp11::mp_size_t<6> ) const noexcept { return t6_; } |
737 | | |
738 | | BOOST_CXX14_CONSTEXPR T7& get( mp11::mp_size_t<7> ) noexcept { return t7_; } |
739 | | constexpr T7 const& get( mp11::mp_size_t<7> ) const noexcept { return t7_; } |
740 | | |
741 | | BOOST_CXX14_CONSTEXPR T8& get( mp11::mp_size_t<8> ) noexcept { return t8_; } |
742 | | constexpr T8 const& get( mp11::mp_size_t<8> ) const noexcept { return t8_; } |
743 | | |
744 | | BOOST_CXX14_CONSTEXPR T9& get( mp11::mp_size_t<9> ) noexcept { return t9_; } |
745 | | constexpr T9 const& get( mp11::mp_size_t<9> ) const noexcept { return t9_; } |
746 | | |
747 | | 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>() ); } |
748 | | 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>() ); } |
749 | | }; |
750 | | |
751 | | // all trivially destructible |
752 | | template<class T1, class... T> union variant_storage_impl<mp11::mp_true, T1, T...> |
753 | | { |
754 | | T1 first_; |
755 | | variant_storage<T...> rest_; |
756 | | |
757 | | #if defined(BOOST_GCC) && (__GNUC__ >= 7) |
758 | | // false positive, see https://github.com/boostorg/variant2/issues/55 |
759 | | // ... and https://github.com/boostorg/variant2/pull/57 |
760 | | // ... and https://github.com/boostorg/variant2/pull/58 |
761 | | # pragma GCC diagnostic push |
762 | | # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" |
763 | | #endif |
764 | | |
765 | 0 | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): first_( std::forward<A>(a)... ) |
766 | 0 | { |
767 | 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)&&) |
768 | | |
769 | | #if defined(BOOST_GCC) && (__GNUC__ >= 7) |
770 | | # pragma GCC diagnostic pop |
771 | | #endif |
772 | | |
773 | 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)... ) |
774 | 0 | { |
775 | 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&&) |
776 | | |
777 | | template<class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<0>, A&&... a ) |
778 | | { |
779 | | ::new( &first_ ) T1( std::forward<A>(a)... ); |
780 | | } |
781 | | |
782 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<I>, A&&... a ) |
783 | | { |
784 | | rest_.emplace( mp11::mp_size_t<I-1>(), std::forward<A>(a)... ); |
785 | | } |
786 | | |
787 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_true, mp11::mp_size_t<I>, A&&... a ) |
788 | | { |
789 | | #if defined(BOOST_GCC) && (__GNUC__ >= 7) |
790 | | # pragma GCC diagnostic push |
791 | | // False positive in at least GCC 7 and GCC 10 ASAN triggered by monostate (via result<void>) |
792 | | # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" |
793 | | #if __GNUC__ >= 12 |
794 | | // False positive in at least GCC 12 and GCC 13 ASAN and -Og triggered by monostate (via result<void>) |
795 | | # pragma GCC diagnostic ignored "-Wuninitialized" |
796 | | #endif |
797 | | #endif |
798 | | |
799 | | *this = variant_storage_impl( mp11::mp_size_t<I>(), std::forward<A>(a)... ); |
800 | | |
801 | | #if defined(BOOST_GCC) && (__GNUC__ >= 7) |
802 | | # pragma GCC diagnostic pop |
803 | | #endif |
804 | | } |
805 | | |
806 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<I>, A&&... a ) |
807 | | { |
808 | | 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)... ); |
809 | | } |
810 | | |
811 | 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>) |
812 | 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::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::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 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 |
813 | | |
814 | 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>) |
815 | 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<((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::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<((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 |
816 | | }; |
817 | | |
818 | | 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...> |
819 | | { |
820 | | T0 t0_; |
821 | | T1 t1_; |
822 | | T2 t2_; |
823 | | T3 t3_; |
824 | | T4 t4_; |
825 | | T5 t5_; |
826 | | T6 t6_; |
827 | | T7 t7_; |
828 | | T8 t8_; |
829 | | T9 t9_; |
830 | | |
831 | | variant_storage<T...> rest_; |
832 | | |
833 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): t0_( std::forward<A>(a)... ) {} |
834 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<1>, A&&... a ): t1_( std::forward<A>(a)... ) {} |
835 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<2>, A&&... a ): t2_( std::forward<A>(a)... ) {} |
836 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<3>, A&&... a ): t3_( std::forward<A>(a)... ) {} |
837 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<4>, A&&... a ): t4_( std::forward<A>(a)... ) {} |
838 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<5>, A&&... a ): t5_( std::forward<A>(a)... ) {} |
839 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<6>, A&&... a ): t6_( std::forward<A>(a)... ) {} |
840 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<7>, A&&... a ): t7_( std::forward<A>(a)... ) {} |
841 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<8>, A&&... a ): t8_( std::forward<A>(a)... ) {} |
842 | | template<class... A> constexpr variant_storage_impl( mp11::mp_size_t<9>, A&&... a ): t9_( std::forward<A>(a)... ) {} |
843 | | |
844 | | 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)... ) {} |
845 | | |
846 | | 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)... ); } |
847 | | 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)... ); } |
848 | | 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)... ); } |
849 | | 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)... ); } |
850 | | 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)... ); } |
851 | | 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)... ); } |
852 | | 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)... ); } |
853 | | 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)... ); } |
854 | | 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)... ); } |
855 | | 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)... ); } |
856 | | |
857 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<I>, A&&... a ) |
858 | | { |
859 | | rest_.emplace( mp11::mp_size_t<I-10>(), std::forward<A>(a)... ); |
860 | | } |
861 | | |
862 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_true, mp11::mp_size_t<I>, A&&... a ) |
863 | | { |
864 | | *this = variant_storage_impl( mp11::mp_size_t<I>(), std::forward<A>(a)... ); |
865 | | } |
866 | | |
867 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<I>, A&&... a ) |
868 | | { |
869 | | this->emplace_impl( mp11::mp_all< |
870 | | detail::is_trivially_move_assignable<T0>, |
871 | | detail::is_trivially_move_assignable<T1>, |
872 | | detail::is_trivially_move_assignable<T2>, |
873 | | detail::is_trivially_move_assignable<T3>, |
874 | | detail::is_trivially_move_assignable<T4>, |
875 | | detail::is_trivially_move_assignable<T5>, |
876 | | detail::is_trivially_move_assignable<T6>, |
877 | | detail::is_trivially_move_assignable<T7>, |
878 | | detail::is_trivially_move_assignable<T8>, |
879 | | detail::is_trivially_move_assignable<T9>, |
880 | | detail::is_trivially_move_assignable<T>...>(), mp11::mp_size_t<I>(), std::forward<A>(a)... ); |
881 | | } |
882 | | |
883 | | BOOST_CXX14_CONSTEXPR T0& get( mp11::mp_size_t<0> ) noexcept { return t0_; } |
884 | | constexpr T0 const& get( mp11::mp_size_t<0> ) const noexcept { return t0_; } |
885 | | |
886 | | BOOST_CXX14_CONSTEXPR T1& get( mp11::mp_size_t<1> ) noexcept { return t1_; } |
887 | | constexpr T1 const& get( mp11::mp_size_t<1> ) const noexcept { return t1_; } |
888 | | |
889 | | BOOST_CXX14_CONSTEXPR T2& get( mp11::mp_size_t<2> ) noexcept { return t2_; } |
890 | | constexpr T2 const& get( mp11::mp_size_t<2> ) const noexcept { return t2_; } |
891 | | |
892 | | BOOST_CXX14_CONSTEXPR T3& get( mp11::mp_size_t<3> ) noexcept { return t3_; } |
893 | | constexpr T3 const& get( mp11::mp_size_t<3> ) const noexcept { return t3_; } |
894 | | |
895 | | BOOST_CXX14_CONSTEXPR T4& get( mp11::mp_size_t<4> ) noexcept { return t4_; } |
896 | | constexpr T4 const& get( mp11::mp_size_t<4> ) const noexcept { return t4_; } |
897 | | |
898 | | BOOST_CXX14_CONSTEXPR T5& get( mp11::mp_size_t<5> ) noexcept { return t5_; } |
899 | | constexpr T5 const& get( mp11::mp_size_t<5> ) const noexcept { return t5_; } |
900 | | |
901 | | BOOST_CXX14_CONSTEXPR T6& get( mp11::mp_size_t<6> ) noexcept { return t6_; } |
902 | | constexpr T6 const& get( mp11::mp_size_t<6> ) const noexcept { return t6_; } |
903 | | |
904 | | BOOST_CXX14_CONSTEXPR T7& get( mp11::mp_size_t<7> ) noexcept { return t7_; } |
905 | | constexpr T7 const& get( mp11::mp_size_t<7> ) const noexcept { return t7_; } |
906 | | |
907 | | BOOST_CXX14_CONSTEXPR T8& get( mp11::mp_size_t<8> ) noexcept { return t8_; } |
908 | | constexpr T8 const& get( mp11::mp_size_t<8> ) const noexcept { return t8_; } |
909 | | |
910 | | BOOST_CXX14_CONSTEXPR T9& get( mp11::mp_size_t<9> ) noexcept { return t9_; } |
911 | | constexpr T9 const& get( mp11::mp_size_t<9> ) const noexcept { return t9_; } |
912 | | |
913 | | 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>() ); } |
914 | | 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>() ); } |
915 | | }; |
916 | | |
917 | | // resolve_overload_* |
918 | | |
919 | | template<class... T> struct overload; |
920 | | |
921 | | template<> struct overload<> |
922 | | { |
923 | | void operator()() const; |
924 | | }; |
925 | | |
926 | | template<class T1, class... T> struct overload<T1, T...>: overload<T...> |
927 | | { |
928 | | using overload<T...>::operator(); |
929 | | mp11::mp_identity<T1> operator()(T1) const; |
930 | | }; |
931 | | |
932 | | #if BOOST_WORKAROUND( BOOST_MSVC, < 1930 ) |
933 | | |
934 | | template<class U, class... T> using resolve_overload_type_ = decltype( overload<T...>()(std::declval<U>()) ); |
935 | | |
936 | | template<class U, class... T> struct resolve_overload_type_impl: mp11::mp_defer< resolve_overload_type_, U, T... > |
937 | | { |
938 | | }; |
939 | | |
940 | | template<class U, class... T> using resolve_overload_type = typename resolve_overload_type_impl<U, T...>::type::type; |
941 | | |
942 | | #else |
943 | | |
944 | | template<class U, class... T> using resolve_overload_type = typename decltype( overload<T...>()(std::declval<U>()) )::type; |
945 | | |
946 | | #endif |
947 | | |
948 | | template<class U, class... T> using resolve_overload_index = mp11::mp_find<mp11::mp_list<T...>, resolve_overload_type<U, T...>>; |
949 | | |
950 | | // index_type |
951 | | |
952 | | template<std::size_t N> using get_smallest_unsigned_type = mp11::mp_cond< |
953 | | |
954 | | mp11::mp_bool< N <= (std::numeric_limits<unsigned char>::max)() >, unsigned char, |
955 | | mp11::mp_bool< N <= (std::numeric_limits<unsigned short>::max)() >, unsigned short, |
956 | | mp11::mp_true, unsigned |
957 | | |
958 | | >; |
959 | | |
960 | | #if BOOST_WORKAROUND( BOOST_CLANG_VERSION, < 30800 ) |
961 | | |
962 | | template<bool Double, class... T> using get_index_type = unsigned short; |
963 | | |
964 | | #else |
965 | | |
966 | | template<bool Double, class... T> using get_index_type = get_smallest_unsigned_type< (Double + 1) * sizeof...(T) >; |
967 | | |
968 | | #endif |
969 | | |
970 | | // variant_base |
971 | | |
972 | | template<bool is_trivially_destructible, bool is_single_buffered, class... T> struct variant_base_impl; |
973 | | 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...>; |
974 | | |
975 | | struct none {}; |
976 | | |
977 | | // trivially destructible, single buffered |
978 | | template<class... T> struct variant_base_impl<true, true, T...> |
979 | | { |
980 | | using index_type = get_index_type<false, T...>; |
981 | | |
982 | | variant_storage<none, T...> st_; |
983 | | index_type ix_; |
984 | | |
985 | | constexpr variant_base_impl(): st_( mp11::mp_size_t<0>() ), ix_( 0 ) |
986 | | { |
987 | | } |
988 | | |
989 | 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 ) |
990 | 0 | { |
991 | 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&&) |
992 | | |
993 | | // requires: ix_ == 0 |
994 | | template<class I, class... A> BOOST_CXX14_CONSTEXPR void _replace( I, A&&... a ) |
995 | | { |
996 | | ::new( &st_ ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); |
997 | | |
998 | | static_assert( I::value + 1 <= (std::numeric_limits<index_type>::max)(), "" ); |
999 | | ix_ = I::value + 1; |
1000 | | } |
1001 | | |
1002 | | constexpr std::size_t index() const noexcept |
1003 | 0 | { |
1004 | 0 | return ix_ - 1; |
1005 | 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 |
1006 | | |
1007 | | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept |
1008 | 0 | { |
1009 | 0 | std::size_t const J = I+1; |
1010 | |
|
1011 | 0 | BOOST_ASSERT( ix_ == J ); |
1012 | |
|
1013 | 0 | return st_.get( mp11::mp_size_t<J>() ); |
1014 | 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>) |
1015 | | |
1016 | | template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept |
1017 | 0 | { |
1018 | | // std::size_t const J = I+1; |
1019 | |
|
1020 | 0 | BOOST_VARIANT2_CX14_ASSERT( ix_ == I+1 ) |
1021 | |
|
1022 | 0 | return st_.get( mp11::mp_size_t<I+1>() ); |
1023 | 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<(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::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<(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 |
1024 | | |
1025 | | template<std::size_t J, class U, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_true, A&&... a ) |
1026 | | { |
1027 | | static_assert( std::is_nothrow_constructible<U, A&&...>::value, "Logic error: U must be nothrow constructible from A&&..." ); |
1028 | | |
1029 | | st_.emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); |
1030 | | |
1031 | | static_assert( J <= (std::numeric_limits<index_type>::max)(), "" ); |
1032 | | ix_ = J; |
1033 | | } |
1034 | | |
1035 | | template<std::size_t J, class U, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, A&&... a ) |
1036 | | { |
1037 | | static_assert( std::is_nothrow_move_constructible<U>::value, "Logic error: U must be nothrow move constructible" ); |
1038 | | |
1039 | | U tmp( std::forward<A>(a)... ); |
1040 | | |
1041 | | st_.emplace( mp11::mp_size_t<J>(), std::move(tmp) ); |
1042 | | |
1043 | | static_assert( J <= (std::numeric_limits<index_type>::max)(), "" ); |
1044 | | ix_ = J; |
1045 | | } |
1046 | | |
1047 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a ) |
1048 | | { |
1049 | | std::size_t const J = I+1; |
1050 | | using U = mp11::mp_at_c<variant<T...>, I>; |
1051 | | |
1052 | | this->emplace_impl<J, U>( std::is_nothrow_constructible<U, A&&...>(), std::forward<A>(a)... ); |
1053 | | } |
1054 | | |
1055 | | static constexpr bool uses_double_storage() noexcept |
1056 | | { |
1057 | | return false; |
1058 | | } |
1059 | | }; |
1060 | | |
1061 | | // trivially destructible, double buffered |
1062 | | template<class... T> struct variant_base_impl<true, false, T...> |
1063 | | { |
1064 | | using index_type = get_index_type<true, T...>; |
1065 | | |
1066 | | variant_storage<none, T...> st_[ 2 ]; |
1067 | | index_type ix_; |
1068 | | |
1069 | | constexpr variant_base_impl(): st_{ { mp11::mp_size_t<0>() }, { mp11::mp_size_t<0>() } }, ix_( 0 ) |
1070 | | { |
1071 | | } |
1072 | | |
1073 | | 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 ) |
1074 | | { |
1075 | | } |
1076 | | |
1077 | | // requires: ix_ == 0 |
1078 | | template<class I, class... A> BOOST_CXX14_CONSTEXPR void _replace( I, A&&... a ) |
1079 | | { |
1080 | | ::new( &st_[ 0 ] ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); |
1081 | | |
1082 | | static_assert( ( I::value + 1 ) * 2 <= (std::numeric_limits<index_type>::max)(), "" ); |
1083 | | ix_ = ( I::value + 1 ) * 2; |
1084 | | } |
1085 | | |
1086 | | constexpr std::size_t index() const noexcept |
1087 | | { |
1088 | | return ix_ / 2 - 1; |
1089 | | } |
1090 | | |
1091 | | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept |
1092 | | { |
1093 | | BOOST_ASSERT( index() == I ); |
1094 | | |
1095 | | std::size_t const J = I+1; |
1096 | | |
1097 | | constexpr mp11::mp_size_t<J> j{}; |
1098 | | return st_[ ix_ & 1 ].get( j ); |
1099 | | } |
1100 | | |
1101 | | template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept |
1102 | | { |
1103 | | BOOST_VARIANT2_CX14_ASSERT( index() == I ) |
1104 | | |
1105 | | // std::size_t const J = I+1; |
1106 | | // constexpr mp_size_t<J> j{}; |
1107 | | |
1108 | | return st_[ ix_ & 1 ].get( mp11::mp_size_t<I+1>() ); |
1109 | | } |
1110 | | |
1111 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a ) |
1112 | | { |
1113 | | std::size_t const J = I+1; |
1114 | | |
1115 | | unsigned i2 = 1 - ( ix_ & 1 ); |
1116 | | |
1117 | | st_[ i2 ].emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); |
1118 | | |
1119 | | static_assert( J * 2 + 1 <= (std::numeric_limits<index_type>::max)(), "" ); |
1120 | | ix_ = static_cast<index_type>( J * 2 + i2 ); |
1121 | | } |
1122 | | |
1123 | | static constexpr bool uses_double_storage() noexcept |
1124 | | { |
1125 | | return true; |
1126 | | } |
1127 | | }; |
1128 | | |
1129 | | // not trivially destructible, single buffered |
1130 | | template<class... T> struct variant_base_impl<false, true, T...> |
1131 | | { |
1132 | | using index_type = get_index_type<false, T...>; |
1133 | | |
1134 | | variant_storage<none, T...> st_; |
1135 | | index_type ix_; |
1136 | | |
1137 | | constexpr variant_base_impl(): st_( mp11::mp_size_t<0>() ), ix_( 0 ) |
1138 | | { |
1139 | | } |
1140 | | |
1141 | | 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 ) |
1142 | | { |
1143 | | } |
1144 | | |
1145 | | // requires: ix_ == 0 |
1146 | | template<class I, class... A> BOOST_CXX14_CONSTEXPR void _replace( I, A&&... a ) |
1147 | | { |
1148 | | ::new( &st_ ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); |
1149 | | |
1150 | | static_assert( I::value + 1 <= (std::numeric_limits<index_type>::max)(), "" ); |
1151 | | ix_ = I::value + 1; |
1152 | | } |
1153 | | |
1154 | | //[&]( auto I ){ |
1155 | | // using U = mp_at_c<mp_list<none, T...>, I>; |
1156 | | // st1_.get( I ).~U(); |
1157 | | //} |
1158 | | |
1159 | | struct _destroy_L1 |
1160 | | { |
1161 | | variant_base_impl * this_; |
1162 | | |
1163 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I ) const noexcept |
1164 | 0 | { |
1165 | 0 | using U = mp11::mp_at<mp11::mp_list<none, T...>, I>; |
1166 | 0 |
|
1167 | 0 | #if defined(BOOST_GCC) && (__GNUC__ >= 12) |
1168 | 0 | // false positive, see https://github.com/boostorg/variant2/issues/55 |
1169 | 0 | # pragma GCC diagnostic push |
1170 | 0 | # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" |
1171 | 0 | #endif |
1172 | 0 |
|
1173 | 0 | this_->st_.get( I() ).~U(); |
1174 | 0 |
|
1175 | 0 | #if defined(BOOST_GCC) && (__GNUC__ >= 12) |
1176 | 0 | # pragma GCC diagnostic pop |
1177 | 0 | #endif |
1178 | 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 |
1179 | | }; |
1180 | | |
1181 | | BOOST_CXX14_CONSTEXPR void _destroy() noexcept |
1182 | 0 | { |
1183 | 0 | if( ix_ > 0 ) |
1184 | 0 | { |
1185 | 0 | mp11::mp_with_index<1 + sizeof...(T)>( ix_, _destroy_L1{ this } ); |
1186 | 0 | } |
1187 | 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() |
1188 | | |
1189 | | BOOST_VARIANT2_CXX20_CONSTEXPR ~variant_base_impl() noexcept |
1190 | | { |
1191 | | _destroy(); |
1192 | | } |
1193 | | |
1194 | | constexpr std::size_t index() const noexcept |
1195 | | { |
1196 | | return ix_ - 1; |
1197 | | } |
1198 | | |
1199 | | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept |
1200 | | { |
1201 | | std::size_t const J = I+1; |
1202 | | |
1203 | | BOOST_ASSERT( ix_ == J ); |
1204 | | |
1205 | | return st_.get( mp11::mp_size_t<J>() ); |
1206 | | } |
1207 | | |
1208 | | template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept |
1209 | | { |
1210 | | // std::size_t const J = I+1; |
1211 | | |
1212 | | BOOST_VARIANT2_CX14_ASSERT( ix_ == I+1 ) |
1213 | | |
1214 | | return st_.get( mp11::mp_size_t<I+1>() ); |
1215 | | } |
1216 | | |
1217 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a ) |
1218 | | { |
1219 | | std::size_t const J = I+1; |
1220 | | |
1221 | | using U = mp11::mp_at_c<variant<T...>, I>; |
1222 | | |
1223 | | static_assert( std::is_nothrow_move_constructible<U>::value, "Logic error: U must be nothrow move constructible" ); |
1224 | | |
1225 | | #if defined(BOOST_GCC) && (__GNUC__ >= 12) |
1226 | | // false positive, see https://github.com/boostorg/variant2/issues/55 |
1227 | | # pragma GCC diagnostic push |
1228 | | # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" |
1229 | | #endif |
1230 | | |
1231 | | U tmp( std::forward<A>(a)... ); |
1232 | | |
1233 | | #if defined(BOOST_GCC) && (__GNUC__ >= 12) |
1234 | | # pragma GCC diagnostic pop |
1235 | | #endif |
1236 | | |
1237 | | _destroy(); |
1238 | | |
1239 | | st_.emplace( mp11::mp_size_t<J>(), std::move(tmp) ); |
1240 | | |
1241 | | static_assert( J <= (std::numeric_limits<index_type>::max)(), "" ); |
1242 | | ix_ = J; |
1243 | | } |
1244 | | |
1245 | | static constexpr bool uses_double_storage() noexcept |
1246 | | { |
1247 | | return false; |
1248 | | } |
1249 | | }; |
1250 | | |
1251 | | // not trivially destructible, double buffered |
1252 | | template<class... T> struct variant_base_impl<false, false, T...> |
1253 | | { |
1254 | | using index_type = get_index_type<true, T...>; |
1255 | | |
1256 | | #if defined(__GNUC__) && __GNUC__ < 11 && !defined(__clang__) && !defined(__INTEL_COMPILER) |
1257 | | |
1258 | | // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63707 :-( |
1259 | | |
1260 | | variant_storage<none, T...> st1_, st2_; |
1261 | | index_type ix_; |
1262 | | |
1263 | | constexpr variant_base_impl(): st1_( mp11::mp_size_t<0>() ), st2_( mp11::mp_size_t<0>() ), ix_( 0 ) |
1264 | | { |
1265 | | } |
1266 | | |
1267 | | 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 ) |
1268 | | { |
1269 | | } |
1270 | | |
1271 | | BOOST_CXX14_CONSTEXPR variant_storage<none, T...>& storage( unsigned i2 ) noexcept |
1272 | | { |
1273 | | return i2 == 0? st1_: st2_; |
1274 | | } |
1275 | | |
1276 | | constexpr variant_storage<none, T...> const& storage( unsigned i2 ) const noexcept |
1277 | | { |
1278 | | return i2 == 0? st1_: st2_; |
1279 | | } |
1280 | | |
1281 | | #else |
1282 | | |
1283 | | variant_storage<none, T...> st_[ 2 ]; |
1284 | | index_type ix_; |
1285 | | |
1286 | | constexpr variant_base_impl(): st_{ { mp11::mp_size_t<0>() }, { mp11::mp_size_t<0>() } }, ix_( 0 ) |
1287 | | { |
1288 | | } |
1289 | | |
1290 | | 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 ) |
1291 | | { |
1292 | | } |
1293 | | |
1294 | | BOOST_CXX14_CONSTEXPR variant_storage<none, T...>& storage( unsigned i2 ) noexcept |
1295 | | { |
1296 | | return st_[ i2 ]; |
1297 | | } |
1298 | | |
1299 | | constexpr variant_storage<none, T...> const& storage( unsigned i2 ) const noexcept |
1300 | | { |
1301 | | return st_[ i2 ]; |
1302 | | } |
1303 | | |
1304 | | #endif |
1305 | | |
1306 | | // requires: ix_ == 0 |
1307 | | template<class I, class... A> BOOST_CXX14_CONSTEXPR void _replace( I, A&&... a ) |
1308 | | { |
1309 | | ::new( &storage( 0 ) ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); |
1310 | | |
1311 | | static_assert( ( I::value + 1 ) * 2 <= (std::numeric_limits<index_type>::max)(), "" ); |
1312 | | ix_ = ( I::value + 1 ) * 2; |
1313 | | } |
1314 | | |
1315 | | //[&]( auto I ){ |
1316 | | // using U = mp_at_c<mp_list<none, T...>, I>; |
1317 | | // st1_.get( I ).~U(); |
1318 | | //} |
1319 | | |
1320 | | struct _destroy_L1 |
1321 | | { |
1322 | | variant_base_impl * this_; |
1323 | | unsigned i2_; |
1324 | | |
1325 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I ) const noexcept |
1326 | | { |
1327 | | using U = mp11::mp_at<mp11::mp_list<none, T...>, I>; |
1328 | | this_->storage( i2_ ).get( I() ).~U(); |
1329 | | } |
1330 | | }; |
1331 | | |
1332 | | BOOST_CXX14_CONSTEXPR void _destroy() noexcept |
1333 | | { |
1334 | | mp11::mp_with_index<1 + sizeof...(T)>( ix_ / 2, _destroy_L1{ this, static_cast<unsigned>( ix_ & 1 ) } ); |
1335 | | } |
1336 | | |
1337 | | BOOST_VARIANT2_CXX20_CONSTEXPR ~variant_base_impl() noexcept |
1338 | | { |
1339 | | _destroy(); |
1340 | | } |
1341 | | |
1342 | | constexpr std::size_t index() const noexcept |
1343 | | { |
1344 | | return ix_ / 2 - 1; |
1345 | | } |
1346 | | |
1347 | | template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept |
1348 | | { |
1349 | | BOOST_ASSERT( index() == I ); |
1350 | | |
1351 | | std::size_t const J = I+1; |
1352 | | |
1353 | | constexpr mp11::mp_size_t<J> j{}; |
1354 | | return storage( ix_ & 1 ).get( j ); |
1355 | | } |
1356 | | |
1357 | | template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept |
1358 | | { |
1359 | | BOOST_VARIANT2_CX14_ASSERT( index() == I ) |
1360 | | |
1361 | | // std::size_t const J = I+1; |
1362 | | // constexpr mp_size_t<J> j{}; |
1363 | | |
1364 | | return storage( ix_ & 1 ).get( mp11::mp_size_t<I+1>() ); |
1365 | | } |
1366 | | |
1367 | | template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a ) |
1368 | | { |
1369 | | std::size_t const J = I+1; |
1370 | | |
1371 | | unsigned i2 = 1 - ( ix_ & 1 ); |
1372 | | |
1373 | | storage( i2 ).emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); |
1374 | | _destroy(); |
1375 | | |
1376 | | static_assert( J * 2 + 1 <= (std::numeric_limits<index_type>::max)(), "" ); |
1377 | | ix_ = static_cast<index_type>( J * 2 + i2 ); |
1378 | | } |
1379 | | |
1380 | | static constexpr bool uses_double_storage() noexcept |
1381 | | { |
1382 | | return true; |
1383 | | } |
1384 | | }; |
1385 | | |
1386 | | } // namespace detail |
1387 | | |
1388 | | // in_place_type_t |
1389 | | |
1390 | | template<class T> struct in_place_type_t |
1391 | | { |
1392 | | }; |
1393 | | |
1394 | | #if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) |
1395 | | |
1396 | | template<class T> constexpr in_place_type_t<T> in_place_type{}; |
1397 | | |
1398 | | #endif |
1399 | | |
1400 | | namespace detail |
1401 | | { |
1402 | | |
1403 | | template<class T> struct is_in_place_type: std::false_type {}; |
1404 | | template<class T> struct is_in_place_type<in_place_type_t<T>>: std::true_type {}; |
1405 | | |
1406 | | } // namespace detail |
1407 | | |
1408 | | // in_place_index_t |
1409 | | |
1410 | | template<std::size_t I> struct in_place_index_t |
1411 | | { |
1412 | | }; |
1413 | | |
1414 | | #if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) |
1415 | | |
1416 | | template<std::size_t I> constexpr in_place_index_t<I> in_place_index{}; |
1417 | | |
1418 | | #endif |
1419 | | |
1420 | | namespace detail |
1421 | | { |
1422 | | |
1423 | | template<class T> struct is_in_place_index: std::false_type {}; |
1424 | | template<std::size_t I> struct is_in_place_index<in_place_index_t<I>>: std::true_type {}; |
1425 | | |
1426 | | } // namespace detail |
1427 | | |
1428 | | // is_nothrow_swappable |
1429 | | |
1430 | | namespace detail |
1431 | | { |
1432 | | |
1433 | | namespace det2 |
1434 | | { |
1435 | | |
1436 | | using std::swap; |
1437 | | |
1438 | | template<class T> using is_swappable_impl = decltype(swap(std::declval<T&>(), std::declval<T&>())); |
1439 | | |
1440 | | #if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) |
1441 | | |
1442 | | template<class T> struct is_nothrow_swappable_impl_ |
1443 | | { |
1444 | | static constexpr bool value = noexcept(swap(std::declval<T&>(), std::declval<T&>())); |
1445 | | }; |
1446 | | |
1447 | | template<class T> using is_nothrow_swappable_impl = mp11::mp_bool< is_nothrow_swappable_impl_<T>::value >; |
1448 | | |
1449 | | #else |
1450 | | |
1451 | | template<class T> using is_nothrow_swappable_impl = typename std::enable_if<noexcept(swap(std::declval<T&>(), std::declval<T&>()))>::type; |
1452 | | |
1453 | | #endif |
1454 | | |
1455 | | } // namespace det2 |
1456 | | |
1457 | | template<class T> struct is_swappable: mp11::mp_valid<det2::is_swappable_impl, T> |
1458 | | { |
1459 | | }; |
1460 | | |
1461 | | #if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) |
1462 | | |
1463 | | 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> |
1464 | | { |
1465 | | }; |
1466 | | |
1467 | | #else |
1468 | | |
1469 | | template<class T> struct is_nothrow_swappable: mp11::mp_valid<det2::is_nothrow_swappable_impl, T> |
1470 | | { |
1471 | | }; |
1472 | | |
1473 | | #endif |
1474 | | |
1475 | | // variant_cc_base |
1476 | | |
1477 | | template<bool CopyConstructible, bool TriviallyCopyConstructible, class... T> struct variant_cc_base_impl; |
1478 | | |
1479 | | template<class... T> using variant_cc_base = variant_cc_base_impl< |
1480 | | mp11::mp_all<std::is_copy_constructible<T>...>::value, |
1481 | | mp11::mp_all<detail::is_trivially_copy_constructible<T>...>::value, |
1482 | | T...>; |
1483 | | |
1484 | | template<class... T> struct variant_cc_base_impl<true, true, T...>: public variant_base<T...> |
1485 | | { |
1486 | | using variant_base = detail::variant_base<T...>; |
1487 | | using variant_base::variant_base; |
1488 | | |
1489 | | variant_cc_base_impl() = default; |
1490 | | variant_cc_base_impl( variant_cc_base_impl const& ) = default; |
1491 | | variant_cc_base_impl( variant_cc_base_impl && ) = default; |
1492 | | variant_cc_base_impl& operator=( variant_cc_base_impl const& ) = default; |
1493 | | variant_cc_base_impl& operator=( variant_cc_base_impl && ) = default; |
1494 | | }; |
1495 | | |
1496 | | template<bool B, class... T> struct variant_cc_base_impl<false, B, T...>: public variant_base<T...> |
1497 | | { |
1498 | | using variant_base = detail::variant_base<T...>; |
1499 | | using variant_base::variant_base; |
1500 | | |
1501 | | variant_cc_base_impl() = default; |
1502 | | variant_cc_base_impl( variant_cc_base_impl const& ) = delete; |
1503 | | variant_cc_base_impl( variant_cc_base_impl && ) = default; |
1504 | | variant_cc_base_impl& operator=( variant_cc_base_impl const& ) = default; |
1505 | | variant_cc_base_impl& operator=( variant_cc_base_impl && ) = default; |
1506 | | }; |
1507 | | |
1508 | | template<class... T> struct variant_cc_base_impl<true, false, T...>: public variant_base<T...> |
1509 | | { |
1510 | | using variant_base = detail::variant_base<T...>; |
1511 | | using variant_base::variant_base; |
1512 | | |
1513 | | public: |
1514 | | |
1515 | | // constructors |
1516 | | |
1517 | | variant_cc_base_impl() = default; |
1518 | | |
1519 | | // copy constructor |
1520 | | |
1521 | | private: |
1522 | | |
1523 | | struct L1 |
1524 | | { |
1525 | | variant_base * this_; |
1526 | | variant_base const & r; |
1527 | | |
1528 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1529 | | { |
1530 | | this_->_replace( i, r._get_impl( i ) ); |
1531 | | } |
1532 | | }; |
1533 | | |
1534 | | public: |
1535 | | |
1536 | | BOOST_CXX14_CONSTEXPR variant_cc_base_impl( variant_cc_base_impl const& r ) |
1537 | | noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<T>...>::value ) |
1538 | | : variant_base() |
1539 | | { |
1540 | | mp11::mp_with_index<sizeof...(T)>( r.index(), L1{ this, r } ); |
1541 | | } |
1542 | | |
1543 | | // move constructor |
1544 | | |
1545 | | variant_cc_base_impl( variant_cc_base_impl && ) = default; |
1546 | | |
1547 | | // assignment |
1548 | | |
1549 | | variant_cc_base_impl& operator=( variant_cc_base_impl const & ) = default; |
1550 | | variant_cc_base_impl& operator=( variant_cc_base_impl && ) = default; |
1551 | | }; |
1552 | | |
1553 | | // variant_ca_base |
1554 | | |
1555 | | template<bool CopyAssignable, bool TriviallyCopyAssignable, class... T> struct variant_ca_base_impl; |
1556 | | |
1557 | | template<class... T> using variant_ca_base = variant_ca_base_impl< |
1558 | | mp11::mp_all<std::is_copy_constructible<T>..., std::is_copy_assignable<T>...>::value, |
1559 | | mp11::mp_all<std::is_trivially_destructible<T>..., detail::is_trivially_copy_constructible<T>..., detail::is_trivially_copy_assignable<T>...>::value, |
1560 | | T...>; |
1561 | | |
1562 | | template<class... T> struct variant_ca_base_impl<true, true, T...>: public variant_cc_base<T...> |
1563 | | { |
1564 | | using variant_base = detail::variant_cc_base<T...>; |
1565 | | using variant_base::variant_base; |
1566 | | |
1567 | | variant_ca_base_impl() = default; |
1568 | | variant_ca_base_impl( variant_ca_base_impl const& ) = default; |
1569 | | variant_ca_base_impl( variant_ca_base_impl && ) = default; |
1570 | | variant_ca_base_impl& operator=( variant_ca_base_impl const& ) = default; |
1571 | | variant_ca_base_impl& operator=( variant_ca_base_impl && ) = default; |
1572 | | }; |
1573 | | |
1574 | | template<bool B, class... T> struct variant_ca_base_impl<false, B, T...>: public variant_cc_base<T...> |
1575 | | { |
1576 | | using variant_base = detail::variant_cc_base<T...>; |
1577 | | using variant_base::variant_base; |
1578 | | |
1579 | | variant_ca_base_impl() = default; |
1580 | | variant_ca_base_impl( variant_ca_base_impl const& ) = default; |
1581 | | variant_ca_base_impl( variant_ca_base_impl && ) = default; |
1582 | | variant_ca_base_impl& operator=( variant_ca_base_impl const& ) = delete; |
1583 | | variant_ca_base_impl& operator=( variant_ca_base_impl && ) = default; |
1584 | | }; |
1585 | | |
1586 | | template<class... T> struct variant_ca_base_impl<true, false, T...>: public variant_cc_base<T...> |
1587 | | { |
1588 | | using variant_base = detail::variant_cc_base<T...>; |
1589 | | using variant_base::variant_base; |
1590 | | |
1591 | | public: |
1592 | | |
1593 | | // constructors |
1594 | | |
1595 | | variant_ca_base_impl() = default; |
1596 | | variant_ca_base_impl( variant_ca_base_impl const& ) = default; |
1597 | | variant_ca_base_impl( variant_ca_base_impl && ) = default; |
1598 | | |
1599 | | // copy assignment |
1600 | | |
1601 | | private: |
1602 | | |
1603 | | struct L3 |
1604 | | { |
1605 | | variant_base * this_; |
1606 | | variant_base const & r; |
1607 | | |
1608 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1609 | | { |
1610 | | this_->template emplace<I::value>( r._get_impl( i ) ); |
1611 | | } |
1612 | | }; |
1613 | | |
1614 | | public: |
1615 | | |
1616 | | BOOST_CXX14_CONSTEXPR variant_ca_base_impl& operator=( variant_ca_base_impl const & r ) |
1617 | | noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<T>...>::value ) |
1618 | | { |
1619 | | mp11::mp_with_index<sizeof...(T)>( r.index(), L3{ this, r } ); |
1620 | | return *this; |
1621 | | } |
1622 | | |
1623 | | // move assignment |
1624 | | |
1625 | | variant_ca_base_impl& operator=( variant_ca_base_impl && ) = default; |
1626 | | }; |
1627 | | |
1628 | | // variant_mc_base |
1629 | | |
1630 | | template<bool MoveConstructible, bool TriviallyMoveConstructible, class... T> struct variant_mc_base_impl; |
1631 | | |
1632 | | template<class... T> using variant_mc_base = variant_mc_base_impl< |
1633 | | mp11::mp_all<std::is_move_constructible<T>...>::value, |
1634 | | mp11::mp_all<detail::is_trivially_move_constructible<T>...>::value, |
1635 | | T...>; |
1636 | | |
1637 | | template<class... T> struct variant_mc_base_impl<true, true, T...>: public variant_ca_base<T...> |
1638 | | { |
1639 | | using variant_base = detail::variant_ca_base<T...>; |
1640 | | using variant_base::variant_base; |
1641 | | |
1642 | | variant_mc_base_impl() = default; |
1643 | | variant_mc_base_impl( variant_mc_base_impl const& ) = default; |
1644 | | variant_mc_base_impl( variant_mc_base_impl && ) = default; |
1645 | | variant_mc_base_impl& operator=( variant_mc_base_impl const& ) = default; |
1646 | | variant_mc_base_impl& operator=( variant_mc_base_impl && ) = default; |
1647 | | }; |
1648 | | |
1649 | | template<bool B, class... T> struct variant_mc_base_impl<false, B, T...>: public variant_ca_base<T...> |
1650 | | { |
1651 | | using variant_base = detail::variant_ca_base<T...>; |
1652 | | using variant_base::variant_base; |
1653 | | |
1654 | | variant_mc_base_impl() = default; |
1655 | | variant_mc_base_impl( variant_mc_base_impl const& ) = default; |
1656 | | variant_mc_base_impl( variant_mc_base_impl && ) = delete; |
1657 | | variant_mc_base_impl& operator=( variant_mc_base_impl const& ) = default; |
1658 | | variant_mc_base_impl& operator=( variant_mc_base_impl && ) = default; |
1659 | | }; |
1660 | | |
1661 | | template<class... T> struct variant_mc_base_impl<true, false, T...>: public variant_ca_base<T...> |
1662 | | { |
1663 | | using variant_base = detail::variant_ca_base<T...>; |
1664 | | using variant_base::variant_base; |
1665 | | |
1666 | | public: |
1667 | | |
1668 | | // constructors |
1669 | | |
1670 | | variant_mc_base_impl() = default; |
1671 | | variant_mc_base_impl( variant_mc_base_impl const& ) = default; |
1672 | | |
1673 | | // move constructor |
1674 | | |
1675 | | private: |
1676 | | |
1677 | | struct L2 |
1678 | | { |
1679 | | variant_base * this_; |
1680 | | variant_base & r; |
1681 | | |
1682 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1683 | | { |
1684 | | this_->_replace( i, std::move( r._get_impl( i ) ) ); |
1685 | | } |
1686 | | }; |
1687 | | |
1688 | | public: |
1689 | | |
1690 | | BOOST_CXX14_CONSTEXPR variant_mc_base_impl( variant_mc_base_impl && r ) |
1691 | | noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>...>::value ) |
1692 | | { |
1693 | | mp11::mp_with_index<sizeof...(T)>( r.index(), L2{ this, r } ); |
1694 | | } |
1695 | | |
1696 | | // assignment |
1697 | | |
1698 | | variant_mc_base_impl& operator=( variant_mc_base_impl const & ) = default; |
1699 | | variant_mc_base_impl& operator=( variant_mc_base_impl && ) = default; |
1700 | | }; |
1701 | | |
1702 | | // variant_ma_base |
1703 | | |
1704 | | template<bool MoveAssignable, bool TriviallyMoveAssignable, class... T> struct variant_ma_base_impl; |
1705 | | |
1706 | | template<class... T> using variant_ma_base = variant_ma_base_impl< |
1707 | | mp11::mp_all<std::is_move_constructible<T>..., std::is_move_assignable<T>...>::value, |
1708 | | mp11::mp_all<std::is_trivially_destructible<T>..., detail::is_trivially_move_constructible<T>..., detail::is_trivially_move_assignable<T>...>::value, |
1709 | | T...>; |
1710 | | |
1711 | | template<class... T> struct variant_ma_base_impl<true, true, T...>: public variant_mc_base<T...> |
1712 | | { |
1713 | | using variant_base = detail::variant_mc_base<T...>; |
1714 | | using variant_base::variant_base; |
1715 | | |
1716 | | variant_ma_base_impl() = default; |
1717 | | variant_ma_base_impl( variant_ma_base_impl const& ) = default; |
1718 | | variant_ma_base_impl( variant_ma_base_impl && ) = default; |
1719 | | variant_ma_base_impl& operator=( variant_ma_base_impl const& ) = default; |
1720 | | variant_ma_base_impl& operator=( variant_ma_base_impl && ) = default; |
1721 | | }; |
1722 | | |
1723 | | template<bool B, class... T> struct variant_ma_base_impl<false, B, T...>: public variant_mc_base<T...> |
1724 | | { |
1725 | | using variant_base = detail::variant_mc_base<T...>; |
1726 | | using variant_base::variant_base; |
1727 | | |
1728 | | variant_ma_base_impl() = default; |
1729 | | variant_ma_base_impl( variant_ma_base_impl const& ) = default; |
1730 | | variant_ma_base_impl( variant_ma_base_impl && ) = default; |
1731 | | variant_ma_base_impl& operator=( variant_ma_base_impl const& ) = default; |
1732 | | variant_ma_base_impl& operator=( variant_ma_base_impl && ) = delete; |
1733 | | }; |
1734 | | |
1735 | | template<class... T> struct variant_ma_base_impl<true, false, T...>: public variant_mc_base<T...> |
1736 | | { |
1737 | | using variant_base = detail::variant_mc_base<T...>; |
1738 | | using variant_base::variant_base; |
1739 | | |
1740 | | public: |
1741 | | |
1742 | | // constructors |
1743 | | |
1744 | | variant_ma_base_impl() = default; |
1745 | | variant_ma_base_impl( variant_ma_base_impl const& ) = default; |
1746 | | variant_ma_base_impl( variant_ma_base_impl && ) = default; |
1747 | | |
1748 | | // copy assignment |
1749 | | |
1750 | | variant_ma_base_impl& operator=( variant_ma_base_impl const & ) = default; |
1751 | | |
1752 | | // move assignment |
1753 | | |
1754 | | private: |
1755 | | |
1756 | | struct L4 |
1757 | | { |
1758 | | variant_base * this_; |
1759 | | variant_base & r; |
1760 | | |
1761 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1762 | | { |
1763 | | this_->template emplace<I::value>( std::move( r._get_impl( i ) ) ); |
1764 | | } |
1765 | | }; |
1766 | | |
1767 | | public: |
1768 | | |
1769 | | BOOST_CXX14_CONSTEXPR variant_ma_base_impl& operator=( variant_ma_base_impl && r ) |
1770 | | noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>...>::value ) |
1771 | | { |
1772 | | mp11::mp_with_index<sizeof...(T)>( r.index(), L4{ this, r } ); |
1773 | | return *this; |
1774 | | } |
1775 | | }; |
1776 | | |
1777 | | } // namespace detail |
1778 | | |
1779 | | // variant |
1780 | | |
1781 | | template<class... T> class variant: private detail::variant_ma_base<T...> |
1782 | | { |
1783 | | private: |
1784 | | |
1785 | | using variant_base = detail::variant_ma_base<T...>; |
1786 | | |
1787 | | public: |
1788 | | |
1789 | | // constructors |
1790 | | |
1791 | | template<class E1 = void, class E2 = mp11::mp_if<std::is_default_constructible< mp11::mp_first<variant<T...>> >, E1>> |
1792 | | constexpr variant() |
1793 | | noexcept( std::is_nothrow_default_constructible< mp11::mp_first<variant<T...>> >::value ) |
1794 | | : variant_base( mp11::mp_size_t<0>() ) |
1795 | | { |
1796 | | } |
1797 | | |
1798 | | // variant( variant const& ) = default; |
1799 | | // variant( variant && ) = default; |
1800 | | |
1801 | | template<class U, |
1802 | | class Ud = typename std::decay<U>::type, |
1803 | | 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, |
1804 | | |
1805 | | #if BOOST_WORKAROUND(BOOST_MSVC, < 1960) |
1806 | | |
1807 | | class V = mp11::mp_apply_q< mp11::mp_bind_front<detail::resolve_overload_type, U&&>, variant >, |
1808 | | |
1809 | | #else |
1810 | | |
1811 | | class V = detail::resolve_overload_type<U&&, T...>, |
1812 | | |
1813 | | #endif |
1814 | | |
1815 | | class E2 = typename std::enable_if<std::is_constructible<V, U&&>::value>::type |
1816 | | > |
1817 | | constexpr variant( U&& u ) |
1818 | | noexcept( std::is_nothrow_constructible<V, U&&>::value ) |
1819 | | : variant_base( detail::resolve_overload_index<U&&, T...>(), std::forward<U>(u) ) |
1820 | | { |
1821 | | } |
1822 | | |
1823 | | 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> |
1824 | | constexpr explicit variant( in_place_type_t<U>, A&&... a ): variant_base( I(), std::forward<A>(a)... ) |
1825 | | { |
1826 | | } |
1827 | | |
1828 | | 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> |
1829 | | constexpr explicit variant( in_place_type_t<U>, std::initializer_list<V> il, A&&... a ): variant_base( I(), il, std::forward<A>(a)... ) |
1830 | | { |
1831 | | } |
1832 | | |
1833 | | 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> |
1834 | 0 | constexpr explicit variant( in_place_index_t<I>, A&&... a ): variant_base( mp11::mp_size_t<I>(), std::forward<A>(a)... ) |
1835 | 0 | { |
1836 | 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&&) |
1837 | | |
1838 | | 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> |
1839 | | 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)... ) |
1840 | | { |
1841 | | } |
1842 | | |
1843 | | // assignment |
1844 | | |
1845 | | // variant& operator=( variant const& ) = default; |
1846 | | // variant& operator=( variant && ) = default; |
1847 | | |
1848 | | template<class U, |
1849 | | class E1 = typename std::enable_if<!std::is_same<typename std::decay<U>::type, variant>::value>::type, |
1850 | | class V = detail::resolve_overload_type<U, T...>, |
1851 | | class E2 = typename std::enable_if<std::is_assignable<V&, U&&>::value && std::is_constructible<V, U&&>::value>::type |
1852 | | > |
1853 | | BOOST_CXX14_CONSTEXPR variant& operator=( U&& u ) |
1854 | | noexcept( std::is_nothrow_constructible<V, U&&>::value ) |
1855 | | { |
1856 | | std::size_t const I = detail::resolve_overload_index<U, T...>::value; |
1857 | | this->template emplace<I>( std::forward<U>(u) ); |
1858 | | return *this; |
1859 | | } |
1860 | | |
1861 | | // modifiers |
1862 | | |
1863 | | template<class U, class... A, |
1864 | | class E = typename std::enable_if< mp11::mp_count<variant<T...>, U>::value == 1 && std::is_constructible<U, A&&...>::value >::type> |
1865 | | BOOST_CXX14_CONSTEXPR U& emplace( A&&... a ) |
1866 | | { |
1867 | | using I = mp11::mp_find<variant<T...>, U>; |
1868 | | variant_base::template emplace<I::value>( std::forward<A>(a)... ); |
1869 | | return _get_impl( I() ); |
1870 | | } |
1871 | | |
1872 | | template<class U, class V, class... A, |
1873 | | 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> |
1874 | | BOOST_CXX14_CONSTEXPR U& emplace( std::initializer_list<V> il, A&&... a ) |
1875 | | { |
1876 | | using I = mp11::mp_find<variant<T...>, U>; |
1877 | | variant_base::template emplace<I::value>( il, std::forward<A>(a)... ); |
1878 | | return _get_impl( I() ); |
1879 | | } |
1880 | | |
1881 | | 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> |
1882 | | BOOST_CXX14_CONSTEXPR variant_alternative_t<I, variant<T...>>& emplace( A&&... a ) |
1883 | | { |
1884 | | variant_base::template emplace<I>( std::forward<A>(a)... ); |
1885 | | return _get_impl( mp11::mp_size_t<I>() ); |
1886 | | } |
1887 | | |
1888 | | 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> |
1889 | | BOOST_CXX14_CONSTEXPR variant_alternative_t<I, variant<T...>>& emplace( std::initializer_list<V> il, A&&... a ) |
1890 | | { |
1891 | | variant_base::template emplace<I>( il, std::forward<A>(a)... ); |
1892 | | return _get_impl( mp11::mp_size_t<I>() ); |
1893 | | } |
1894 | | |
1895 | | // value status |
1896 | | |
1897 | | constexpr bool valueless_by_exception() const noexcept |
1898 | | { |
1899 | | return false; |
1900 | | } |
1901 | | |
1902 | | using variant_base::index; |
1903 | | |
1904 | | using variant_base::uses_double_storage; |
1905 | | |
1906 | | // swap |
1907 | | |
1908 | | private: |
1909 | | |
1910 | | struct L5 |
1911 | | { |
1912 | | variant * this_; |
1913 | | variant & r; |
1914 | | |
1915 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1916 | | { |
1917 | | using std::swap; |
1918 | | swap( this_->_get_impl( i ), r._get_impl( i ) ); |
1919 | | } |
1920 | | }; |
1921 | | |
1922 | | public: |
1923 | | |
1924 | | BOOST_CXX14_CONSTEXPR void swap( variant& r ) noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>..., detail::is_nothrow_swappable<T>...>::value ) |
1925 | | { |
1926 | | if( index() == r.index() ) |
1927 | | { |
1928 | | mp11::mp_with_index<sizeof...(T)>( index(), L5{ this, r } ); |
1929 | | } |
1930 | | else |
1931 | | { |
1932 | | variant tmp( std::move(*this) ); |
1933 | | *this = std::move( r ); |
1934 | | r = std::move( tmp ); |
1935 | | } |
1936 | | } |
1937 | | |
1938 | | // private accessors |
1939 | | |
1940 | | using variant_base::_get_impl; |
1941 | | |
1942 | | // converting constructors (extension) |
1943 | | |
1944 | | private: |
1945 | | |
1946 | | template<class... U> struct L6 |
1947 | | { |
1948 | | variant_base * this_; |
1949 | | variant<U...> const & r; |
1950 | | |
1951 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1952 | | { |
1953 | | using J = mp11::mp_find<mp11::mp_list<T...>, mp11::mp_at<mp11::mp_list<U...>, I>>; |
1954 | | this_->_replace( J{}, r._get_impl( i ) ); |
1955 | | } |
1956 | | }; |
1957 | | |
1958 | | public: |
1959 | | |
1960 | | template<class... U, |
1961 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
1962 | | BOOST_CXX14_CONSTEXPR variant( variant<U...> const& r ) |
1963 | | noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<U>...>::value ) |
1964 | | { |
1965 | | mp11::mp_with_index<sizeof...(U)>( r.index(), L6<U...>{ this, r } ); |
1966 | | } |
1967 | | |
1968 | | private: |
1969 | | |
1970 | | template<class... U> struct L7 |
1971 | | { |
1972 | | variant_base * this_; |
1973 | | variant<U...> & r; |
1974 | | |
1975 | | template<class I> BOOST_CXX14_CONSTEXPR void operator()( I i ) const |
1976 | | { |
1977 | | using J = mp11::mp_find<mp11::mp_list<T...>, mp11::mp_at<mp11::mp_list<U...>, I>>; |
1978 | | this_->_replace( J{}, std::move( r._get_impl( i ) ) ); |
1979 | | } |
1980 | | }; |
1981 | | |
1982 | | public: |
1983 | | |
1984 | | template<class... U, |
1985 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_move_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
1986 | | BOOST_CXX14_CONSTEXPR variant( variant<U...> && r ) |
1987 | | noexcept( mp11::mp_all<std::is_nothrow_move_constructible<U>...>::value ) |
1988 | | { |
1989 | | mp11::mp_with_index<sizeof...(U)>( r.index(), L7<U...>{ this, r } ); |
1990 | | } |
1991 | | |
1992 | | // subset (extension) |
1993 | | |
1994 | | private: |
1995 | | |
1996 | | 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 ) |
1997 | | { |
1998 | | return variant<U...>( in_place_index_t<J>(), std::forward<V>(v) ); |
1999 | | } |
2000 | | |
2001 | | template<class... U, class V> static variant<U...> _subset_impl( mp11::mp_size_t<sizeof...(U)>, V && /*v*/ ) |
2002 | | { |
2003 | | detail::throw_bad_variant_access(); |
2004 | | } |
2005 | | |
2006 | | private: |
2007 | | |
2008 | | template<class... U> struct L8 |
2009 | | { |
2010 | | variant * this_; |
2011 | | |
2012 | | template<class I> BOOST_CXX14_CONSTEXPR variant<U...> operator()( I i ) const |
2013 | | { |
2014 | | using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; |
2015 | | return this_->_subset_impl<U...>( J{}, this_->_get_impl( i ) ); |
2016 | | } |
2017 | | }; |
2018 | | |
2019 | | public: |
2020 | | |
2021 | | template<class... U, |
2022 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
2023 | | BOOST_CXX14_CONSTEXPR variant<U...> subset() & |
2024 | | { |
2025 | | return mp11::mp_with_index<sizeof...(T)>( index(), L8<U...>{ this } ); |
2026 | | } |
2027 | | |
2028 | | private: |
2029 | | |
2030 | | template<class... U> struct L9 |
2031 | | { |
2032 | | variant const * this_; |
2033 | | |
2034 | | template<class I> BOOST_CXX14_CONSTEXPR variant<U...> operator()( I i ) const |
2035 | | { |
2036 | | using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; |
2037 | | return this_->_subset_impl<U...>( J{}, this_->_get_impl( i ) ); |
2038 | | } |
2039 | | }; |
2040 | | |
2041 | | public: |
2042 | | |
2043 | | template<class... U, |
2044 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
2045 | | constexpr variant<U...> subset() const& |
2046 | | { |
2047 | | return mp11::mp_with_index<sizeof...(T)>( index(), L9<U...>{ this } ); |
2048 | | } |
2049 | | |
2050 | | private: |
2051 | | |
2052 | | template<class... U> struct L10 |
2053 | | { |
2054 | | variant * this_; |
2055 | | |
2056 | | template<class I> BOOST_CXX14_CONSTEXPR variant<U...> operator()( I i ) const |
2057 | | { |
2058 | | using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; |
2059 | | return this_->_subset_impl<U...>( J{}, std::move( this_->_get_impl( i ) ) ); |
2060 | | } |
2061 | | }; |
2062 | | |
2063 | | public: |
2064 | | |
2065 | | template<class... U, |
2066 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
2067 | | BOOST_CXX14_CONSTEXPR variant<U...> subset() && |
2068 | | { |
2069 | | return mp11::mp_with_index<sizeof...(T)>( index(), L10<U...>{ this } ); |
2070 | | } |
2071 | | |
2072 | | #if !BOOST_WORKAROUND(BOOST_GCC, < 40900) |
2073 | | |
2074 | | // g++ 4.8 doesn't handle const&& particularly well |
2075 | | |
2076 | | private: |
2077 | | |
2078 | | template<class... U> struct L11 |
2079 | | { |
2080 | | variant const * this_; |
2081 | | |
2082 | | template<class I> BOOST_CXX14_CONSTEXPR variant<U...> operator()( I i ) const |
2083 | | { |
2084 | | using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; |
2085 | | return this_->_subset_impl<U...>( J{}, std::move( this_->_get_impl( i ) ) ); |
2086 | | } |
2087 | | }; |
2088 | | |
2089 | | public: |
2090 | | |
2091 | | template<class... U, |
2092 | | class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > |
2093 | | constexpr variant<U...> subset() const&& |
2094 | | { |
2095 | | return mp11::mp_with_index<sizeof...(T)>( index(), L11<U...>{ this } ); |
2096 | | } |
2097 | | |
2098 | | #endif |
2099 | | }; |
2100 | | |
2101 | | // relational operators |
2102 | | |
2103 | | namespace detail |
2104 | | { |
2105 | | |
2106 | | template<class... T> struct eq_L |
2107 | | { |
2108 | | variant<T...> const & v; |
2109 | | variant<T...> const & w; |
2110 | | |
2111 | | template<class I> constexpr bool operator()( I i ) const |
2112 | | { |
2113 | | return v._get_impl( i ) == w._get_impl( i ); |
2114 | | } |
2115 | | }; |
2116 | | |
2117 | | } // namespace detail |
2118 | | |
2119 | | template<class... T> constexpr bool operator==( variant<T...> const & v, variant<T...> const & w ) |
2120 | | { |
2121 | | return v.index() == w.index() && mp11::mp_with_index<sizeof...(T)>( v.index(), detail::eq_L<T...>{ v, w } ); |
2122 | | } |
2123 | | |
2124 | | namespace detail |
2125 | | { |
2126 | | |
2127 | | template<class... T> struct ne_L |
2128 | | { |
2129 | | variant<T...> const & v; |
2130 | | variant<T...> const & w; |
2131 | | |
2132 | | template<class I> constexpr bool operator()( I i ) const |
2133 | | { |
2134 | | return v._get_impl( i ) != w._get_impl( i ); |
2135 | | } |
2136 | | }; |
2137 | | |
2138 | | } // namespace detail |
2139 | | |
2140 | | template<class... T> constexpr bool operator!=( variant<T...> const & v, variant<T...> const & w ) |
2141 | | { |
2142 | | return v.index() != w.index() || mp11::mp_with_index<sizeof...(T)>( v.index(), detail::ne_L<T...>{ v, w } ); |
2143 | | } |
2144 | | |
2145 | | namespace detail |
2146 | | { |
2147 | | |
2148 | | template<class... T> struct lt_L |
2149 | | { |
2150 | | variant<T...> const & v; |
2151 | | variant<T...> const & w; |
2152 | | |
2153 | | template<class I> constexpr bool operator()( I i ) const |
2154 | | { |
2155 | | return v._get_impl( i ) < w._get_impl( i ); |
2156 | | } |
2157 | | }; |
2158 | | |
2159 | | } // namespace detail |
2160 | | |
2161 | | template<class... T> constexpr bool operator<( variant<T...> const & v, variant<T...> const & w ) |
2162 | | { |
2163 | | return v.index() < w.index() || ( v.index() == w.index() && mp11::mp_with_index<sizeof...(T)>( v.index(), detail::lt_L<T...>{ v, w } ) ); |
2164 | | } |
2165 | | |
2166 | | template<class... T> constexpr bool operator>( variant<T...> const & v, variant<T...> const & w ) |
2167 | | { |
2168 | | return w < v; |
2169 | | } |
2170 | | |
2171 | | namespace detail |
2172 | | { |
2173 | | |
2174 | | template<class... T> struct le_L |
2175 | | { |
2176 | | variant<T...> const & v; |
2177 | | variant<T...> const & w; |
2178 | | |
2179 | | template<class I> constexpr bool operator()( I i ) const |
2180 | | { |
2181 | | return v._get_impl( i ) <= w._get_impl( i ); |
2182 | | } |
2183 | | }; |
2184 | | |
2185 | | } // namespace detail |
2186 | | |
2187 | | template<class... T> constexpr bool operator<=( variant<T...> const & v, variant<T...> const & w ) |
2188 | | { |
2189 | | return v.index() < w.index() || ( v.index() == w.index() && mp11::mp_with_index<sizeof...(T)>( v.index(), detail::le_L<T...>{ v, w } ) ); |
2190 | | } |
2191 | | |
2192 | | template<class... T> constexpr bool operator>=( variant<T...> const & v, variant<T...> const & w ) |
2193 | | { |
2194 | | return w <= v; |
2195 | | } |
2196 | | |
2197 | | // visitation |
2198 | | namespace detail |
2199 | | { |
2200 | | |
2201 | | template<class T> using remove_cv_ref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type; |
2202 | | |
2203 | | template<class... T> variant<T...> const & extract_variant_base_( variant<T...> const & ); |
2204 | | |
2205 | | #if BOOST_WORKAROUND( BOOST_MSVC, < 1930 ) |
2206 | | |
2207 | | template<class V> struct extract_vbase_impl |
2208 | | { |
2209 | | using type = decltype( extract_variant_base_( std::declval<V>() ) ); |
2210 | | }; |
2211 | | |
2212 | | template<class V> using extract_variant_base = remove_cv_ref_t< typename extract_vbase_impl<V>::type >; |
2213 | | |
2214 | | #else |
2215 | | |
2216 | | template<class V> using extract_variant_base = remove_cv_ref_t< decltype( extract_variant_base_( std::declval<V>() ) ) >; |
2217 | | |
2218 | | #endif |
2219 | | |
2220 | | template<class V> using variant_base_size = variant_size< extract_variant_base<V> >; |
2221 | | |
2222 | | template<class T, class U> struct copy_cv_ref |
2223 | | { |
2224 | | using type = T; |
2225 | | }; |
2226 | | |
2227 | | template<class T, class U> struct copy_cv_ref<T, U const> |
2228 | | { |
2229 | | using type = T const; |
2230 | | }; |
2231 | | |
2232 | | template<class T, class U> struct copy_cv_ref<T, U volatile> |
2233 | | { |
2234 | | using type = T volatile; |
2235 | | }; |
2236 | | |
2237 | | template<class T, class U> struct copy_cv_ref<T, U const volatile> |
2238 | | { |
2239 | | using type = T const volatile; |
2240 | | }; |
2241 | | |
2242 | | template<class T, class U> struct copy_cv_ref<T, U&> |
2243 | | { |
2244 | | using type = typename copy_cv_ref<T, U>::type&; |
2245 | | }; |
2246 | | |
2247 | | template<class T, class U> struct copy_cv_ref<T, U&&> |
2248 | | { |
2249 | | using type = typename copy_cv_ref<T, U>::type&&; |
2250 | | }; |
2251 | | |
2252 | | template<class T, class U> using copy_cv_ref_t = typename copy_cv_ref<T, U>::type; |
2253 | | |
2254 | | template<class F> struct Qret |
2255 | | { |
2256 | | template<class... T> using fn = decltype( std::declval<F>()( std::declval<T>()... ) ); |
2257 | | }; |
2258 | | |
2259 | | template<class L> using front_if_same = mp11::mp_if<mp11::mp_apply<mp11::mp_same, L>, mp11::mp_front<L>>; |
2260 | | |
2261 | | template<class V> using apply_cv_ref = mp11::mp_product<copy_cv_ref_t, extract_variant_base<V>, mp11::mp_list<V>>; |
2262 | | |
2263 | | struct deduced {}; |
2264 | | |
2265 | | #if !BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) |
2266 | | |
2267 | | 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>...> >; |
2268 | | |
2269 | | #else |
2270 | | |
2271 | | template<class R, class F, class... V> struct Vret_impl |
2272 | | { |
2273 | | 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>...> >; |
2274 | | }; |
2275 | | |
2276 | | template<class R, class F, class... V> using Vret = typename Vret_impl<R, F, V...>::type; |
2277 | | |
2278 | | #endif |
2279 | | |
2280 | | } // namespace detail |
2281 | | |
2282 | | template<class R = detail::deduced, class F> constexpr auto visit( F&& f ) -> detail::Vret<R, F> |
2283 | | { |
2284 | | return std::forward<F>(f)(); |
2285 | | } |
2286 | | |
2287 | | namespace detail |
2288 | | { |
2289 | | |
2290 | | template<class R, class F, class V1> struct visit_L1 |
2291 | | { |
2292 | | F&& f; |
2293 | | V1&& v1; |
2294 | | |
2295 | | template<class I> constexpr auto operator()( I ) const -> Vret<R, F, V1> |
2296 | | { |
2297 | | return std::forward<F>(f)( unsafe_get<I::value>( std::forward<V1>(v1) ) ); |
2298 | | } |
2299 | | }; |
2300 | | |
2301 | | } // namespace detail |
2302 | | |
2303 | | template<class R = detail::deduced, class F, class V1> constexpr auto visit( F&& f, V1&& v1 ) -> detail::Vret<R, F, V1> |
2304 | | { |
2305 | | 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) } ); |
2306 | | } |
2307 | | |
2308 | | #if defined(BOOST_NO_CXX14_GENERIC_LAMBDAS) || BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) |
2309 | | |
2310 | | namespace detail |
2311 | | { |
2312 | | |
2313 | | template<class F, class A> struct bind_front_ |
2314 | | { |
2315 | | F&& f; |
2316 | | A&& a; |
2317 | | |
2318 | | template<class... T> auto operator()( T&&... t ) -> decltype( std::forward<F>(f)( std::forward<A>(a), std::forward<T>(t)... ) ) |
2319 | | { |
2320 | | return std::forward<F>(f)( std::forward<A>(a), std::forward<T>(t)... ); |
2321 | | } |
2322 | | }; |
2323 | | |
2324 | | template<class F, class A> bind_front_<F, A> bind_front( F&& f, A&& a ) |
2325 | | { |
2326 | | return bind_front_<F, A>{ std::forward<F>(f), std::forward<A>(a) }; |
2327 | | } |
2328 | | |
2329 | | template<class R, class F, class V1, class V2> struct visit_L2 |
2330 | | { |
2331 | | F&& f; |
2332 | | |
2333 | | V1&& v1; |
2334 | | V2&& v2; |
2335 | | |
2336 | | template<class I> auto operator()( I ) const -> Vret<R, F, V1, V2> |
2337 | | { |
2338 | | auto f2 = bind_front( std::forward<F>(f), unsafe_get<I::value>( std::forward<V1>(v1) ) ); |
2339 | | return visit<R>( f2, std::forward<V2>(v2) ); |
2340 | | } |
2341 | | }; |
2342 | | |
2343 | | } // namespace detail |
2344 | | |
2345 | | 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> |
2346 | | { |
2347 | | 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) } ); |
2348 | | } |
2349 | | |
2350 | | namespace detail |
2351 | | { |
2352 | | |
2353 | | template<class R, class F, class V1, class V2, class V3> struct visit_L3 |
2354 | | { |
2355 | | F&& f; |
2356 | | |
2357 | | V1&& v1; |
2358 | | V2&& v2; |
2359 | | V3&& v3; |
2360 | | |
2361 | | template<class I> auto operator()( I ) const -> Vret<R, F, V1, V2, V3> |
2362 | | { |
2363 | | auto f2 = bind_front( std::forward<F>(f), unsafe_get<I::value>( std::forward<V1>(v1) ) ); |
2364 | | return visit<R>( f2, std::forward<V2>(v2), std::forward<V3>(v3) ); |
2365 | | } |
2366 | | }; |
2367 | | |
2368 | | } // namespace detail |
2369 | | |
2370 | | 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> |
2371 | | { |
2372 | | 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) } ); |
2373 | | } |
2374 | | |
2375 | | namespace detail |
2376 | | { |
2377 | | |
2378 | | template<class R, class F, class V1, class V2, class V3, class V4> struct visit_L4 |
2379 | | { |
2380 | | F&& f; |
2381 | | |
2382 | | V1&& v1; |
2383 | | V2&& v2; |
2384 | | V3&& v3; |
2385 | | V4&& v4; |
2386 | | |
2387 | | template<class I> auto operator()( I ) const -> Vret<R, F, V1, V2, V3, V4> |
2388 | | { |
2389 | | auto f2 = bind_front( std::forward<F>(f), unsafe_get<I::value>( std::forward<V1>(v1) ) ); |
2390 | | return visit<R>( f2, std::forward<V2>(v2), std::forward<V3>(v3), std::forward<V4>(v4) ); |
2391 | | } |
2392 | | }; |
2393 | | |
2394 | | } // namespace detail |
2395 | | |
2396 | | 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> |
2397 | | { |
2398 | | 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) } ); |
2399 | | } |
2400 | | |
2401 | | #else |
2402 | | |
2403 | | 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...> |
2404 | | { |
2405 | | return mp11::mp_with_index<detail::variant_base_size<V1>>( v1.index(), [&]( auto I ){ |
2406 | | |
2407 | | auto f2 = [&]( auto&&... a ){ return std::forward<F>(f)( unsafe_get<I.value>( std::forward<V1>(v1) ), std::forward<decltype(a)>(a)... ); }; |
2408 | | return visit<R>( f2, std::forward<V2>(v2), std::forward<V>(v)... ); |
2409 | | |
2410 | | }); |
2411 | | } |
2412 | | |
2413 | | #endif |
2414 | | |
2415 | | // specialized algorithms |
2416 | | template<class... T, |
2417 | | class E = typename std::enable_if<mp11::mp_all<std::is_move_constructible<T>..., detail::is_swappable<T>...>::value>::type> |
2418 | | BOOST_CXX14_CONSTEXPR void swap( variant<T...> & v, variant<T...> & w ) |
2419 | | noexcept( noexcept(v.swap(w)) ) |
2420 | | { |
2421 | | v.swap( w ); |
2422 | | } |
2423 | | |
2424 | | // visit_by_index |
2425 | | |
2426 | | namespace detail |
2427 | | { |
2428 | | |
2429 | | 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>> >; |
2430 | | |
2431 | | template<class R, class V, class... F> struct visit_by_index_L |
2432 | | { |
2433 | | V&& v; |
2434 | | std::tuple<F&&...> tp; |
2435 | | |
2436 | | template<class I> constexpr detail::Vret2<R, V, F...> operator()( I ) const |
2437 | | { |
2438 | | return std::get<I::value>( std::move(tp) )( unsafe_get<I::value>( std::forward<V>(v) ) ); |
2439 | | } |
2440 | | }; |
2441 | | |
2442 | | } // namespace detail |
2443 | | |
2444 | | template<class R = detail::deduced, class V, class... F> constexpr auto visit_by_index( V&& v, F&&... f ) -> detail::Vret2<R, V, F...> |
2445 | | { |
2446 | | static_assert( variant_size<V>::value == sizeof...(F), "Incorrect number of function objects" ); |
2447 | | |
2448 | | return mp11::mp_with_index<variant_size<V>::value>( v.index(), |
2449 | | detail::visit_by_index_L<R, V, F...>{ std::forward<V>(v), std::tuple<F&&...>( std::forward<F>(f)... ) } ); |
2450 | | } |
2451 | | |
2452 | | // output streaming |
2453 | | |
2454 | | namespace detail |
2455 | | { |
2456 | | |
2457 | | template<class Ch, class Tr, class... T> struct ostream_insert_L |
2458 | | { |
2459 | | std::basic_ostream<Ch, Tr>& os; |
2460 | | variant<T...> const& v; |
2461 | | |
2462 | | template<class I> std::basic_ostream<Ch, Tr>& operator()( I ) const |
2463 | | { |
2464 | | return os << unsafe_get<I::value>( v ); |
2465 | | } |
2466 | | }; |
2467 | | |
2468 | | template<class Os, class T, class E = void> struct is_output_streamable: std::false_type |
2469 | | { |
2470 | | }; |
2471 | | |
2472 | | template<class Os, class T> struct is_output_streamable<Os, T, decltype( std::declval<Os&>() << std::declval<T const&>(), (void)0 )>: std::true_type |
2473 | | { |
2474 | | }; |
2475 | | |
2476 | | } // namespace detail |
2477 | | |
2478 | | template<class Ch, class Tr> |
2479 | | std::basic_ostream<Ch, Tr>& operator<<( std::basic_ostream<Ch, Tr>& os, monostate const& ) |
2480 | | { |
2481 | | os << "monostate"; |
2482 | | return os; |
2483 | | } |
2484 | | |
2485 | | template<class Ch, class Tr, class T1, class... T, |
2486 | | class E = typename std::enable_if< mp11::mp_all< detail::is_output_streamable<std::basic_ostream<Ch, Tr>, T>... >::value >::type > |
2487 | | std::basic_ostream<Ch, Tr>& operator<<( std::basic_ostream<Ch, Tr>& os, variant<T1, T...> const& v ) |
2488 | | { |
2489 | | return mp11::mp_with_index<1 + sizeof...(T)>( v.index(), |
2490 | | detail::ostream_insert_L<Ch, Tr, T1, T...>{ os, v } ); |
2491 | | } |
2492 | | |
2493 | | // hashing support |
2494 | | |
2495 | | namespace detail |
2496 | | { |
2497 | | |
2498 | | inline std::size_t hash_value_impl_( mp11::mp_true, std::size_t index, std::size_t value ) |
2499 | 0 | { |
2500 | 0 | unsigned long long hv = 0xCBF29CE484222325ull; |
2501 | 0 | unsigned long long const prime = 0x100000001B3ull; |
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 static_cast<std::size_t>( hv ); |
2510 | 0 | } |
2511 | | |
2512 | | inline std::size_t hash_value_impl_( mp11::mp_false, std::size_t index, std::size_t value ) |
2513 | 0 | { |
2514 | 0 | std::size_t hv = 0x811C9DC5; |
2515 | 0 | std::size_t const prime = 0x01000193; |
2516 | 0 |
|
2517 | 0 | hv ^= index; |
2518 | 0 | hv *= prime; |
2519 | 0 |
|
2520 | 0 | hv ^= value; |
2521 | 0 | hv *= prime; |
2522 | 0 |
|
2523 | 0 | return hv; |
2524 | 0 | } |
2525 | | |
2526 | | inline std::size_t hash_value_impl( std::size_t index, std::size_t value ) |
2527 | 0 | { |
2528 | 0 | return hash_value_impl_( mp11::mp_bool< (SIZE_MAX > UINT32_MAX) >(), index, value ); |
2529 | 0 | } |
2530 | | |
2531 | | template<template<class> class H, class V> struct hash_value_L |
2532 | | { |
2533 | | V const & v; |
2534 | | |
2535 | | template<class I> std::size_t operator()( I ) const |
2536 | | { |
2537 | | auto const & t = unsafe_get<I::value>( v ); |
2538 | | |
2539 | | std::size_t index = I::value; |
2540 | | std::size_t value = H<remove_cv_ref_t<decltype(t)>>()( t ); |
2541 | | |
2542 | | return hash_value_impl( index, value ); |
2543 | | } |
2544 | | }; |
2545 | | |
2546 | | template<class... T> std::size_t hash_value_std( variant<T...> const & v ) |
2547 | | { |
2548 | | return mp11::mp_with_index<sizeof...(T)>( v.index(), detail::hash_value_L< std::hash, variant<T...> >{ v } ); |
2549 | | } |
2550 | | |
2551 | | } // namespace detail |
2552 | | |
2553 | | inline std::size_t hash_value( monostate const & ) |
2554 | 0 | { |
2555 | 0 | return 0xA7EE4757u; |
2556 | 0 | } |
2557 | | |
2558 | | template<class... T> std::size_t hash_value( variant<T...> const & v ) |
2559 | | { |
2560 | | return mp11::mp_with_index<sizeof...(T)>( v.index(), detail::hash_value_L< boost::hash, variant<T...> >{ v } ); |
2561 | | } |
2562 | | |
2563 | | namespace detail |
2564 | | { |
2565 | | |
2566 | | template<class T> using is_hash_enabled = std::is_default_constructible< std::hash<typename std::remove_const<T>::type> >; |
2567 | | |
2568 | | template<class V, bool E = mp11::mp_all_of<V, is_hash_enabled>::value> struct std_hash_impl; |
2569 | | |
2570 | | template<class V> struct std_hash_impl<V, false> |
2571 | | { |
2572 | | std_hash_impl() = delete; |
2573 | | std_hash_impl( std_hash_impl const& ) = delete; |
2574 | | std_hash_impl& operator=( std_hash_impl const& ) = delete; |
2575 | | }; |
2576 | | |
2577 | | template<class V> struct std_hash_impl<V, true> |
2578 | | { |
2579 | | std::size_t operator()( V const & v ) const |
2580 | | { |
2581 | | return detail::hash_value_std( v ); |
2582 | | } |
2583 | | }; |
2584 | | |
2585 | | } // namespace detail |
2586 | | |
2587 | | } // namespace variant2 |
2588 | | } // namespace boost |
2589 | | |
2590 | | namespace std |
2591 | | { |
2592 | | |
2593 | | template<class... T> struct hash< ::boost::variant2::variant<T...> >: public ::boost::variant2::detail::std_hash_impl< ::boost::variant2::variant<T...> > |
2594 | | { |
2595 | | }; |
2596 | | |
2597 | | template<> struct hash< ::boost::variant2::monostate > |
2598 | | { |
2599 | | std::size_t operator()( ::boost::variant2::monostate const & v ) const |
2600 | 0 | { |
2601 | 0 | return hash_value( v ); |
2602 | 0 | } |
2603 | | }; |
2604 | | |
2605 | | } // namespace std |
2606 | | |
2607 | | // JSON support |
2608 | | |
2609 | | namespace boost |
2610 | | { |
2611 | | namespace json |
2612 | | { |
2613 | | |
2614 | | class value; |
2615 | | |
2616 | | struct value_from_tag; |
2617 | | |
2618 | | template<class T> |
2619 | | void value_from( T&& t, value& jv ); |
2620 | | |
2621 | | template<class T> |
2622 | | struct try_value_to_tag; |
2623 | | |
2624 | | template<class T1, class T2> |
2625 | | struct result_for; |
2626 | | |
2627 | | template<class T> |
2628 | | typename result_for<T, value>::type |
2629 | | try_value_to( value const & jv ); |
2630 | | |
2631 | | template<class T> |
2632 | | typename result_for<T, value>::type |
2633 | | result_from_errno( int e, boost::source_location const* loc ) noexcept; |
2634 | | |
2635 | | template<class T> struct is_null_like; |
2636 | | |
2637 | | template<> struct is_null_like<variant2::monostate>: std::true_type {}; |
2638 | | |
2639 | | } // namespace json |
2640 | | |
2641 | | namespace variant2 |
2642 | | { |
2643 | | |
2644 | | namespace detail |
2645 | | { |
2646 | | |
2647 | | struct tag_invoke_L1 |
2648 | | { |
2649 | | boost::json::value& v; |
2650 | | |
2651 | | #if defined(BOOST_MSVC) && BOOST_MSVC / 10 == 191 |
2652 | | // msvc-14.1 with /permissive- needs this |
2653 | | explicit tag_invoke_L1( boost::json::value& v_ ): v( v_ ) {} |
2654 | | #endif |
2655 | | |
2656 | | template<class T> void operator()( T const& t ) const |
2657 | | { |
2658 | | boost::json::value_from( t, v ); |
2659 | | } |
2660 | | }; |
2661 | | |
2662 | | } // namespace detail |
2663 | | |
2664 | | template<class... T> |
2665 | | void tag_invoke( boost::json::value_from_tag const&, boost::json::value& v, variant<T...> const & w ) |
2666 | | { |
2667 | | visit( detail::tag_invoke_L1{ v }, w ); |
2668 | | } |
2669 | | |
2670 | | namespace detail |
2671 | | { |
2672 | | |
2673 | | template<class V> struct tag_invoke_L2 |
2674 | | { |
2675 | | boost::json::value const& v; |
2676 | | typename boost::json::result_for<V, boost::json::value>::type& r; |
2677 | | |
2678 | | template<class I> void operator()( I /*i*/ ) const |
2679 | | { |
2680 | | if( !r ) |
2681 | | { |
2682 | | using Ti = mp11::mp_at_c<V, I::value>; |
2683 | | auto r2 = boost::json::try_value_to<Ti>( v ); |
2684 | | |
2685 | | if( r2 ) |
2686 | | { |
2687 | | r.emplace( in_place_index_t<I::value>{}, std::move( *r2 ) ); |
2688 | | } |
2689 | | } |
2690 | | } |
2691 | | }; |
2692 | | |
2693 | | } // namespace detail |
2694 | | |
2695 | | template<class... T> |
2696 | | typename boost::json::result_for<variant<T...>, boost::json::value>::type |
2697 | | tag_invoke( boost::json::try_value_to_tag<variant<T...>> const&, boost::json::value const& v ) |
2698 | | { |
2699 | | static constexpr boost::source_location loc = BOOST_CURRENT_LOCATION; |
2700 | | auto r = boost::json::result_from_errno< variant<T...> >( EINVAL, &loc ); |
2701 | | |
2702 | | mp11::mp_for_each<mp11::mp_iota_c<sizeof...(T)>>( detail::tag_invoke_L2< variant<T...> >{ v, r } ); |
2703 | | |
2704 | | return r; |
2705 | | } |
2706 | | |
2707 | | } // namespace variant2 |
2708 | | } // namespace boost |
2709 | | |
2710 | | #undef BOOST_VARIANT2_CX14_ASSERT |
2711 | | |
2712 | | #if defined(_MSC_VER) && _MSC_VER < 1910 |
2713 | | # pragma warning( pop ) |
2714 | | #endif |
2715 | | |
2716 | | #endif // #ifndef BOOST_VARIANT2_VARIANT_HPP_INCLUDED |