30 #ifndef INCLUDE_NLOHMANN_JSON_HPP_
31 #define INCLUDE_NLOHMANN_JSON_HPP_
33 #define NLOHMANN_JSON_VERSION_MAJOR 3
34 #define NLOHMANN_JSON_VERSION_MINOR 10
35 #define NLOHMANN_JSON_VERSION_PATCH 0
40 #include <initializer_list>
54 #include <type_traits>
62 #include <forward_list>
67 #include <type_traits>
68 #include <unordered_map>
149 static constexpr std::array<std::uint8_t, 9> order = {{
156 const auto l_index =
static_cast<std::size_t
>(lhs);
157 const auto r_index =
static_cast<std::size_t
>(rhs);
158 return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index];
186 #if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15)
187 #if defined(JSON_HEDLEY_VERSION)
188 #undef JSON_HEDLEY_VERSION
190 #define JSON_HEDLEY_VERSION 15
192 #if defined(JSON_HEDLEY_STRINGIFY_EX)
193 #undef JSON_HEDLEY_STRINGIFY_EX
195 #define JSON_HEDLEY_STRINGIFY_EX(x) #x
197 #if defined(JSON_HEDLEY_STRINGIFY)
198 #undef JSON_HEDLEY_STRINGIFY
200 #define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x)
202 #if defined(JSON_HEDLEY_CONCAT_EX)
203 #undef JSON_HEDLEY_CONCAT_EX
205 #define JSON_HEDLEY_CONCAT_EX(a,b) a##b
207 #if defined(JSON_HEDLEY_CONCAT)
208 #undef JSON_HEDLEY_CONCAT
210 #define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b)
212 #if defined(JSON_HEDLEY_CONCAT3_EX)
213 #undef JSON_HEDLEY_CONCAT3_EX
215 #define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c
217 #if defined(JSON_HEDLEY_CONCAT3)
218 #undef JSON_HEDLEY_CONCAT3
220 #define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c)
222 #if defined(JSON_HEDLEY_VERSION_ENCODE)
223 #undef JSON_HEDLEY_VERSION_ENCODE
225 #define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision))
227 #if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR)
228 #undef JSON_HEDLEY_VERSION_DECODE_MAJOR
230 #define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000)
232 #if defined(JSON_HEDLEY_VERSION_DECODE_MINOR)
233 #undef JSON_HEDLEY_VERSION_DECODE_MINOR
235 #define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000)
237 #if defined(JSON_HEDLEY_VERSION_DECODE_REVISION)
238 #undef JSON_HEDLEY_VERSION_DECODE_REVISION
240 #define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000)
242 #if defined(JSON_HEDLEY_GNUC_VERSION)
243 #undef JSON_HEDLEY_GNUC_VERSION
245 #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)
246 #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
247 #elif defined(__GNUC__)
248 #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0)
251 #if defined(JSON_HEDLEY_GNUC_VERSION_CHECK)
252 #undef JSON_HEDLEY_GNUC_VERSION_CHECK
254 #if defined(JSON_HEDLEY_GNUC_VERSION)
255 #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
257 #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0)
260 #if defined(JSON_HEDLEY_MSVC_VERSION)
261 #undef JSON_HEDLEY_MSVC_VERSION
263 #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL)
264 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100)
265 #elif defined(_MSC_FULL_VER) && !defined(__ICL)
266 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10)
267 #elif defined(_MSC_VER) && !defined(__ICL)
268 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0)
271 #if defined(JSON_HEDLEY_MSVC_VERSION_CHECK)
272 #undef JSON_HEDLEY_MSVC_VERSION_CHECK
274 #if !defined(JSON_HEDLEY_MSVC_VERSION)
275 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0)
276 #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
277 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
278 #elif defined(_MSC_VER) && (_MSC_VER >= 1200)
279 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))
281 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor)))
284 #if defined(JSON_HEDLEY_INTEL_VERSION)
285 #undef JSON_HEDLEY_INTEL_VERSION
287 #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL)
288 #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE)
289 #elif defined(__INTEL_COMPILER) && !defined(__ICL)
290 #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
293 #if defined(JSON_HEDLEY_INTEL_VERSION_CHECK)
294 #undef JSON_HEDLEY_INTEL_VERSION_CHECK
296 #if defined(JSON_HEDLEY_INTEL_VERSION)
297 #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
299 #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0)
302 #if defined(JSON_HEDLEY_INTEL_CL_VERSION)
303 #undef JSON_HEDLEY_INTEL_CL_VERSION
305 #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL)
306 #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0)
309 #if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK)
310 #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK
312 #if defined(JSON_HEDLEY_INTEL_CL_VERSION)
313 #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
315 #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0)
318 #if defined(JSON_HEDLEY_PGI_VERSION)
319 #undef JSON_HEDLEY_PGI_VERSION
321 #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)
322 #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)
325 #if defined(JSON_HEDLEY_PGI_VERSION_CHECK)
326 #undef JSON_HEDLEY_PGI_VERSION_CHECK
328 #if defined(JSON_HEDLEY_PGI_VERSION)
329 #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
331 #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0)
334 #if defined(JSON_HEDLEY_SUNPRO_VERSION)
335 #undef JSON_HEDLEY_SUNPRO_VERSION
337 #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)
338 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10)
339 #elif defined(__SUNPRO_C)
340 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf)
341 #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)
342 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10)
343 #elif defined(__SUNPRO_CC)
344 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf)
347 #if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK)
348 #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK
350 #if defined(JSON_HEDLEY_SUNPRO_VERSION)
351 #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
353 #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0)
356 #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION)
357 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION
359 #if defined(__EMSCRIPTEN__)
360 #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__)
363 #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK)
364 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK
366 #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION)
367 #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
369 #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0)
372 #if defined(JSON_HEDLEY_ARM_VERSION)
373 #undef JSON_HEDLEY_ARM_VERSION
375 #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
376 #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100)
377 #elif defined(__CC_ARM) && defined(__ARMCC_VERSION)
378 #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100)
381 #if defined(JSON_HEDLEY_ARM_VERSION_CHECK)
382 #undef JSON_HEDLEY_ARM_VERSION_CHECK
384 #if defined(JSON_HEDLEY_ARM_VERSION)
385 #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
387 #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0)
390 #if defined(JSON_HEDLEY_IBM_VERSION)
391 #undef JSON_HEDLEY_IBM_VERSION
393 #if defined(__ibmxl__)
394 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__)
395 #elif defined(__xlC__) && defined(__xlC_ver__)
396 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff)
397 #elif defined(__xlC__)
398 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0)
401 #if defined(JSON_HEDLEY_IBM_VERSION_CHECK)
402 #undef JSON_HEDLEY_IBM_VERSION_CHECK
404 #if defined(JSON_HEDLEY_IBM_VERSION)
405 #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
407 #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0)
410 #if defined(JSON_HEDLEY_TI_VERSION)
411 #undef JSON_HEDLEY_TI_VERSION
414 defined(__TI_COMPILER_VERSION__) && \
416 defined(__TMS470__) || defined(__TI_ARM__) || \
417 defined(__MSP430__) || \
418 defined(__TMS320C2000__) \
420 #if (__TI_COMPILER_VERSION__ >= 16000000)
421 #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
425 #if defined(JSON_HEDLEY_TI_VERSION_CHECK)
426 #undef JSON_HEDLEY_TI_VERSION_CHECK
428 #if defined(JSON_HEDLEY_TI_VERSION)
429 #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
431 #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0)
434 #if defined(JSON_HEDLEY_TI_CL2000_VERSION)
435 #undef JSON_HEDLEY_TI_CL2000_VERSION
437 #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__)
438 #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
441 #if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK)
442 #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK
444 #if defined(JSON_HEDLEY_TI_CL2000_VERSION)
445 #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
447 #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0)
450 #if defined(JSON_HEDLEY_TI_CL430_VERSION)
451 #undef JSON_HEDLEY_TI_CL430_VERSION
453 #if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__)
454 #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
457 #if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK)
458 #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK
460 #if defined(JSON_HEDLEY_TI_CL430_VERSION)
461 #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
463 #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0)
466 #if defined(JSON_HEDLEY_TI_ARMCL_VERSION)
467 #undef JSON_HEDLEY_TI_ARMCL_VERSION
469 #if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__))
470 #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
473 #if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK)
474 #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK
476 #if defined(JSON_HEDLEY_TI_ARMCL_VERSION)
477 #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
479 #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0)
482 #if defined(JSON_HEDLEY_TI_CL6X_VERSION)
483 #undef JSON_HEDLEY_TI_CL6X_VERSION
485 #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__)
486 #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
489 #if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK)
490 #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK
492 #if defined(JSON_HEDLEY_TI_CL6X_VERSION)
493 #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
495 #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0)
498 #if defined(JSON_HEDLEY_TI_CL7X_VERSION)
499 #undef JSON_HEDLEY_TI_CL7X_VERSION
501 #if defined(__TI_COMPILER_VERSION__) && defined(__C7000__)
502 #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
505 #if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK)
506 #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK
508 #if defined(JSON_HEDLEY_TI_CL7X_VERSION)
509 #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
511 #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0)
514 #if defined(JSON_HEDLEY_TI_CLPRU_VERSION)
515 #undef JSON_HEDLEY_TI_CLPRU_VERSION
517 #if defined(__TI_COMPILER_VERSION__) && defined(__PRU__)
518 #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
521 #if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK)
522 #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK
524 #if defined(JSON_HEDLEY_TI_CLPRU_VERSION)
525 #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
527 #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0)
530 #if defined(JSON_HEDLEY_CRAY_VERSION)
531 #undef JSON_HEDLEY_CRAY_VERSION
534 #if defined(_RELEASE_PATCHLEVEL)
535 #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL)
537 #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0)
541 #if defined(JSON_HEDLEY_CRAY_VERSION_CHECK)
542 #undef JSON_HEDLEY_CRAY_VERSION_CHECK
544 #if defined(JSON_HEDLEY_CRAY_VERSION)
545 #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
547 #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0)
550 #if defined(JSON_HEDLEY_IAR_VERSION)
551 #undef JSON_HEDLEY_IAR_VERSION
553 #if defined(__IAR_SYSTEMS_ICC__)
555 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000))
557 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0)
561 #if defined(JSON_HEDLEY_IAR_VERSION_CHECK)
562 #undef JSON_HEDLEY_IAR_VERSION_CHECK
564 #if defined(JSON_HEDLEY_IAR_VERSION)
565 #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
567 #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0)
570 #if defined(JSON_HEDLEY_TINYC_VERSION)
571 #undef JSON_HEDLEY_TINYC_VERSION
573 #if defined(__TINYC__)
574 #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100)
577 #if defined(JSON_HEDLEY_TINYC_VERSION_CHECK)
578 #undef JSON_HEDLEY_TINYC_VERSION_CHECK
580 #if defined(JSON_HEDLEY_TINYC_VERSION)
581 #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
583 #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0)
586 #if defined(JSON_HEDLEY_DMC_VERSION)
587 #undef JSON_HEDLEY_DMC_VERSION
590 #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf)
593 #if defined(JSON_HEDLEY_DMC_VERSION_CHECK)
594 #undef JSON_HEDLEY_DMC_VERSION_CHECK
596 #if defined(JSON_HEDLEY_DMC_VERSION)
597 #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
599 #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0)
602 #if defined(JSON_HEDLEY_COMPCERT_VERSION)
603 #undef JSON_HEDLEY_COMPCERT_VERSION
605 #if defined(__COMPCERT_VERSION__)
606 #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100)
609 #if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK)
610 #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK
612 #if defined(JSON_HEDLEY_COMPCERT_VERSION)
613 #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
615 #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0)
618 #if defined(JSON_HEDLEY_PELLES_VERSION)
619 #undef JSON_HEDLEY_PELLES_VERSION
621 #if defined(__POCC__)
622 #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0)
625 #if defined(JSON_HEDLEY_PELLES_VERSION_CHECK)
626 #undef JSON_HEDLEY_PELLES_VERSION_CHECK
628 #if defined(JSON_HEDLEY_PELLES_VERSION)
629 #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
631 #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0)
634 #if defined(JSON_HEDLEY_MCST_LCC_VERSION)
635 #undef JSON_HEDLEY_MCST_LCC_VERSION
637 #if defined(__LCC__) && defined(__LCC_MINOR__)
638 #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__)
641 #if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK)
642 #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK
644 #if defined(JSON_HEDLEY_MCST_LCC_VERSION)
645 #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
647 #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0)
650 #if defined(JSON_HEDLEY_GCC_VERSION)
651 #undef JSON_HEDLEY_GCC_VERSION
654 defined(JSON_HEDLEY_GNUC_VERSION) && \
655 !defined(__clang__) && \
656 !defined(JSON_HEDLEY_INTEL_VERSION) && \
657 !defined(JSON_HEDLEY_PGI_VERSION) && \
658 !defined(JSON_HEDLEY_ARM_VERSION) && \
659 !defined(JSON_HEDLEY_CRAY_VERSION) && \
660 !defined(JSON_HEDLEY_TI_VERSION) && \
661 !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \
662 !defined(JSON_HEDLEY_TI_CL430_VERSION) && \
663 !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \
664 !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \
665 !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \
666 !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \
667 !defined(__COMPCERT__) && \
668 !defined(JSON_HEDLEY_MCST_LCC_VERSION)
669 #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION
672 #if defined(JSON_HEDLEY_GCC_VERSION_CHECK)
673 #undef JSON_HEDLEY_GCC_VERSION_CHECK
675 #if defined(JSON_HEDLEY_GCC_VERSION)
676 #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
678 #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0)
681 #if defined(JSON_HEDLEY_HAS_ATTRIBUTE)
682 #undef JSON_HEDLEY_HAS_ATTRIBUTE
685 defined(__has_attribute) && \
687 (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \
689 # define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute)
691 # define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0)
694 #if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE)
695 #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE
697 #if defined(__has_attribute)
698 #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)
700 #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
703 #if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE)
704 #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE
706 #if defined(__has_attribute)
707 #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)
709 #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
712 #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE)
713 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE
716 defined(__has_cpp_attribute) && \
717 defined(__cplusplus) && \
718 (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0))
719 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute)
721 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0)
724 #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS)
725 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS
727 #if !defined(__cplusplus) || !defined(__has_cpp_attribute)
728 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0)
730 !defined(JSON_HEDLEY_PGI_VERSION) && \
731 !defined(JSON_HEDLEY_IAR_VERSION) && \
732 (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \
733 (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0))
734 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute)
736 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0)
739 #if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE)
740 #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
742 #if defined(__has_cpp_attribute) && defined(__cplusplus)
743 #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute)
745 #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
748 #if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE)
749 #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE
751 #if defined(__has_cpp_attribute) && defined(__cplusplus)
752 #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute)
754 #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
757 #if defined(JSON_HEDLEY_HAS_BUILTIN)
758 #undef JSON_HEDLEY_HAS_BUILTIN
760 #if defined(__has_builtin)
761 #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin)
763 #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0)
766 #if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN)
767 #undef JSON_HEDLEY_GNUC_HAS_BUILTIN
769 #if defined(__has_builtin)
770 #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin)
772 #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
775 #if defined(JSON_HEDLEY_GCC_HAS_BUILTIN)
776 #undef JSON_HEDLEY_GCC_HAS_BUILTIN
778 #if defined(__has_builtin)
779 #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin)
781 #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
784 #if defined(JSON_HEDLEY_HAS_FEATURE)
785 #undef JSON_HEDLEY_HAS_FEATURE
787 #if defined(__has_feature)
788 #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature)
790 #define JSON_HEDLEY_HAS_FEATURE(feature) (0)
793 #if defined(JSON_HEDLEY_GNUC_HAS_FEATURE)
794 #undef JSON_HEDLEY_GNUC_HAS_FEATURE
796 #if defined(__has_feature)
797 #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature)
799 #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
802 #if defined(JSON_HEDLEY_GCC_HAS_FEATURE)
803 #undef JSON_HEDLEY_GCC_HAS_FEATURE
805 #if defined(__has_feature)
806 #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature)
808 #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
811 #if defined(JSON_HEDLEY_HAS_EXTENSION)
812 #undef JSON_HEDLEY_HAS_EXTENSION
814 #if defined(__has_extension)
815 #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension)
817 #define JSON_HEDLEY_HAS_EXTENSION(extension) (0)
820 #if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION)
821 #undef JSON_HEDLEY_GNUC_HAS_EXTENSION
823 #if defined(__has_extension)
824 #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension)
826 #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
829 #if defined(JSON_HEDLEY_GCC_HAS_EXTENSION)
830 #undef JSON_HEDLEY_GCC_HAS_EXTENSION
832 #if defined(__has_extension)
833 #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension)
835 #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
838 #if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE)
839 #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE
841 #if defined(__has_declspec_attribute)
842 #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute)
844 #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0)
847 #if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE)
848 #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
850 #if defined(__has_declspec_attribute)
851 #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute)
853 #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
856 #if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE)
857 #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
859 #if defined(__has_declspec_attribute)
860 #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute)
862 #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
865 #if defined(JSON_HEDLEY_HAS_WARNING)
866 #undef JSON_HEDLEY_HAS_WARNING
868 #if defined(__has_warning)
869 #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning)
871 #define JSON_HEDLEY_HAS_WARNING(warning) (0)
874 #if defined(JSON_HEDLEY_GNUC_HAS_WARNING)
875 #undef JSON_HEDLEY_GNUC_HAS_WARNING
877 #if defined(__has_warning)
878 #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning)
880 #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
883 #if defined(JSON_HEDLEY_GCC_HAS_WARNING)
884 #undef JSON_HEDLEY_GCC_HAS_WARNING
886 #if defined(__has_warning)
887 #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning)
889 #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
893 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
894 defined(__clang__) || \
895 JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
896 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
897 JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \
898 JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
899 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
900 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
901 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \
902 JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \
903 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \
904 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \
905 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
906 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
907 JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \
908 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \
909 JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \
910 (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR))
911 #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value)
912 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
913 #define JSON_HEDLEY_PRAGMA(value) __pragma(value)
915 #define JSON_HEDLEY_PRAGMA(value)
918 #if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH)
919 #undef JSON_HEDLEY_DIAGNOSTIC_PUSH
921 #if defined(JSON_HEDLEY_DIAGNOSTIC_POP)
922 #undef JSON_HEDLEY_DIAGNOSTIC_POP
924 #if defined(__clang__)
925 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
926 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
927 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
928 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
929 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
930 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)
931 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
932 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
934 JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \
935 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
936 #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push))
937 #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop))
938 #elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0)
939 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push")
940 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop")
942 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
943 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
944 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \
945 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \
946 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
947 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
948 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push")
949 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop")
950 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)
951 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
952 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
954 #define JSON_HEDLEY_DIAGNOSTIC_PUSH
955 #define JSON_HEDLEY_DIAGNOSTIC_POP
960 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
961 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_
963 #if defined(__cplusplus)
964 # if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat")
965 # if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions")
966 # if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions")
967 # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
968 JSON_HEDLEY_DIAGNOSTIC_PUSH \
969 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
970 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
971 _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \
973 JSON_HEDLEY_DIAGNOSTIC_POP
975 # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
976 JSON_HEDLEY_DIAGNOSTIC_PUSH \
977 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
978 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
980 JSON_HEDLEY_DIAGNOSTIC_POP
983 # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
984 JSON_HEDLEY_DIAGNOSTIC_PUSH \
985 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
987 JSON_HEDLEY_DIAGNOSTIC_POP
991 #if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
992 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x
995 #if defined(JSON_HEDLEY_CONST_CAST)
996 #undef JSON_HEDLEY_CONST_CAST
998 #if defined(__cplusplus)
999 # define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast<T>(expr))
1001 JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \
1002 JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \
1003 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1004 # define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \
1005 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1006 JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \
1008 JSON_HEDLEY_DIAGNOSTIC_POP \
1011 # define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr))
1014 #if defined(JSON_HEDLEY_REINTERPRET_CAST)
1015 #undef JSON_HEDLEY_REINTERPRET_CAST
1017 #if defined(__cplusplus)
1018 #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast<T>(expr))
1020 #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr))
1023 #if defined(JSON_HEDLEY_STATIC_CAST)
1024 #undef JSON_HEDLEY_STATIC_CAST
1026 #if defined(__cplusplus)
1027 #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast<T>(expr))
1029 #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr))
1032 #if defined(JSON_HEDLEY_CPP_CAST)
1033 #undef JSON_HEDLEY_CPP_CAST
1035 #if defined(__cplusplus)
1036 # if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast")
1037 # define JSON_HEDLEY_CPP_CAST(T, expr) \
1038 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1039 _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \
1041 JSON_HEDLEY_DIAGNOSTIC_POP
1042 # elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0)
1043 # define JSON_HEDLEY_CPP_CAST(T, expr) \
1044 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1045 _Pragma("diag_suppress=Pe137") \
1046 JSON_HEDLEY_DIAGNOSTIC_POP
1048 # define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr))
1051 # define JSON_HEDLEY_CPP_CAST(T, expr) (expr)
1054 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED)
1055 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
1057 #if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations")
1058 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
1059 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1060 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)")
1061 #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1062 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786))
1063 #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0)
1064 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445")
1065 #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
1066 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
1067 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)
1068 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
1069 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
1070 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996))
1071 #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1072 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
1074 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1075 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1076 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1077 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1078 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1079 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1080 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1081 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1082 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1083 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1084 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
1085 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718")
1086 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus)
1087 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)")
1088 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus)
1089 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)")
1090 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1091 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215")
1092 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)
1093 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)")
1095 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
1098 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS)
1099 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
1101 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
1102 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"")
1103 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1104 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)")
1105 #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1106 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161))
1107 #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
1108 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675")
1109 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)
1110 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"")
1111 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
1112 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068))
1114 JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \
1115 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \
1116 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1117 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0)
1118 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
1119 #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0)
1120 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
1121 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1122 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161")
1123 #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1124 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161")
1126 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
1129 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES)
1130 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
1132 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes")
1133 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"")
1134 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)
1135 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
1136 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0)
1137 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)")
1138 #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1139 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292))
1140 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0)
1141 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030))
1142 #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0)
1143 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098")
1144 #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
1145 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097")
1146 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)
1147 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)")
1149 JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \
1150 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \
1151 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0)
1152 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173")
1153 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1154 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097")
1155 #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1156 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097")
1158 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
1161 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL)
1162 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
1164 #if JSON_HEDLEY_HAS_WARNING("-Wcast-qual")
1165 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"")
1166 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1167 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)")
1168 #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0)
1169 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
1171 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
1174 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION)
1175 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION
1177 #if JSON_HEDLEY_HAS_WARNING("-Wunused-function")
1178 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"")
1179 #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0)
1180 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"")
1181 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0)
1182 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505))
1183 #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1184 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142")
1186 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION
1189 #if defined(JSON_HEDLEY_DEPRECATED)
1190 #undef JSON_HEDLEY_DEPRECATED
1192 #if defined(JSON_HEDLEY_DEPRECATED_FOR)
1193 #undef JSON_HEDLEY_DEPRECATED_FOR
1196 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
1197 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1198 #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since))
1199 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement))
1201 (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \
1202 JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \
1203 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1204 JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \
1205 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \
1206 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1207 JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \
1208 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \
1209 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \
1210 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1211 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \
1212 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1213 #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since)))
1214 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement)))
1215 #elif defined(__cplusplus) && (__cplusplus >= 201402L)
1216 #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]])
1217 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]])
1219 JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \
1220 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1221 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1222 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1223 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1224 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1225 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1226 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1227 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1228 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1229 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1230 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1231 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1232 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1233 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \
1234 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1235 #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__))
1236 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__))
1238 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1239 JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \
1240 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1241 #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated)
1242 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated)
1243 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1244 #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated")
1245 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated")
1247 #define JSON_HEDLEY_DEPRECATED(since)
1248 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement)
1251 #if defined(JSON_HEDLEY_UNAVAILABLE)
1252 #undef JSON_HEDLEY_UNAVAILABLE
1255 JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \
1256 JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \
1257 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1258 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1259 #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since)))
1261 #define JSON_HEDLEY_UNAVAILABLE(available_since)
1264 #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT)
1265 #undef JSON_HEDLEY_WARN_UNUSED_RESULT
1267 #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG)
1268 #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG
1271 JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \
1272 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
1273 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1274 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1275 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1276 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1277 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1278 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1279 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1280 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1281 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1282 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1283 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1284 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1285 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \
1286 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1287 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1288 #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
1289 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__))
1290 #elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L)
1291 #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1292 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]])
1293 #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard)
1294 #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1295 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1296 #elif defined(_Check_return_)
1297 #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_
1298 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_
1300 #define JSON_HEDLEY_WARN_UNUSED_RESULT
1301 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg)
1304 #if defined(JSON_HEDLEY_SENTINEL)
1305 #undef JSON_HEDLEY_SENTINEL
1308 JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \
1309 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
1310 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1311 JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \
1312 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1313 #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position)))
1315 #define JSON_HEDLEY_SENTINEL(position)
1318 #if defined(JSON_HEDLEY_NO_RETURN)
1319 #undef JSON_HEDLEY_NO_RETURN
1321 #if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1322 #define JSON_HEDLEY_NO_RETURN __noreturn
1324 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1325 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1326 #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))
1327 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
1328 #define JSON_HEDLEY_NO_RETURN _Noreturn
1329 #elif defined(__cplusplus) && (__cplusplus >= 201103L)
1330 #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]])
1332 JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \
1333 JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \
1334 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1335 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1336 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1337 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1338 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1339 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1340 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1341 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1342 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1343 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1344 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1345 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1346 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1347 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1348 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1349 #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))
1350 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1351 #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return")
1353 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1354 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1355 #define JSON_HEDLEY_NO_RETURN __declspec(noreturn)
1356 #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)
1357 #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;")
1358 #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0)
1359 #define JSON_HEDLEY_NO_RETURN __attribute((noreturn))
1360 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0)
1361 #define JSON_HEDLEY_NO_RETURN __declspec(noreturn)
1363 #define JSON_HEDLEY_NO_RETURN
1366 #if defined(JSON_HEDLEY_NO_ESCAPE)
1367 #undef JSON_HEDLEY_NO_ESCAPE
1369 #if JSON_HEDLEY_HAS_ATTRIBUTE(noescape)
1370 #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__))
1372 #define JSON_HEDLEY_NO_ESCAPE
1375 #if defined(JSON_HEDLEY_UNREACHABLE)
1376 #undef JSON_HEDLEY_UNREACHABLE
1378 #if defined(JSON_HEDLEY_UNREACHABLE_RETURN)
1379 #undef JSON_HEDLEY_UNREACHABLE_RETURN
1381 #if defined(JSON_HEDLEY_ASSUME)
1382 #undef JSON_HEDLEY_ASSUME
1385 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1386 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1387 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1388 #define JSON_HEDLEY_ASSUME(expr) __assume(expr)
1389 #elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume)
1390 #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr)
1392 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
1393 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0)
1394 #if defined(__cplusplus)
1395 #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr)
1397 #define JSON_HEDLEY_ASSUME(expr) _nassert(expr)
1401 (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \
1402 JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \
1403 JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \
1404 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1405 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \
1406 JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \
1407 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1408 #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable()
1409 #elif defined(JSON_HEDLEY_ASSUME)
1410 #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0)
1412 #if !defined(JSON_HEDLEY_ASSUME)
1413 #if defined(JSON_HEDLEY_UNREACHABLE)
1414 #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1)))
1416 #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr)
1419 #if defined(JSON_HEDLEY_UNREACHABLE)
1421 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
1422 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0)
1423 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value))
1425 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE()
1428 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value)
1430 #if !defined(JSON_HEDLEY_UNREACHABLE)
1431 #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0)
1435 #if JSON_HEDLEY_HAS_WARNING("-Wpedantic")
1436 #pragma clang diagnostic ignored "-Wpedantic"
1438 #if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus)
1439 #pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
1441 #if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0)
1442 #if defined(__clang__)
1443 #pragma clang diagnostic ignored "-Wvariadic-macros"
1444 #elif defined(JSON_HEDLEY_GCC_VERSION)
1445 #pragma GCC diagnostic ignored "-Wvariadic-macros"
1448 #if defined(JSON_HEDLEY_NON_NULL)
1449 #undef JSON_HEDLEY_NON_NULL
1452 JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \
1453 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
1454 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1455 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)
1456 #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
1458 #define JSON_HEDLEY_NON_NULL(...)
1462 #if defined(JSON_HEDLEY_PRINTF_FORMAT)
1463 #undef JSON_HEDLEY_PRINTF_FORMAT
1465 #if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO)
1466 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check)))
1467 #elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO)
1468 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check)))
1470 JSON_HEDLEY_HAS_ATTRIBUTE(format) || \
1471 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1472 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1473 JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \
1474 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1475 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1476 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1477 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1478 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1479 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1480 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1481 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1482 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1483 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1484 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1485 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1486 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1487 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check)))
1488 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0)
1489 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check))
1491 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check)
1494 #if defined(JSON_HEDLEY_CONSTEXPR)
1495 #undef JSON_HEDLEY_CONSTEXPR
1497 #if defined(__cplusplus)
1498 #if __cplusplus >= 201103L
1499 #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr)
1502 #if !defined(JSON_HEDLEY_CONSTEXPR)
1503 #define JSON_HEDLEY_CONSTEXPR
1506 #if defined(JSON_HEDLEY_PREDICT)
1507 #undef JSON_HEDLEY_PREDICT
1509 #if defined(JSON_HEDLEY_LIKELY)
1510 #undef JSON_HEDLEY_LIKELY
1512 #if defined(JSON_HEDLEY_UNLIKELY)
1513 #undef JSON_HEDLEY_UNLIKELY
1515 #if defined(JSON_HEDLEY_UNPREDICTABLE)
1516 #undef JSON_HEDLEY_UNPREDICTABLE
1518 #if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable)
1519 #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr))
1522 (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \
1523 JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \
1524 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1525 # define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability))
1526 # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability))
1527 # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability))
1528 # define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 )
1529 # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 )
1531 (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \
1532 JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
1533 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1534 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \
1535 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1536 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1537 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1538 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \
1539 JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \
1540 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \
1541 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
1542 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1543 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1544 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \
1545 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
1546 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1547 # define JSON_HEDLEY_PREDICT(expr, expected, probability) \
1548 (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)))
1549 # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \
1551 double hedley_probability_ = (probability); \
1552 ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \
1554 # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \
1556 double hedley_probability_ = (probability); \
1557 ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \
1559 # define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1)
1560 # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
1562 # define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))
1563 # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr))
1564 # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr))
1565 # define JSON_HEDLEY_LIKELY(expr) (!!(expr))
1566 # define JSON_HEDLEY_UNLIKELY(expr) (!!(expr))
1568 #if !defined(JSON_HEDLEY_UNPREDICTABLE)
1569 #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5)
1572 #if defined(JSON_HEDLEY_MALLOC)
1573 #undef JSON_HEDLEY_MALLOC
1576 JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \
1577 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1578 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1579 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1580 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1581 JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \
1582 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1583 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1584 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1585 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1586 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1587 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1588 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1589 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1590 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1591 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1592 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1593 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1594 #define JSON_HEDLEY_MALLOC __attribute__((__malloc__))
1595 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1596 #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory")
1598 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
1599 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1600 #define JSON_HEDLEY_MALLOC __declspec(restrict)
1602 #define JSON_HEDLEY_MALLOC
1605 #if defined(JSON_HEDLEY_PURE)
1606 #undef JSON_HEDLEY_PURE
1609 JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \
1610 JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \
1611 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1612 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1613 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1614 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1615 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1616 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1617 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1618 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1619 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1620 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1621 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1622 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1623 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1624 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1625 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1626 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1627 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1628 # define JSON_HEDLEY_PURE __attribute__((__pure__))
1629 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1630 # define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data")
1631 #elif defined(__cplusplus) && \
1633 JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \
1634 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \
1635 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \
1637 # define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;")
1639 # define JSON_HEDLEY_PURE
1642 #if defined(JSON_HEDLEY_CONST)
1643 #undef JSON_HEDLEY_CONST
1646 JSON_HEDLEY_HAS_ATTRIBUTE(const) || \
1647 JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \
1648 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1649 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1650 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1651 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1652 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1653 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1654 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1655 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1656 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1657 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1658 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1659 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1660 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1661 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1662 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1663 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1664 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1665 #define JSON_HEDLEY_CONST __attribute__((__const__))
1667 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1668 #define JSON_HEDLEY_CONST _Pragma("no_side_effect")
1670 #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE
1673 #if defined(JSON_HEDLEY_RESTRICT)
1674 #undef JSON_HEDLEY_RESTRICT
1676 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus)
1677 #define JSON_HEDLEY_RESTRICT restrict
1679 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1680 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
1681 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1682 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
1683 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1684 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1685 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1686 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1687 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \
1688 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \
1689 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1690 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \
1691 JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \
1692 defined(__clang__) || \
1693 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1694 #define JSON_HEDLEY_RESTRICT __restrict
1695 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus)
1696 #define JSON_HEDLEY_RESTRICT _Restrict
1698 #define JSON_HEDLEY_RESTRICT
1701 #if defined(JSON_HEDLEY_INLINE)
1702 #undef JSON_HEDLEY_INLINE
1705 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
1706 (defined(__cplusplus) && (__cplusplus >= 199711L))
1707 #define JSON_HEDLEY_INLINE inline
1709 defined(JSON_HEDLEY_GCC_VERSION) || \
1710 JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0)
1711 #define JSON_HEDLEY_INLINE __inline__
1713 JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \
1714 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
1715 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1716 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \
1717 JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \
1718 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
1719 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \
1720 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1721 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1722 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1723 #define JSON_HEDLEY_INLINE __inline
1725 #define JSON_HEDLEY_INLINE
1728 #if defined(JSON_HEDLEY_ALWAYS_INLINE)
1729 #undef JSON_HEDLEY_ALWAYS_INLINE
1732 JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \
1733 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
1734 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1735 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1736 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1737 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1738 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1739 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1740 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1741 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1742 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1743 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1744 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1745 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1746 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1747 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1748 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1749 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \
1750 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1751 # define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE
1753 JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \
1754 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1755 # define JSON_HEDLEY_ALWAYS_INLINE __forceinline
1756 #elif defined(__cplusplus) && \
1758 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1759 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1760 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1761 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
1762 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1763 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \
1765 # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;")
1766 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1767 # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced")
1769 # define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE
1772 #if defined(JSON_HEDLEY_NEVER_INLINE)
1773 #undef JSON_HEDLEY_NEVER_INLINE
1776 JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \
1777 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
1778 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1779 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1780 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1781 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1782 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1783 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1784 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1785 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1786 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1787 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1788 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1789 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1790 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1791 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1792 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1793 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \
1794 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1795 #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__))
1797 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1798 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1799 #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)
1800 #elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0)
1801 #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline")
1802 #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)
1803 #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;")
1804 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1805 #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never")
1806 #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0)
1807 #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline))
1808 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0)
1809 #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)
1811 #define JSON_HEDLEY_NEVER_INLINE
1814 #if defined(JSON_HEDLEY_PRIVATE)
1815 #undef JSON_HEDLEY_PRIVATE
1817 #if defined(JSON_HEDLEY_PUBLIC)
1818 #undef JSON_HEDLEY_PUBLIC
1820 #if defined(JSON_HEDLEY_IMPORT)
1821 #undef JSON_HEDLEY_IMPORT
1823 #if defined(_WIN32) || defined(__CYGWIN__)
1824 # define JSON_HEDLEY_PRIVATE
1825 # define JSON_HEDLEY_PUBLIC __declspec(dllexport)
1826 # define JSON_HEDLEY_IMPORT __declspec(dllimport)
1829 JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \
1830 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
1831 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1832 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1833 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1834 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
1836 defined(__TI_EABI__) && \
1838 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1839 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \
1842 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1843 # define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden")))
1844 # define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default")))
1846 # define JSON_HEDLEY_PRIVATE
1847 # define JSON_HEDLEY_PUBLIC
1849 # define JSON_HEDLEY_IMPORT extern
1852 #if defined(JSON_HEDLEY_NO_THROW)
1853 #undef JSON_HEDLEY_NO_THROW
1856 JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \
1857 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
1858 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1859 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1860 #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__))
1862 JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \
1863 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
1864 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)
1865 #define JSON_HEDLEY_NO_THROW __declspec(nothrow)
1867 #define JSON_HEDLEY_NO_THROW
1870 #if defined(JSON_HEDLEY_FALL_THROUGH)
1871 #undef JSON_HEDLEY_FALL_THROUGH
1874 JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \
1875 JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \
1876 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1877 #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__))
1878 #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough)
1879 #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]])
1880 #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough)
1881 #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]])
1882 #elif defined(__fallthrough)
1883 #define JSON_HEDLEY_FALL_THROUGH __fallthrough
1885 #define JSON_HEDLEY_FALL_THROUGH
1888 #if defined(JSON_HEDLEY_RETURNS_NON_NULL)
1889 #undef JSON_HEDLEY_RETURNS_NON_NULL
1892 JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \
1893 JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \
1894 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1895 #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__))
1896 #elif defined(_Ret_notnull_)
1897 #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_
1899 #define JSON_HEDLEY_RETURNS_NON_NULL
1902 #if defined(JSON_HEDLEY_ARRAY_PARAM)
1903 #undef JSON_HEDLEY_ARRAY_PARAM
1906 defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
1907 !defined(__STDC_NO_VLA__) && \
1908 !defined(__cplusplus) && \
1909 !defined(JSON_HEDLEY_PGI_VERSION) && \
1910 !defined(JSON_HEDLEY_TINYC_VERSION)
1911 #define JSON_HEDLEY_ARRAY_PARAM(name) (name)
1913 #define JSON_HEDLEY_ARRAY_PARAM(name)
1916 #if defined(JSON_HEDLEY_IS_CONSTANT)
1917 #undef JSON_HEDLEY_IS_CONSTANT
1919 #if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR)
1920 #undef JSON_HEDLEY_REQUIRE_CONSTEXPR
1924 #if defined(JSON_HEDLEY_IS_CONSTEXPR_)
1925 #undef JSON_HEDLEY_IS_CONSTEXPR_
1928 JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \
1929 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
1930 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1931 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \
1932 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1933 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
1934 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
1935 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \
1936 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
1937 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1938 #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr)
1940 #if !defined(__cplusplus)
1942 JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \
1943 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
1944 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1945 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
1946 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
1947 JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \
1948 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24)
1949 #if defined(__INTPTR_TYPE__)
1950 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*)
1953 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*)
1957 defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \
1958 !defined(JSON_HEDLEY_SUNPRO_VERSION) && \
1959 !defined(JSON_HEDLEY_PGI_VERSION) && \
1960 !defined(JSON_HEDLEY_IAR_VERSION)) || \
1961 (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \
1962 JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \
1963 JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \
1964 JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \
1965 JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0)
1966 #if defined(__INTPTR_TYPE__)
1967 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0)
1970 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0)
1973 defined(JSON_HEDLEY_GCC_VERSION) || \
1974 defined(JSON_HEDLEY_INTEL_VERSION) || \
1975 defined(JSON_HEDLEY_TINYC_VERSION) || \
1976 defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \
1977 JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \
1978 defined(JSON_HEDLEY_TI_CL2000_VERSION) || \
1979 defined(JSON_HEDLEY_TI_CL6X_VERSION) || \
1980 defined(JSON_HEDLEY_TI_CL7X_VERSION) || \
1981 defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \
1983 # define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \
1987 ((void*) ((expr) * 0L) ) : \
1988 ((struct { char v[sizeof(void) * 2]; } *) 1) \
1994 #if defined(JSON_HEDLEY_IS_CONSTEXPR_)
1995 #if !defined(JSON_HEDLEY_IS_CONSTANT)
1996 #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr)
1998 #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1))
2000 #if !defined(JSON_HEDLEY_IS_CONSTANT)
2001 #define JSON_HEDLEY_IS_CONSTANT(expr) (0)
2003 #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr)
2006 #if defined(JSON_HEDLEY_BEGIN_C_DECLS)
2007 #undef JSON_HEDLEY_BEGIN_C_DECLS
2009 #if defined(JSON_HEDLEY_END_C_DECLS)
2010 #undef JSON_HEDLEY_END_C_DECLS
2012 #if defined(JSON_HEDLEY_C_DECL)
2013 #undef JSON_HEDLEY_C_DECL
2015 #if defined(__cplusplus)
2016 #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" {
2017 #define JSON_HEDLEY_END_C_DECLS }
2018 #define JSON_HEDLEY_C_DECL extern "C"
2020 #define JSON_HEDLEY_BEGIN_C_DECLS
2021 #define JSON_HEDLEY_END_C_DECLS
2022 #define JSON_HEDLEY_C_DECL
2025 #if defined(JSON_HEDLEY_STATIC_ASSERT)
2026 #undef JSON_HEDLEY_STATIC_ASSERT
2029 !defined(__cplusplus) && ( \
2030 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
2031 (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \
2032 JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \
2033 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
2034 defined(_Static_assert) \
2036 # define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message)
2038 (defined(__cplusplus) && (__cplusplus >= 201103L)) || \
2039 JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \
2040 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
2041 # define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message))
2043 # define JSON_HEDLEY_STATIC_ASSERT(expr, message)
2046 #if defined(JSON_HEDLEY_NULL)
2047 #undef JSON_HEDLEY_NULL
2049 #if defined(__cplusplus)
2050 #if __cplusplus >= 201103L
2051 #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr)
2053 #define JSON_HEDLEY_NULL NULL
2055 #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0)
2058 #define JSON_HEDLEY_NULL NULL
2060 #define JSON_HEDLEY_NULL ((void*) 0)
2063 #if defined(JSON_HEDLEY_MESSAGE)
2064 #undef JSON_HEDLEY_MESSAGE
2066 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
2067 # define JSON_HEDLEY_MESSAGE(msg) \
2068 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2069 JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
2070 JSON_HEDLEY_PRAGMA(message msg) \
2071 JSON_HEDLEY_DIAGNOSTIC_POP
2073 JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \
2074 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
2075 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg)
2076 #elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0)
2077 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg)
2078 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
2079 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg))
2080 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0)
2081 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg))
2083 # define JSON_HEDLEY_MESSAGE(msg)
2086 #if defined(JSON_HEDLEY_WARNING)
2087 #undef JSON_HEDLEY_WARNING
2089 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
2090 # define JSON_HEDLEY_WARNING(msg) \
2091 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2092 JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
2093 JSON_HEDLEY_PRAGMA(clang warning msg) \
2094 JSON_HEDLEY_DIAGNOSTIC_POP
2096 JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \
2097 JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
2098 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
2099 # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg)
2101 JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \
2102 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
2103 # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg))
2105 # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg)
2108 #if defined(JSON_HEDLEY_REQUIRE)
2109 #undef JSON_HEDLEY_REQUIRE
2111 #if defined(JSON_HEDLEY_REQUIRE_MSG)
2112 #undef JSON_HEDLEY_REQUIRE_MSG
2114 #if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if)
2115 # if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat")
2116 # define JSON_HEDLEY_REQUIRE(expr) \
2117 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2118 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
2119 __attribute__((diagnose_if(!(expr), #expr, "error"))) \
2120 JSON_HEDLEY_DIAGNOSTIC_POP
2121 # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \
2122 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2123 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
2124 __attribute__((diagnose_if(!(expr), msg, "error"))) \
2125 JSON_HEDLEY_DIAGNOSTIC_POP
2127 # define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error")))
2128 # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error")))
2131 # define JSON_HEDLEY_REQUIRE(expr)
2132 # define JSON_HEDLEY_REQUIRE_MSG(expr,msg)
2135 #if defined(JSON_HEDLEY_FLAGS)
2136 #undef JSON_HEDLEY_FLAGS
2138 #if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion"))
2139 #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__))
2141 #define JSON_HEDLEY_FLAGS
2144 #if defined(JSON_HEDLEY_FLAGS_CAST)
2145 #undef JSON_HEDLEY_FLAGS_CAST
2147 #if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0)
2148 # define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \
2149 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2150 _Pragma("warning(disable:188)") \
2152 JSON_HEDLEY_DIAGNOSTIC_POP \
2155 # define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr)
2158 #if defined(JSON_HEDLEY_EMPTY_BASES)
2159 #undef JSON_HEDLEY_EMPTY_BASES
2162 (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \
2163 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
2164 #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases)
2166 #define JSON_HEDLEY_EMPTY_BASES
2171 #if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK)
2172 #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
2174 #if defined(__clang__)
2175 #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0)
2177 #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
2180 #if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE)
2181 #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE
2183 #define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)
2185 #if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE)
2186 #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
2188 #define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute)
2190 #if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN)
2191 #undef JSON_HEDLEY_CLANG_HAS_BUILTIN
2193 #define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin)
2195 #if defined(JSON_HEDLEY_CLANG_HAS_FEATURE)
2196 #undef JSON_HEDLEY_CLANG_HAS_FEATURE
2198 #define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature)
2200 #if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION)
2201 #undef JSON_HEDLEY_CLANG_HAS_EXTENSION
2203 #define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension)
2205 #if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE)
2206 #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
2208 #define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute)
2210 #if defined(JSON_HEDLEY_CLANG_HAS_WARNING)
2211 #undef JSON_HEDLEY_CLANG_HAS_WARNING
2213 #define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning)
2222 #if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK)
2223 #if defined(__clang__)
2224 #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400
2225 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
2227 #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
2228 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
2229 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
2236 #if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11)
2237 #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)
2238 #define JSON_HAS_CPP_20
2239 #define JSON_HAS_CPP_17
2240 #define JSON_HAS_CPP_14
2241 #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
2242 #define JSON_HAS_CPP_17
2243 #define JSON_HAS_CPP_14
2244 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
2245 #define JSON_HAS_CPP_14
2248 #define JSON_HAS_CPP_11
2252 #if defined(__clang__)
2253 #pragma clang diagnostic push
2254 #pragma clang diagnostic ignored "-Wdocumentation"
2255 #pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
2259 #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION)
2260 #define JSON_THROW(exception) throw exception
2261 #define JSON_TRY try
2262 #define JSON_CATCH(exception) catch(exception)
2263 #define JSON_INTERNAL_CATCH(exception) catch(exception)
2266 #define JSON_THROW(exception) std::abort()
2267 #define JSON_TRY if(true)
2268 #define JSON_CATCH(exception) if(false)
2269 #define JSON_INTERNAL_CATCH(exception) if(false)
2273 #if defined(JSON_THROW_USER)
2275 #define JSON_THROW JSON_THROW_USER
2277 #if defined(JSON_TRY_USER)
2279 #define JSON_TRY JSON_TRY_USER
2281 #if defined(JSON_CATCH_USER)
2283 #define JSON_CATCH JSON_CATCH_USER
2284 #undef JSON_INTERNAL_CATCH
2285 #define JSON_INTERNAL_CATCH JSON_CATCH_USER
2287 #if defined(JSON_INTERNAL_CATCH_USER)
2288 #undef JSON_INTERNAL_CATCH
2289 #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER
2293 #if !defined(JSON_ASSERT)
2295 #define JSON_ASSERT(x) assert(x)
2299 #if defined(JSON_TESTS_PRIVATE)
2300 #define JSON_PRIVATE_UNLESS_TESTED public
2302 #define JSON_PRIVATE_UNLESS_TESTED private
2310 #define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \
2311 template<typename BasicJsonType> \
2312 inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \
2314 static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
2315 static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
2316 auto it = std::find_if(std::begin(m), std::end(m), \
2317 [e](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
2319 return ej_pair.first == e; \
2321 j = ((it != std::end(m)) ? it : std::begin(m))->second; \
2323 template<typename BasicJsonType> \
2324 inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \
2326 static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
2327 static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
2328 auto it = std::find_if(std::begin(m), std::end(m), \
2329 [&j](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
2331 return ej_pair.second == j; \
2333 e = ((it != std::end(m)) ? it : std::begin(m))->first; \
2339 #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \
2340 template<template<typename, typename, typename...> class ObjectType, \
2341 template<typename, typename...> class ArrayType, \
2342 class StringType, class BooleanType, class NumberIntegerType, \
2343 class NumberUnsignedType, class NumberFloatType, \
2344 template<typename> class AllocatorType, \
2345 template<typename, typename = void> class JSONSerializer, \
2348 #define NLOHMANN_BASIC_JSON_TPL \
2349 basic_json<ObjectType, ArrayType, StringType, BooleanType, \
2350 NumberIntegerType, NumberUnsignedType, NumberFloatType, \
2351 AllocatorType, JSONSerializer, BinaryType>
2355 #define NLOHMANN_JSON_EXPAND( x ) x
2356 #define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME
2357 #define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \
2358 NLOHMANN_JSON_PASTE64, \
2359 NLOHMANN_JSON_PASTE63, \
2360 NLOHMANN_JSON_PASTE62, \
2361 NLOHMANN_JSON_PASTE61, \
2362 NLOHMANN_JSON_PASTE60, \
2363 NLOHMANN_JSON_PASTE59, \
2364 NLOHMANN_JSON_PASTE58, \
2365 NLOHMANN_JSON_PASTE57, \
2366 NLOHMANN_JSON_PASTE56, \
2367 NLOHMANN_JSON_PASTE55, \
2368 NLOHMANN_JSON_PASTE54, \
2369 NLOHMANN_JSON_PASTE53, \
2370 NLOHMANN_JSON_PASTE52, \
2371 NLOHMANN_JSON_PASTE51, \
2372 NLOHMANN_JSON_PASTE50, \
2373 NLOHMANN_JSON_PASTE49, \
2374 NLOHMANN_JSON_PASTE48, \
2375 NLOHMANN_JSON_PASTE47, \
2376 NLOHMANN_JSON_PASTE46, \
2377 NLOHMANN_JSON_PASTE45, \
2378 NLOHMANN_JSON_PASTE44, \
2379 NLOHMANN_JSON_PASTE43, \
2380 NLOHMANN_JSON_PASTE42, \
2381 NLOHMANN_JSON_PASTE41, \
2382 NLOHMANN_JSON_PASTE40, \
2383 NLOHMANN_JSON_PASTE39, \
2384 NLOHMANN_JSON_PASTE38, \
2385 NLOHMANN_JSON_PASTE37, \
2386 NLOHMANN_JSON_PASTE36, \
2387 NLOHMANN_JSON_PASTE35, \
2388 NLOHMANN_JSON_PASTE34, \
2389 NLOHMANN_JSON_PASTE33, \
2390 NLOHMANN_JSON_PASTE32, \
2391 NLOHMANN_JSON_PASTE31, \
2392 NLOHMANN_JSON_PASTE30, \
2393 NLOHMANN_JSON_PASTE29, \
2394 NLOHMANN_JSON_PASTE28, \
2395 NLOHMANN_JSON_PASTE27, \
2396 NLOHMANN_JSON_PASTE26, \
2397 NLOHMANN_JSON_PASTE25, \
2398 NLOHMANN_JSON_PASTE24, \
2399 NLOHMANN_JSON_PASTE23, \
2400 NLOHMANN_JSON_PASTE22, \
2401 NLOHMANN_JSON_PASTE21, \
2402 NLOHMANN_JSON_PASTE20, \
2403 NLOHMANN_JSON_PASTE19, \
2404 NLOHMANN_JSON_PASTE18, \
2405 NLOHMANN_JSON_PASTE17, \
2406 NLOHMANN_JSON_PASTE16, \
2407 NLOHMANN_JSON_PASTE15, \
2408 NLOHMANN_JSON_PASTE14, \
2409 NLOHMANN_JSON_PASTE13, \
2410 NLOHMANN_JSON_PASTE12, \
2411 NLOHMANN_JSON_PASTE11, \
2412 NLOHMANN_JSON_PASTE10, \
2413 NLOHMANN_JSON_PASTE9, \
2414 NLOHMANN_JSON_PASTE8, \
2415 NLOHMANN_JSON_PASTE7, \
2416 NLOHMANN_JSON_PASTE6, \
2417 NLOHMANN_JSON_PASTE5, \
2418 NLOHMANN_JSON_PASTE4, \
2419 NLOHMANN_JSON_PASTE3, \
2420 NLOHMANN_JSON_PASTE2, \
2421 NLOHMANN_JSON_PASTE1)(__VA_ARGS__))
2422 #define NLOHMANN_JSON_PASTE2(func, v1) func(v1)
2423 #define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2)
2424 #define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3)
2425 #define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4)
2426 #define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5)
2427 #define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6)
2428 #define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7)
2429 #define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8)
2430 #define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9)
2431 #define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10)
2432 #define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11)
2433 #define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12)
2434 #define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13)
2435 #define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14)
2436 #define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15)
2437 #define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16)
2438 #define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17)
2439 #define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18)
2440 #define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19)
2441 #define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20)
2442 #define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21)
2443 #define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22)
2444 #define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23)
2445 #define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24)
2446 #define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25)
2447 #define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26)
2448 #define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27)
2449 #define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28)
2450 #define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29)
2451 #define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30)
2452 #define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31)
2453 #define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32)
2454 #define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33)
2455 #define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34)
2456 #define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35)
2457 #define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36)
2458 #define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37)
2459 #define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38)
2460 #define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39)
2461 #define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40)
2462 #define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41)
2463 #define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42)
2464 #define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43)
2465 #define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44)
2466 #define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45)
2467 #define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46)
2468 #define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47)
2469 #define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48)
2470 #define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49)
2471 #define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50)
2472 #define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51)
2473 #define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52)
2474 #define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53)
2475 #define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54)
2476 #define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55)
2477 #define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56)
2478 #define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57)
2479 #define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58)
2480 #define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59)
2481 #define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60)
2482 #define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61)
2483 #define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62)
2484 #define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63)
2486 #define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1;
2487 #define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1);
2494 #define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \
2495 friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2496 friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
2503 #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \
2504 inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2505 inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
2507 #ifndef JSON_USE_IMPLICIT_CONVERSIONS
2508 #define JSON_USE_IMPLICIT_CONVERSIONS 1
2511 #if JSON_USE_IMPLICIT_CONVERSIONS
2512 #define JSON_EXPLICIT
2514 #define JSON_EXPLICIT explicit
2537 const std::string&
t)
2540 for (
auto pos = s.find(f);
2541 pos != std::string::npos;
2542 s.replace(pos, f.size(),
t),
2543 pos = s.find(f, pos +
t.size()))
2597 constexpr
operator size_t()
const
2649 const char*
what() const noexcept
override
2659 exception(
int id_, const
char* what_arg) :
id(id_),
m(what_arg) {}
2661 static std::string
name(
const std::string& ename,
int id_)
2663 return "[json.exception." + ename +
"." +
std::to_string(id_) +
"] ";
2666 template<
typename BasicJsonType>
2669 #if JSON_DIAGNOSTICS
2670 std::vector<std::string> tokens;
2673 switch (
current->m_parent->type())
2677 for (std::size_t i = 0; i <
current->m_parent->m_value.array->size(); ++i)
2694 tokens.emplace_back(
element.first.c_str());
2719 return "(" + std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
2720 [](
const std::string &
a,
const std::string &
b)
2722 return a +
"/" + detail::escape(b);
2725 static_cast<void>(leaf_element);
2732 std::runtime_error
m;
2792 template<
typename BasicJsonType>
2800 template<
typename BasicJsonType>
2801 static parse_error create(
int id_, std::size_t byte_,
const std::string& what_arg,
const BasicJsonType& context)
2871 template<
typename BasicJsonType>
2926 template<
typename BasicJsonType>
2974 template<
typename BasicJsonType>
3013 template<
typename BasicJsonType>
3033 #include <type_traits>
3044 template<
typename T>
3047 #ifdef JSON_HAS_CPP_14
3058 template<
bool B,
typename T =
void>
3085 template <
typename T, T... Ints>
3089 static constexpr std::size_t
size() noexcept
3091 return sizeof...(Ints);
3100 template <
size_t... Ints>
3103 namespace utility_internal
3106 template <
typename Seq,
size_t SeqSize,
size_t Rem>
3110 template <
typename T, T... Ints,
size_t SeqSize>
3116 template <
typename T, T... Ints,
size_t SeqSize>
3124 template <
typename T,
size_t N>
3131 template <
typename T>
3146 template <
typename T, T N>
3162 template <
typename... Ts>
3174 template<
typename T>
3180 template<
typename T>
3202 #include <type_traits>
3233 template<
typename It,
typename =
void>
3236 template<
typename It>
3240 typename It::reference, typename It::iterator_category >>
3251 template<
typename T,
typename =
void>
3256 template<
typename T>
3262 template<
typename T>
3281 #include <type_traits>
3301 template<
class Default,
3303 template<
class...>
class Op,
3311 template<
class Default,
template<
class...>
class Op,
class... Args>
3318 template<
template<
class...>
class Op,
class... Args>
3321 template<
template<
class...>
class Op,
class... Args>
3324 template<
template<
class...>
class Op,
class... Args>
3327 template<
class Default,
template<
class...>
class Op,
class... Args>
3330 template<
class Default,
template<
class...>
class Op,
class... Args>
3333 template<
class Expected,
template<
class...>
class Op,
class... Args>
3336 template<
class To,
template<
class...>
class Op,
class... Args>
3343 #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_
3344 #define INCLUDE_NLOHMANN_JSON_FWD_HPP_
3366 template<
typename T =
void,
typename SFINAE =
void>
3369 template<
template<
typename U,
typename V,
typename... Args>
class ObjectType =
3371 template<
typename U,
typename... Args>
class ArrayType = std::vector,
3372 class StringType = std::string,
class BooleanType = bool,
3373 class NumberIntegerType = std::int64_t,
3374 class NumberUnsignedType = std::uint64_t,
3375 class NumberFloatType = double,
3376 template<
typename U>
class AllocatorType = std::allocator,
3377 template<
typename T,
typename SFINAE =
void>
class JSONSerializer =
3379 class BinaryType = std::vector<std::uint8_t>>
3393 template<
typename BasicJsonType>
3406 template<
class Key,
class T,
class IgnoredLess,
class Allocator>
3420 #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_
3463 template<
typename T>
3470 template<
typename T>
3473 template<
typename T>
3476 template<
typename T>
3479 template<
typename T>
3482 template<
typename T>
3485 template<
typename T>
3488 template<
typename T>
3491 template<
typename T>
3494 template<
typename T,
typename... Args>
3497 template<
typename T,
typename... Args>
3500 template<
typename T,
typename U>
3504 template<
typename BasicJsonType,
typename T,
typename =
void>
3511 template <
typename BasicJsonType,
typename T>
3517 template<
typename BasicJsonType,
typename T>
3520 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3522 static constexpr
bool value =
3524 const BasicJsonType&, T&>::value;
3529 template<
typename BasicJsonType,
typename T,
typename =
void>
3532 template<
typename BasicJsonType,
typename T>
3535 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3537 static constexpr
bool value =
3539 const BasicJsonType&>::value;
3544 template<
typename BasicJsonType,
typename T,
typename =
void>
3547 template<
typename BasicJsonType,
typename T>
3550 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3552 static constexpr
bool value =
3565 template<
class B1,
class... Bn>
3567 : std::conditional<bool(B1::value), conjunction<Bn...>, B1>
::type {};
3570 template<
class B>
struct negation : std::integral_constant < bool, !B::value > { };
3575 template <
typename T>
3578 template <
typename T1,
typename T2>
3580 :
conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
3582 template <
typename T1,
typename T2>
3584 :
conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
3586 template <
typename... Ts>
3588 :
conjunction<is_default_constructible<Ts>...> {};
3590 template <
typename... Ts>
3592 :
conjunction<is_default_constructible<Ts>...> {};
3595 template <
typename T,
typename... Args>
3598 template <
typename T1,
typename T2>
3601 template <
typename T1,
typename T2>
3604 template <
typename... Ts>
3607 template <
typename... Ts>
3611 template<
typename T,
typename =
void>
3614 template<
typename T>
3621 static constexpr
auto value =
3633 template<
typename T,
typename =
void>
3636 template<
typename T>
3639 template<
typename BasicJsonType,
typename CompatibleObjectType,
3643 template<
typename BasicJsonType,
typename CompatibleObjectType>
3645 BasicJsonType, CompatibleObjectType,
3652 static constexpr
bool value =
3654 typename CompatibleObjectType::key_type>::value &&
3656 typename CompatibleObjectType::mapped_type>::value;
3659 template<
typename BasicJsonType,
typename CompatibleObjectType>
3663 template<
typename BasicJsonType,
typename ConstructibleObjectType,
3667 template<
typename BasicJsonType,
typename ConstructibleObjectType>
3669 BasicJsonType, ConstructibleObjectType,
3675 static constexpr
bool value =
3680 typename object_t::key_type>::value &&
3682 typename object_t::mapped_type,
3683 typename ConstructibleObjectType::mapped_type >::value)) ||
3685 typename ConstructibleObjectType::mapped_type>::value ||
3688 typename ConstructibleObjectType::mapped_type >::value);
3691 template<
typename BasicJsonType,
typename ConstructibleObjectType>
3694 ConstructibleObjectType> {};
3696 template<
typename BasicJsonType,
typename CompatibleStringType,
3700 template<
typename BasicJsonType,
typename CompatibleStringType>
3702 BasicJsonType, CompatibleStringType,
3706 static constexpr
auto value =
3710 template<
typename BasicJsonType,
typename ConstructibleStringType>
3714 template<
typename BasicJsonType,
typename ConstructibleStringType,
3718 template<
typename BasicJsonType,
typename ConstructibleStringType>
3720 BasicJsonType, ConstructibleStringType,
3724 static constexpr
auto value =
3726 typename BasicJsonType::string_t>::value;
3729 template<
typename BasicJsonType,
typename ConstructibleStringType>
3733 template<
typename BasicJsonType,
typename CompatibleArrayType,
typename =
void>
3736 template<
typename BasicJsonType,
typename CompatibleArrayType>
3738 BasicJsonType, CompatibleArrayType,
3745 iterator_traits<CompatibleArrayType >>
::value >>
3747 static constexpr
bool value =
3749 typename CompatibleArrayType::value_type>::value;
3752 template<
typename BasicJsonType,
typename CompatibleArrayType>
3756 template<
typename BasicJsonType,
typename ConstructibleArrayType,
typename =
void>
3759 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3761 BasicJsonType, ConstructibleArrayType,
3763 typename BasicJsonType::value_type>
::value >>
3764 : std::true_type {};
3766 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3768 BasicJsonType, ConstructibleArrayType,
3770 typename BasicJsonType::value_type>
::value&&
3772 (std::is_move_assignable<ConstructibleArrayType>::value ||
3773 std::is_copy_assignable<ConstructibleArrayType>::value)&&
3777 detected_t<value_type_t, ConstructibleArrayType >>
::value >>
3779 static constexpr
bool value =
3787 (std::is_same<
typename ConstructibleArrayType::value_type,
3788 typename BasicJsonType::array_t::value_type>::value ||
3790 typename ConstructibleArrayType::value_type>::value ||
3792 BasicJsonType,
typename ConstructibleArrayType::value_type >::value);
3795 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3799 template<
typename RealIntegerType,
typename CompatibleNumberIntegerType,
3803 template<
typename RealIntegerType,
typename CompatibleNumberIntegerType>
3805 RealIntegerType, CompatibleNumberIntegerType,
3807 std::is_integral<CompatibleNumberIntegerType>
::value&&
3808 !std::is_same<bool, CompatibleNumberIntegerType>
::value >>
3814 static constexpr
auto value =
3816 CompatibleNumberIntegerType>::value &&
3817 CompatibleLimits::is_integer &&
3818 RealLimits::is_signed == CompatibleLimits::is_signed;
3821 template<
typename RealIntegerType,
typename CompatibleNumberIntegerType>
3824 CompatibleNumberIntegerType> {};
3826 template<
typename BasicJsonType,
typename CompatibleType,
typename =
void>
3829 template<
typename BasicJsonType,
typename CompatibleType>
3831 BasicJsonType, CompatibleType,
3834 static constexpr
bool value =
3838 template<
typename BasicJsonType,
typename CompatibleType>
3842 template<
typename T1,
typename T2>
3845 template<
typename T1,
typename... Args>
3852 return static_cast<T
>(value);
3871 template<
typename BasicJsonType>
3872 void from_json(
const BasicJsonType& j,
typename std::nullptr_t& n)
3882 template <
typename BasicJsonType,
typename ArithmeticType,
3888 switch (
static_cast<value_t>(j))
3892 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
3897 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
3902 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
3918 template<
typename BasicJsonType>
3919 void from_json(
const BasicJsonType& j,
typename BasicJsonType::boolean_t&
b)
3925 b = *j.template get_ptr<const typename BasicJsonType::boolean_t*>();
3928 template<
typename BasicJsonType>
3929 void from_json(
const BasicJsonType& j,
typename BasicJsonType::string_t& s)
3935 s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
3939 typename BasicJsonType,
typename ConstructibleStringType,
3942 !std::is_same<
typename BasicJsonType::string_t,
3943 ConstructibleStringType>::value,
3945 void from_json(
const BasicJsonType& j, ConstructibleStringType& s)
3952 s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
3955 template<
typename BasicJsonType>
3956 void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_float_t& val)
3961 template<
typename BasicJsonType>
3962 void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_unsigned_t& val)
3967 template<
typename BasicJsonType>
3968 void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_integer_t& val)
3973 template<
typename BasicJsonType,
typename EnumType,
3979 e =
static_cast<EnumType
>(val);
3983 template<
typename BasicJsonType,
typename T,
typename Allocator,
3985 void from_json(
const BasicJsonType& j, std::forward_list<T, Allocator>&
l)
3992 std::transform(j.rbegin(), j.rend(),
3993 std::front_inserter(
l), [](
const BasicJsonType & i)
3995 return i.template get<T>();
4000 template<
typename BasicJsonType,
typename T,
4009 std::transform(j.begin(), j.end(), std::begin(
l),
4010 [](
const BasicJsonType & elem)
4012 return elem.template get<T>();
4016 template<
typename BasicJsonType,
typename T, std::
size_t N>
4018 -> decltype(j.template get<T>(),
void())
4020 for (std::size_t i = 0; i < N; ++i)
4022 arr[i] = j.at(i).template get<T>();
4026 template<
typename BasicJsonType>
4029 arr = *j.template get_ptr<const typename BasicJsonType::array_t*>();
4032 template<
typename BasicJsonType,
typename T, std::
size_t N>
4035 -> decltype(j.template get<T>(),
void())
4037 for (std::size_t i = 0; i < N; ++i)
4039 arr[i] = j.at(i).template get<T>();
4043 template<
typename BasicJsonType,
typename ConstructibleArrayType,
4049 arr.reserve(std::declval<typename ConstructibleArrayType::size_type>()),
4050 j.template get<typename ConstructibleArrayType::value_type>(),
4055 ConstructibleArrayType ret;
4056 ret.reserve(j.size());
4057 std::transform(j.begin(), j.end(),
4058 std::inserter(ret, end(ret)), [](
const BasicJsonType & i)
4062 return i.template get<typename ConstructibleArrayType::value_type>();
4064 arr = std::move(ret);
4067 template<
typename BasicJsonType,
typename ConstructibleArrayType,
4076 ConstructibleArrayType ret;
4078 j.begin(), j.end(), std::inserter(ret, end(ret)),
4079 [](
const BasicJsonType & i)
4083 return i.template get<typename ConstructibleArrayType::value_type>();
4085 arr = std::move(ret);
4088 template <
typename BasicJsonType,
typename ConstructibleArrayType,
4096 auto from_json(
const BasicJsonType& j, ConstructibleArrayType& arr)
4098 j.template get<typename ConstructibleArrayType::value_type>(),
4109 template <
typename BasicJsonType,
typename T, std::size_t... Idx >
4113 return { { std::forward<BasicJsonType>(j).at(Idx).template get<T>()... } };
4116 template <
typename BasicJsonType,
typename T, std::
size_t N >
4128 template<
typename BasicJsonType>
4129 void from_json(
const BasicJsonType& j,
typename BasicJsonType::binary_t& bin)
4136 bin = *j.template get_ptr<const typename BasicJsonType::binary_t*>();
4139 template<
typename BasicJsonType,
typename ConstructibleObjectType,
4148 ConstructibleObjectType ret;
4149 const auto* inner_object = j.template get_ptr<const typename BasicJsonType::object_t*>();
4150 using value_type =
typename ConstructibleObjectType::value_type;
4152 inner_object->begin(), inner_object->end(),
4153 std::inserter(ret, ret.begin()),
4154 [](
typename BasicJsonType::object_t::value_type
const & p)
4156 return value_type(p.first, p.second.template get<typename ConstructibleObjectType::mapped_type>());
4158 obj = std::move(ret);
4165 template <
typename BasicJsonType,
typename ArithmeticType,
4175 switch (
static_cast<value_t>(j))
4179 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
4184 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
4189 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
4194 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::boolean_t*>());
4209 template<
typename BasicJsonType,
typename... Args, std::size_t... Idx>
4212 return std::make_tuple(std::forward<BasicJsonType>(j).at(Idx).
template get<Args>()...);
4215 template <
typename BasicJsonType,
class A1,
class A2 >
4218 return {std::forward<BasicJsonType>(j).at(0).template get<A1>(),
4219 std::forward<BasicJsonType>(j).at(1).template get<A2>()};
4222 template<
typename BasicJsonType,
typename A1,
typename A2>
4228 template<
typename BasicJsonType,
typename... Args>
4234 template<
typename BasicJsonType,
typename... Args>
4240 template<
typename BasicJsonType,
typename TupleRelated>
4249 return from_json_tuple_impl(std::forward<BasicJsonType>(j), std::forward<TupleRelated>(
t), priority_tag<3> {});
4252 template <
typename BasicJsonType,
typename Key,
typename Value,
typename Compare,
typename Allocator,
4254 typename BasicJsonType::string_t, Key >::value >>
4255 void from_json(
const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>&
m)
4262 for (
const auto& p : j)
4268 m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());
4272 template <
typename BasicJsonType,
typename Key,
typename Value,
typename Hash,
typename KeyEqual,
typename Allocator,
4274 typename BasicJsonType::string_t, Key >::value >>
4275 void from_json(
const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>&
m)
4282 for (
const auto& p : j)
4288 m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());
4294 template<
typename BasicJsonType,
typename T>
4296 noexcept(noexcept(
from_json(j, std::forward<T>(val))))
4297 -> decltype(
from_json(j, std::forward<T>(val)))
4299 return from_json(j, std::forward<T>(val));
4316 #include <algorithm>
4320 #include <type_traits>
4343 template<
typename string_type>
4358 using string_type =
typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().
key() ) >::
type >::
type;
4409 switch (
anchor.m_object->type())
4441 typename IteratorType::reference
value()
const
4474 template<std::
size_t N,
typename IteratorType, enable_if_t<N == 0,
int> = 0>
4482 template<std::
size_t N,
typename IteratorType, enable_if_t<N == 1,
int> = 0>
4496 #if defined(__clang__)
4498 #pragma clang diagnostic push
4499 #pragma clang diagnostic ignored "-Wmismatched-tags"
4501 template<
typename IteratorType>
4503 :
public std::integral_constant<std::size_t, 2> {};
4505 template<std::
size_t N,
typename IteratorType>
4509 using type = decltype(
4510 get<N>(std::declval <
4513 #if defined(__clang__)
4514 #pragma clang diagnostic pop
4545 template<
typename BasicJsonType>
4546 static void construct(BasicJsonType& j,
typename BasicJsonType::boolean_t
b) noexcept
4548 j.m_value.destroy(j.m_type);
4551 j.assert_invariant();
4558 template<
typename BasicJsonType>
4559 static void construct(BasicJsonType& j,
const typename BasicJsonType::string_t& s)
4561 j.m_value.destroy(j.m_type);
4564 j.assert_invariant();
4567 template<
typename BasicJsonType>
4568 static void construct(BasicJsonType& j,
typename BasicJsonType::string_t&& s)
4570 j.m_value.destroy(j.m_type);
4572 j.m_value = std::move(s);
4573 j.assert_invariant();
4576 template <
typename BasicJsonType,
typename CompatibleStringType,
4581 j.m_value.destroy(j.m_type);
4583 j.m_value.string = j.template create<typename BasicJsonType::string_t>(
str);
4584 j.assert_invariant();
4591 template<
typename BasicJsonType>
4592 static void construct(BasicJsonType& j,
const typename BasicJsonType::binary_t&
b)
4594 j.m_value.destroy(j.m_type);
4596 j.m_value =
typename BasicJsonType::binary_t(
b);
4597 j.assert_invariant();
4600 template<
typename BasicJsonType>
4601 static void construct(BasicJsonType& j,
typename BasicJsonType::binary_t&&
b)
4603 j.m_value.destroy(j.m_type);
4605 j.m_value =
typename BasicJsonType::binary_t(std::move(
b));;
4606 j.assert_invariant();
4613 template<
typename BasicJsonType>
4614 static void construct(BasicJsonType& j,
typename BasicJsonType::number_float_t val) noexcept
4616 j.m_value.destroy(j.m_type);
4619 j.assert_invariant();
4626 template<
typename BasicJsonType>
4627 static void construct(BasicJsonType& j,
typename BasicJsonType::number_unsigned_t val) noexcept
4629 j.m_value.destroy(j.m_type);
4632 j.assert_invariant();
4639 template<
typename BasicJsonType>
4640 static void construct(BasicJsonType& j,
typename BasicJsonType::number_integer_t val) noexcept
4642 j.m_value.destroy(j.m_type);
4645 j.assert_invariant();
4652 template<
typename BasicJsonType>
4653 static void construct(BasicJsonType& j,
const typename BasicJsonType::array_t& arr)
4655 j.m_value.destroy(j.m_type);
4659 j.assert_invariant();
4662 template<
typename BasicJsonType>
4663 static void construct(BasicJsonType& j,
typename BasicJsonType::array_t&& arr)
4665 j.m_value.destroy(j.m_type);
4667 j.m_value = std::move(arr);
4669 j.assert_invariant();
4672 template <
typename BasicJsonType,
typename CompatibleArrayType,
4675 static void construct(BasicJsonType& j,
const CompatibleArrayType& arr)
4680 j.m_value.destroy(j.m_type);
4682 j.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));
4684 j.assert_invariant();
4687 template<
typename BasicJsonType>
4688 static void construct(BasicJsonType& j,
const std::vector<bool>& arr)
4690 j.m_value.destroy(j.m_type);
4693 j.m_value.array->reserve(arr.size());
4694 for (
const bool x : arr)
4696 j.m_value.array->push_back(
x);
4697 j.set_parent(j.m_value.array->back());
4699 j.assert_invariant();
4702 template<
typename BasicJsonType,
typename T,
4704 static void construct(BasicJsonType& j,
const std::valarray<T>& arr)
4706 j.m_value.destroy(j.m_type);
4709 j.m_value.array->resize(arr.size());
4712 std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
4715 j.assert_invariant();
4722 template<
typename BasicJsonType>
4723 static void construct(BasicJsonType& j,
const typename BasicJsonType::object_t&
obj)
4725 j.m_value.destroy(j.m_type);
4729 j.assert_invariant();
4732 template<
typename BasicJsonType>
4733 static void construct(BasicJsonType& j,
typename BasicJsonType::object_t&&
obj)
4735 j.m_value.destroy(j.m_type);
4737 j.m_value = std::move(
obj);
4739 j.assert_invariant();
4742 template <
typename BasicJsonType,
typename CompatibleObjectType,
4749 j.m_value.destroy(j.m_type);
4751 j.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(
obj), end(
obj));
4753 j.assert_invariant();
4761 template<
typename BasicJsonType,
typename T,
4768 template<
typename BasicJsonType,
typename CompatibleString,
4770 void to_json(BasicJsonType& j,
const CompatibleString& s)
4775 template<
typename BasicJsonType>
4776 void to_json(BasicJsonType& j,
typename BasicJsonType::string_t&& s)
4781 template<
typename BasicJsonType,
typename FloatType,
4783 void to_json(BasicJsonType& j, FloatType val) noexcept
4788 template<
typename BasicJsonType,
typename CompatibleNumberUnsignedType,
4790 void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept
4795 template<
typename BasicJsonType,
typename CompatibleNumberIntegerType,
4797 void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept
4802 template<
typename BasicJsonType,
typename EnumType,
4804 void to_json(BasicJsonType& j, EnumType e) noexcept
4810 template<
typename BasicJsonType>
4811 void to_json(BasicJsonType& j,
const std::vector<bool>& e)
4816 template <
typename BasicJsonType,
typename CompatibleArrayType,
4817 enable_if_t < is_compatible_array_type<BasicJsonType,
4818 CompatibleArrayType>::value&&
4824 void to_json(BasicJsonType& j,
const CompatibleArrayType& arr)
4829 template<
typename BasicJsonType>
4830 void to_json(BasicJsonType& j,
const typename BasicJsonType::binary_t& bin)
4835 template<
typename BasicJsonType,
typename T,
4837 void to_json(BasicJsonType& j,
const std::valarray<T>& arr)
4842 template<
typename BasicJsonType>
4843 void to_json(BasicJsonType& j,
typename BasicJsonType::array_t&& arr)
4848 template <
typename BasicJsonType,
typename CompatibleObjectType,
4855 template<
typename BasicJsonType>
4856 void to_json(BasicJsonType& j,
typename BasicJsonType::object_t&&
obj)
4862 typename BasicJsonType,
typename T, std::size_t N,
4863 enable_if_t < !std::is_constructible<
typename BasicJsonType::string_t,
4864 const T(&)[N]>::value,
4872 void to_json(BasicJsonType& j,
const std::pair<T1, T2>& p)
4874 j = { p.first, p.second };
4878 template<
typename BasicJsonType,
typename T,
4879 enable_if_t<std::is_same<T, iteration_proxy_value<typename BasicJsonType::iterator>>::value,
int> = 0>
4882 j = { {
b.key(),
b.value()} };
4885 template<
typename BasicJsonType,
typename Tuple, std::size_t... Idx>
4888 j = { std::get<Idx>(
t)... };
4892 void to_json(BasicJsonType& j,
const T&
t)
4899 template<
typename BasicJsonType,
typename T>
4900 auto operator()(BasicJsonType& j, T&& val)
const noexcept(noexcept(
to_json(j, std::forward<T>(val))))
4901 -> decltype(
to_json(j, std::forward<T>(val)),
void())
4903 return to_json(j, std::forward<T>(val));
4925 template<
typename ValueType,
typename>
4926 struct adl_serializer
4939 template<
typename BasicJsonType,
typename TargetType = ValueType>
4940 static auto from_json(BasicJsonType && j, TargetType& val) noexcept(
4959 template<
typename BasicJsonType,
typename TargetType = ValueType>
4976 template<
typename BasicJsonType,
typename TargetType = ValueType>
4977 static auto to_json(BasicJsonType& j, TargetType && val) noexcept(
5009 template<
typename BinaryType>
5050 return !(rhs == *
this);
5168 #include <functional>
5179 inline std::size_t
combine(std::size_t seed, std::size_t h) noexcept
5181 seed ^= h + 0x9e3779b9 + (seed << 6U) + (seed >> 2U);
5196 template<
typename BasicJsonType>
5197 std::size_t
hash(
const BasicJsonType& j)
5199 using string_t =
typename BasicJsonType::string_t;
5200 using number_integer_t =
typename BasicJsonType::number_integer_t;
5201 using number_unsigned_t =
typename BasicJsonType::number_unsigned_t;
5202 using number_float_t =
typename BasicJsonType::number_float_t;
5204 const auto type =
static_cast<std::size_t
>(j.type());
5207 case BasicJsonType::value_t::null:
5208 case BasicJsonType::value_t::discarded:
5216 for (
const auto&
element : j.items())
5218 const auto h = std::hash<string_t> {}(
element.key());
5225 case BasicJsonType::value_t::array:
5235 case BasicJsonType::value_t::string:
5237 const auto h = std::hash<string_t> {}(j.template get_ref<const string_t&>());
5241 case BasicJsonType::value_t::boolean:
5243 const auto h = std::hash<bool> {}(j.template get<bool>());
5247 case BasicJsonType::value_t::number_integer:
5249 const auto h = std::hash<number_integer_t> {}(j.template get<number_integer_t>());
5253 case BasicJsonType::value_t::number_unsigned:
5255 const auto h = std::hash<number_unsigned_t> {}(j.template get<number_unsigned_t>());
5259 case BasicJsonType::value_t::number_float:
5261 const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>());
5265 case BasicJsonType::value_t::binary:
5268 const auto h = std::hash<bool> {}(j.get_binary().has_subtype());
5270 seed =
combine(seed,
static_cast<std::size_t
>(j.get_binary().subtype()));
5271 for (
const auto byte : j.get_binary())
5273 seed =
combine(seed, std::hash<std::uint8_t> {}(byte));
5290 #include <algorithm>
5315 #include <type_traits>
5321 #endif // JSON_NO_IO
5363 return std::fgetc(
m_file);
5392 is->clear(
is->rdstate() & std::ios::eofbit);
5397 :
is(&i),
sb(i.rdbuf())
5406 :
is(rhs.is),
sb(rhs.sb)
5417 auto res =
sb->sbumpc();
5421 is->clear(
is->rdstate() | std::ios::eofbit);
5428 std::istream*
is =
nullptr;
5429 std::streambuf*
sb =
nullptr;
5431 #endif // JSON_NO_IO
5435 template<
typename IteratorType>
5439 using char_type =
typename std::iterator_traits<IteratorType>::value_type;
5449 auto result = std::char_traits<char_type>::to_int_type(*
current);
5454 return std::char_traits<char_type>::eof();
5461 template<
typename BaseInputAdapter,
size_t T>
5471 template<
typename BaseInputAdapter,
size_t T>
5474 template<
typename BaseInputAdapter>
5479 std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
5480 size_t& utf8_bytes_index,
5481 size_t& utf8_bytes_filled)
5483 utf8_bytes_index = 0;
5487 utf8_bytes[0] = std::char_traits<char>::eof();
5488 utf8_bytes_filled = 1;
5493 const auto wc = input.get_character();
5498 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5499 utf8_bytes_filled = 1;
5501 else if (wc <= 0x7FF)
5503 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xC0u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x1Fu));
5504 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5505 utf8_bytes_filled = 2;
5507 else if (wc <= 0xFFFF)
5509 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xE0u | ((
static_cast<unsigned int>(wc) >> 12u) & 0x0Fu));
5510 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
5511 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5512 utf8_bytes_filled = 3;
5514 else if (wc <= 0x10FFFF)
5516 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xF0u | ((
static_cast<unsigned int>(wc) >> 18u) & 0x07u));
5517 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 12u) & 0x3Fu));
5518 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
5519 utf8_bytes[3] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5520 utf8_bytes_filled = 4;
5525 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5526 utf8_bytes_filled = 1;
5532 template<
typename BaseInputAdapter>
5537 std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
5538 size_t& utf8_bytes_index,
5539 size_t& utf8_bytes_filled)
5541 utf8_bytes_index = 0;
5545 utf8_bytes[0] = std::char_traits<char>::eof();
5546 utf8_bytes_filled = 1;
5551 const auto wc = input.get_character();
5556 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5557 utf8_bytes_filled = 1;
5559 else if (wc <= 0x7FF)
5561 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xC0u | ((
static_cast<unsigned int>(wc) >> 6u)));
5562 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5563 utf8_bytes_filled = 2;
5565 else if (0xD800 > wc || wc >= 0xE000)
5567 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xE0u | ((
static_cast<unsigned int>(wc) >> 12u)));
5568 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
5569 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5570 utf8_bytes_filled = 3;
5576 const auto wc2 =
static_cast<unsigned int>(input.get_character());
5577 const auto charcode = 0x10000u + (((
static_cast<unsigned int>(wc) & 0x3FFu) << 10u) | (wc2 & 0x3FFu));
5578 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xF0u | (charcode >> 18u));
5579 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((charcode >> 12u) & 0x3Fu));
5580 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((charcode >> 6u) & 0x3Fu));
5581 utf8_bytes[3] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (charcode & 0x3Fu));
5582 utf8_bytes_filled = 4;
5586 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5587 utf8_bytes_filled = 1;
5595 template<
typename BaseInputAdapter,
typename W
ideCharType>
5609 fill_buffer<sizeof(WideCharType)>();
5631 std::array<std::char_traits<char>::int_type, 4>
utf8_bytes = {{0, 0, 0, 0}};
5640 template<
typename IteratorType,
typename Enable =
void>
5644 using char_type =
typename std::iterator_traits<iterator_type>::value_type;
5649 return adapter_type(std::move(first), std::move(last));
5653 template<
typename T>
5663 template<
typename IteratorType>
5667 using char_type =
typename std::iterator_traits<iterator_type>::value_type;
5678 template<
typename IteratorType>
5682 return factory_type::create(first, last);
5689 namespace container_input_adapter_factory_impl
5695 template<
typename ContainerType,
typename Enable =
void>
5698 template<
typename ContainerType>
5700 void_t<decltype(begin(
std::declval<ContainerType>()), end(std::declval<ContainerType>()))>>
5712 template<
typename ContainerType>
5734 #endif // JSON_NO_IO
5739 template <
typename CharT,
5740 typename std::enable_if <
5748 auto length = std::strlen(
reinterpret_cast<const char*
>(
b));
5749 const auto* ptr =
reinterpret_cast<const char*
>(
b);
5753 template<
typename T, std::
size_t N>
5765 template <
typename CharT,
5766 typename std::enable_if <
5772 : ia(
reinterpret_cast<const char*
>(
b),
reinterpret_cast<const char*
>(
b) +
l) {}
5774 template<
class IteratorType,
5775 typename std::enable_if<
5776 std::is_same<typename iterator_traits<IteratorType>::iterator_category, std::random_access_iterator_tag>::value,
5783 return std::move(ia);
5816 template<
typename BasicJsonType>
5829 virtual bool null() = 0;
5836 virtual bool boolean(
bool val) = 0;
5920 const std::string& last_token,
5947 template<
typename BasicJsonType>
5963 :
root(
r), allow_exceptions(allow_exceptions_)
5975 handle_value(
nullptr);
6011 handle_value(std::move(val));
6030 object_element = &(ref_stack.back()->m_value.object->operator[](val));
6036 ref_stack.back()->set_parents();
6037 ref_stack.pop_back();
6043 ref_stack.push_back(handle_value(BasicJsonType::value_t::array));
6055 ref_stack.back()->set_parents();
6056 ref_stack.pop_back();
6060 template<
class Exception>
6062 const Exception& ex)
6065 static_cast<void>(ex);
6066 if (allow_exceptions)
6085 template<
typename Value>
6089 if (ref_stack.empty())
6091 root = BasicJsonType(std::forward<Value>(v));
6095 JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object());
6097 if (ref_stack.back()->is_array())
6099 ref_stack.back()->m_value.array->emplace_back(std::forward<Value>(v));
6100 return &(ref_stack.back()->m_value.array->back());
6105 *object_element = BasicJsonType(std::forward<Value>(v));
6106 return object_element;
6112 std::vector<BasicJsonType*> ref_stack {};
6114 BasicJsonType* object_element =
nullptr;
6116 bool errored =
false;
6118 const bool allow_exceptions =
true;
6121 template<
typename BasicJsonType>
6135 const bool allow_exceptions_ =
true)
6136 :
root(
r), callback(cb), allow_exceptions(allow_exceptions_)
6138 keep_stack.push_back(
true);
6150 handle_value(
nullptr);
6186 handle_value(std::move(val));
6193 const bool keep = callback(
static_cast<int>(ref_stack.size()), parse_event_t::object_start,
discarded);
6194 keep_stack.push_back(keep);
6197 ref_stack.push_back(val.second);
6200 if (ref_stack.back() &&
JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size()))
6210 BasicJsonType k = BasicJsonType(val);
6213 const bool keep = callback(
static_cast<int>(ref_stack.size()),
parse_event_t::key, k);
6214 key_keep_stack.push_back(keep);
6217 if (keep && ref_stack.back())
6219 object_element = &(ref_stack.back()->m_value.object->operator[](val) =
discarded);
6227 if (ref_stack.back())
6229 if (!callback(
static_cast<int>(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back()))
6236 ref_stack.back()->set_parents();
6242 ref_stack.pop_back();
6243 keep_stack.pop_back();
6245 if (!ref_stack.empty() && ref_stack.back() && ref_stack.back()->is_structured())
6248 for (
auto it = ref_stack.back()->begin(); it != ref_stack.back()->end(); ++it)
6250 if (it->is_discarded())
6252 ref_stack.back()->erase(it);
6263 const bool keep = callback(
static_cast<int>(ref_stack.size()), parse_event_t::array_start,
discarded);
6264 keep_stack.push_back(keep);
6266 auto val = handle_value(BasicJsonType::value_t::array,
true);
6267 ref_stack.push_back(val.second);
6270 if (ref_stack.back() &&
JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size()))
6282 if (ref_stack.back())
6284 keep = callback(
static_cast<int>(ref_stack.size()) - 1, parse_event_t::array_end, *ref_stack.back());
6287 ref_stack.back()->set_parents();
6298 ref_stack.pop_back();
6299 keep_stack.pop_back();
6302 if (!keep && !ref_stack.empty() && ref_stack.back()->is_array())
6304 ref_stack.back()->m_value.array->pop_back();
6310 template<
class Exception>
6312 const Exception& ex)
6315 static_cast<void>(ex);
6316 if (allow_exceptions)
6344 template<
typename Value>
6351 if (!keep_stack.back())
6353 return {
false,
nullptr};
6357 auto value = BasicJsonType(std::forward<Value>(v));
6360 const bool keep = skip_callback || callback(
static_cast<int>(ref_stack.size()),
parse_event_t::value, value);
6365 return {
false,
nullptr};
6368 if (ref_stack.empty())
6370 root = std::move(value);
6371 return {
true, &
root};
6376 if (!ref_stack.back())
6378 return {
false,
nullptr};
6382 JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object());
6385 if (ref_stack.back()->is_array())
6387 ref_stack.back()->m_value.array->emplace_back(std::move(value));
6388 return {
true, &(ref_stack.back()->m_value.array->back())};
6395 const bool store_element = key_keep_stack.back();
6396 key_keep_stack.pop_back();
6400 return {
false,
nullptr};
6404 *object_element = std::move(value);
6405 return {
true, object_element};
6411 std::vector<BasicJsonType*> ref_stack {};
6413 std::vector<bool> keep_stack {};
6415 std::vector<bool> key_keep_stack {};
6417 BasicJsonType* object_element =
nullptr;
6419 bool errored =
false;
6423 const bool allow_exceptions =
true;
6425 BasicJsonType
discarded = BasicJsonType::value_t::discarded;
6428 template<
typename BasicJsonType>
6515 #include <initializer_list>
6535 template<
typename BasicJsonType>
6569 return "<uninitialized>";
6571 return "true literal";
6573 return "false literal";
6575 return "null literal";
6577 return "string literal";
6581 return "number literal";
6595 return "<parse error>";
6597 return "end of input";
6599 return "'[', '{', or a literal";
6602 return "unknown token";
6612 template<
typename BasicJsonType,
typename InputAdapterType>
6625 explicit lexer(InputAdapterType&& adapter,
bool ignore_comments_ =
false) noexcept
6626 :
ia(
std::move(adapter))
6647 const auto* loc = localeconv();
6649 return (loc->decimal_point ==
nullptr) ?
'.' : *(loc->decimal_point);
6677 const auto factors = { 12u, 8u, 4u, 0u };
6678 for (
const auto factor : factors)
6684 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x30u) << factor);
6688 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x37u) << factor);
6692 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x57u) << factor);
6700 JSON_ASSERT(0x0000 <= codepoint && codepoint <= 0xFFFF);
6721 JSON_ASSERT(ranges.size() == 2 || ranges.size() == 4 || ranges.size() == 6);
6724 for (
auto range = ranges.begin(); range != ranges.end(); ++range)
6770 case std::char_traits<char_type>::eof():
6773 return token_type::parse_error;
6779 return token_type::value_string;
6824 int codepoint = codepoint1;
6828 error_message =
"invalid string: '\\u' must be followed by 4 hex digits";
6829 return token_type::parse_error;
6833 if (0xD800 <= codepoint1 && codepoint1 <= 0xDBFF)
6842 error_message =
"invalid string: '\\u' must be followed by 4 hex digits";
6843 return token_type::parse_error;
6850 codepoint =
static_cast<int>(
6852 (
static_cast<unsigned int>(codepoint1) << 10u)
6854 +
static_cast<unsigned int>(codepoint2)
6862 error_message =
"invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF";
6863 return token_type::parse_error;
6868 error_message =
"invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF";
6869 return token_type::parse_error;
6876 error_message =
"invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF";
6877 return token_type::parse_error;
6882 JSON_ASSERT(0x00 <= codepoint && codepoint <= 0x10FFFF);
6885 if (codepoint < 0x80)
6890 else if (codepoint <= 0x7FF)
6893 add(
static_cast<char_int_type>(0xC0u | (
static_cast<unsigned int>(codepoint) >> 6u)));
6894 add(
static_cast<char_int_type>(0x80u | (
static_cast<unsigned int>(codepoint) & 0x3Fu)));
6896 else if (codepoint <= 0xFFFF)
6899 add(
static_cast<char_int_type>(0xE0u | (
static_cast<unsigned int>(codepoint) >> 12u)));
6900 add(
static_cast<char_int_type>(0x80u | ((
static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
6901 add(
static_cast<char_int_type>(0x80u | (
static_cast<unsigned int>(codepoint) & 0x3Fu)));
6906 add(
static_cast<char_int_type>(0xF0u | (
static_cast<unsigned int>(codepoint) >> 18u)));
6907 add(
static_cast<char_int_type>(0x80u | ((
static_cast<unsigned int>(codepoint) >> 12u) & 0x3Fu)));
6908 add(
static_cast<char_int_type>(0x80u | ((
static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
6909 add(
static_cast<char_int_type>(0x80u | (
static_cast<unsigned int>(codepoint) & 0x3Fu)));
6917 error_message =
"invalid string: forbidden character after backslash";
6918 return token_type::parse_error;
6927 error_message =
"invalid string: control character U+0000 (NUL) must be escaped to \\u0000";
6928 return token_type::parse_error;
6933 error_message =
"invalid string: control character U+0001 (SOH) must be escaped to \\u0001";
6934 return token_type::parse_error;
6939 error_message =
"invalid string: control character U+0002 (STX) must be escaped to \\u0002";
6940 return token_type::parse_error;
6945 error_message =
"invalid string: control character U+0003 (ETX) must be escaped to \\u0003";
6946 return token_type::parse_error;
6951 error_message =
"invalid string: control character U+0004 (EOT) must be escaped to \\u0004";
6952 return token_type::parse_error;
6957 error_message =
"invalid string: control character U+0005 (ENQ) must be escaped to \\u0005";
6958 return token_type::parse_error;
6963 error_message =
"invalid string: control character U+0006 (ACK) must be escaped to \\u0006";
6964 return token_type::parse_error;
6969 error_message =
"invalid string: control character U+0007 (BEL) must be escaped to \\u0007";
6970 return token_type::parse_error;
6975 error_message =
"invalid string: control character U+0008 (BS) must be escaped to \\u0008 or \\b";
6976 return token_type::parse_error;
6981 error_message =
"invalid string: control character U+0009 (HT) must be escaped to \\u0009 or \\t";
6982 return token_type::parse_error;
6987 error_message =
"invalid string: control character U+000A (LF) must be escaped to \\u000A or \\n";
6988 return token_type::parse_error;
6993 error_message =
"invalid string: control character U+000B (VT) must be escaped to \\u000B";
6994 return token_type::parse_error;
6999 error_message =
"invalid string: control character U+000C (FF) must be escaped to \\u000C or \\f";
7000 return token_type::parse_error;
7005 error_message =
"invalid string: control character U+000D (CR) must be escaped to \\u000D or \\r";
7006 return token_type::parse_error;
7011 error_message =
"invalid string: control character U+000E (SO) must be escaped to \\u000E";
7012 return token_type::parse_error;
7017 error_message =
"invalid string: control character U+000F (SI) must be escaped to \\u000F";
7018 return token_type::parse_error;
7023 error_message =
"invalid string: control character U+0010 (DLE) must be escaped to \\u0010";
7024 return token_type::parse_error;
7029 error_message =
"invalid string: control character U+0011 (DC1) must be escaped to \\u0011";
7030 return token_type::parse_error;
7035 error_message =
"invalid string: control character U+0012 (DC2) must be escaped to \\u0012";
7036 return token_type::parse_error;
7041 error_message =
"invalid string: control character U+0013 (DC3) must be escaped to \\u0013";
7042 return token_type::parse_error;
7047 error_message =
"invalid string: control character U+0014 (DC4) must be escaped to \\u0014";
7048 return token_type::parse_error;
7053 error_message =
"invalid string: control character U+0015 (NAK) must be escaped to \\u0015";
7054 return token_type::parse_error;
7059 error_message =
"invalid string: control character U+0016 (SYN) must be escaped to \\u0016";
7060 return token_type::parse_error;
7065 error_message =
"invalid string: control character U+0017 (ETB) must be escaped to \\u0017";
7066 return token_type::parse_error;
7071 error_message =
"invalid string: control character U+0018 (CAN) must be escaped to \\u0018";
7072 return token_type::parse_error;
7077 error_message =
"invalid string: control character U+0019 (EM) must be escaped to \\u0019";
7078 return token_type::parse_error;
7083 error_message =
"invalid string: control character U+001A (SUB) must be escaped to \\u001A";
7084 return token_type::parse_error;
7089 error_message =
"invalid string: control character U+001B (ESC) must be escaped to \\u001B";
7090 return token_type::parse_error;
7095 error_message =
"invalid string: control character U+001C (FS) must be escaped to \\u001C";
7096 return token_type::parse_error;
7101 error_message =
"invalid string: control character U+001D (GS) must be escaped to \\u001D";
7102 return token_type::parse_error;
7107 error_message =
"invalid string: control character U+001E (RS) must be escaped to \\u001E";
7108 return token_type::parse_error;
7113 error_message =
"invalid string: control character U+001F (US) must be escaped to \\u001F";
7114 return token_type::parse_error;
7251 return token_type::parse_error;
7261 return token_type::parse_error;
7285 return token_type::parse_error;
7295 return token_type::parse_error;
7305 return token_type::parse_error;
7317 return token_type::parse_error;
7327 return token_type::parse_error;
7336 return token_type::parse_error;
7359 case std::char_traits<char_type>::eof():
7376 case std::char_traits<char_type>::eof():
7407 error_message =
"invalid comment; expecting '/' or '*' after '/'";
7414 static
void strtof(
float& f, const
char*
str,
char** endptr) noexcept
7416 f = std::strtof(
str, endptr);
7420 static
void strtof(
double& f, const
char*
str,
char** endptr) noexcept
7422 f = std::strtod(
str, endptr);
7426 static
void strtof(
long double& f, const
char*
str,
char** endptr) noexcept
7428 f = std::strtold(
str, endptr);
7478 token_type number_type = token_type::value_unsigned;
7486 goto scan_number_minus;
7492 goto scan_number_zero;
7506 goto scan_number_any1;
7516 number_type = token_type::value_integer;
7522 goto scan_number_zero;
7536 goto scan_number_any1;
7542 return token_type::parse_error;
7553 goto scan_number_decimal1;
7560 goto scan_number_exponent;
7564 goto scan_number_done;
7583 goto scan_number_any1;
7589 goto scan_number_decimal1;
7596 goto scan_number_exponent;
7600 goto scan_number_done;
7603 scan_number_decimal1:
7605 number_type = token_type::value_float;
7620 goto scan_number_decimal2;
7626 return token_type::parse_error;
7630 scan_number_decimal2:
7646 goto scan_number_decimal2;
7653 goto scan_number_exponent;
7657 goto scan_number_done;
7660 scan_number_exponent:
7662 number_type = token_type::value_float;
7669 goto scan_number_sign;
7684 goto scan_number_any2;
7690 "invalid number; expected '+', '-', or digit after exponent";
7691 return token_type::parse_error;
7711 goto scan_number_any2;
7716 error_message =
"invalid number; expected digit after exponent sign";
7717 return token_type::parse_error;
7737 goto scan_number_any2;
7741 goto scan_number_done;
7749 char* endptr =
nullptr;
7753 if (number_type == token_type::value_unsigned)
7755 const auto x = std::strtoull(
token_buffer.data(), &endptr, 10);
7765 return token_type::value_unsigned;
7769 else if (number_type == token_type::value_integer)
7771 const auto x = std::strtoll(
token_buffer.data(), &endptr, 10);
7781 return token_type::value_integer;
7793 return token_type::value_float;
7806 for (std::size_t i = 1; i < length; ++i)
7811 return token_type::parse_error;
7905 token_buffer.push_back(
static_cast<typename string_t::value_type
>(
c));
7956 if (
static_cast<unsigned char>(
c) <=
'\x1F')
7959 std::array<char, 9> cs{{}};
7960 (std::snprintf)(cs.data(), cs.size(),
"<U+%.4X>",
static_cast<unsigned char>(
c));
7966 result.push_back(
static_cast<std::string::value_type
>(
c));
7993 return get() == 0xBB &&
get() == 0xBF;
8016 error_message =
"invalid BOM; must be 0xEF 0xBB 0xBF if given";
8017 return token_type::parse_error;
8028 return token_type::parse_error;
8039 return token_type::begin_array;
8041 return token_type::end_array;
8043 return token_type::begin_object;
8045 return token_type::end_object;
8047 return token_type::name_separator;
8049 return token_type::value_separator;
8055 return scan_literal(true_literal.data(), true_literal.size(), token_type::literal_true);
8060 return scan_literal(false_literal.data(), false_literal.size(), token_type::literal_false);
8065 return scan_literal(null_literal.data(), null_literal.size(), token_type::literal_null);
8089 case std::char_traits<char_type>::eof():
8090 return token_type::end_of_input;
8095 return token_type::parse_error;
8153 template<
typename T>
8156 template<
typename T>
8158 decltype(std::declval<T&>().
boolean(std::declval<bool>()));
8160 template<
typename T,
typename Integer>
8164 template<
typename T,
typename Un
signed>
8168 template<
typename T,
typename Float,
typename String>
8170 std::declval<Float>(), std::declval<const String&>()));
8172 template<
typename T,
typename String>
8174 decltype(std::declval<T&>().
string(std::declval<String&>()));
8176 template<
typename T,
typename Binary>
8178 decltype(std::declval<T&>().
binary(std::declval<Binary&>()));
8180 template<
typename T>
8182 decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));
8184 template<
typename T,
typename String>
8186 decltype(std::declval<T&>().key(std::declval<String&>()));
8188 template<
typename T>
8191 template<
typename T>
8193 decltype(std::declval<T&>().start_array(std::declval<std::size_t>()));
8195 template<
typename T>
8198 template<
typename T,
typename Exception>
8200 std::declval<std::size_t>(), std::declval<const std::string&>(),
8201 std::declval<const Exception&>()));
8203 template<
typename SAX,
typename BasicJsonType>
8208 "BasicJsonType must be of type basic_json<...>");
8234 template<
typename SAX,
typename BasicJsonType>
8239 "BasicJsonType must be of type basic_json<...>");
8250 "Missing/invalid function: bool null()");
8252 "Missing/invalid function: bool boolean(bool)");
8254 "Missing/invalid function: bool boolean(bool)");
8258 "Missing/invalid function: bool number_integer(number_integer_t)");
8262 "Missing/invalid function: bool number_unsigned(number_unsigned_t)");
8265 "Missing/invalid function: bool number_float(number_float_t, const string_t&)");
8268 "Missing/invalid function: bool string(string_t&)");
8271 "Missing/invalid function: bool binary(binary_t&)");
8273 "Missing/invalid function: bool start_object(std::size_t)");
8275 "Missing/invalid function: bool key(string_t&)");
8277 "Missing/invalid function: bool end_object()");
8279 "Missing/invalid function: bool start_array(std::size_t)");
8281 "Missing/invalid function: bool end_array()");
8284 "Missing/invalid function: bool parse_error(std::size_t, const "
8285 "std::string&, const exception&)");
8317 return *
reinterpret_cast<char*
>(&num) == 1;
8328 template<
typename BasicJsonType,
typename InputAdapterType,
typename SAX = json_sax_dom_parser<BasicJsonType>>
8369 const
bool strict = true,
8431 std::int32_t document_size{};
8444 return sax->end_object();
8468 *
out++ =
static_cast<typename string_t::value_type
>(
current);
8483 template<
typename NumberType>
8504 template<
typename NumberType>
8514 std::uint8_t subtype{};
8516 result.set_subtype(subtype);
8532 const std::size_t element_type_parse_position)
8534 switch (element_type)
8568 return sax->boolean(
get() != 0);
8578 std::int32_t value{};
8584 std::int64_t value{};
8590 std::array<char, 3> cr{{}};
8591 (std::snprintf)(cr.data(), cr.size(),
"%.2hhX",
static_cast<unsigned char>(element_type));
8592 return sax->parse_error(element_type_parse_position, std::string(cr.data()),
parse_error::create(114, element_type_parse_position,
"Unsupported BSON record type 0x" + std::string(cr.data()), BasicJsonType()));
8613 while (
auto element_type =
get())
8620 const std::size_t element_type_parse_position =
chars_read;
8626 if (!is_array && !
sax->key(key))
8649 std::int32_t document_size{};
8662 return sax->end_array();
8683 case std::char_traits<char_type>::eof():
8715 std::uint8_t number{};
8721 std::uint16_t number{};
8727 std::uint32_t number{};
8733 std::uint64_t number{};
8762 return sax->number_integer(
static_cast<std::int8_t
>(0x20 - 1 -
current));
8766 std::uint8_t number{};
8772 std::uint16_t number{};
8778 std::uint32_t number{};
8784 std::uint64_t number{};
8884 return get_cbor_array(
static_cast<std::size_t
>(
static_cast<unsigned int>(
current) & 0x1Fu), tag_handler);
8894 std::uint16_t len{};
8900 std::uint32_t len{};
8906 std::uint64_t len{};
8938 return get_cbor_object(
static_cast<std::size_t
>(
static_cast<unsigned int>(
current) & 0x1Fu), tag_handler);
8948 std::uint16_t len{};
8954 std::uint32_t len{};
8960 std::uint64_t len{};
8987 switch (tag_handler)
9002 std::uint8_t subtype_to_ignore{};
9008 std::uint16_t subtype_to_ignore{};
9014 std::uint32_t subtype_to_ignore{};
9020 std::uint64_t subtype_to_ignore{};
9038 std::uint8_t subtype{};
9040 b.set_subtype(detail::conditional_static_cast<typename binary_t::subtype_type>(subtype));
9045 std::uint16_t subtype{};
9047 b.set_subtype(detail::conditional_static_cast<typename binary_t::subtype_type>(subtype));
9052 std::uint32_t subtype{};
9054 b.set_subtype(detail::conditional_static_cast<typename binary_t::subtype_type>(subtype));
9059 std::uint64_t subtype{};
9061 b.set_subtype(detail::conditional_static_cast<typename binary_t::subtype_type>(subtype));
9078 return sax->boolean(
false);
9081 return sax->boolean(
true);
9088 const auto byte1_raw =
get();
9093 const auto byte2_raw =
get();
9099 const auto byte1 =
static_cast<unsigned char>(byte1_raw);
9100 const auto byte2 =
static_cast<unsigned char>(byte2_raw);
9110 const auto half =
static_cast<unsigned int>((byte1 << 8u) + byte2);
9111 const double val = [&half]
9113 const int exp = (half >> 10u) & 0x1Fu;
9114 const unsigned int mant = half & 0x3FFu;
9120 return std::ldexp(mant, -24);
9123 ? std::numeric_limits<double>::infinity()
9124 : std::numeric_limits<double>::quiet_NaN();
9126 return std::ldexp(mant + 1024, exp - 25);
9129 return sax->number_float((half & 0x8000u) != 0
9211 std::uint16_t len{};
9217 std::uint32_t len{};
9223 std::uint64_t len{};
9229 while (
get() != 0xFF)
9307 std::uint16_t len{};
9314 std::uint32_t len{};
9321 std::uint64_t len{};
9328 while (
get() != 0xFF)
9335 result.insert(
result.end(), chunk.begin(), chunk.end());
9362 if (len != std::size_t(-1))
9364 for (std::size_t i = 0; i < len; ++i)
9374 while (
get() != 0xFF)
9383 return sax->end_array();
9403 if (len != std::size_t(-1))
9405 for (std::size_t i = 0; i < len; ++i)
9422 while (
get() != 0xFF)
9438 return sax->end_object();
9453 case std::char_traits<char_type>::eof():
9670 return sax->boolean(
false);
9673 return sax->boolean(
true);
9705 std::uint8_t number{};
9711 std::uint16_t number{};
9717 std::uint32_t number{};
9723 std::uint64_t number{};
9729 std::int8_t number{};
9735 std::int16_t number{};
9741 std::int32_t number{};
9747 std::int64_t number{};
9753 std::uint16_t len{};
9759 std::uint32_t len{};
9765 std::uint16_t len{};
9771 std::uint32_t len{};
9808 return sax->number_integer(
static_cast<std::int8_t
>(
current));
9882 std::uint16_t len{};
9888 std::uint32_t len{};
9913 auto assign_and_return_true = [&
result](std::int8_t subtype)
9915 result.set_subtype(
static_cast<std::uint8_t
>(subtype));
9930 std::uint16_t len{};
9937 std::uint32_t len{};
9945 std::int8_t subtype{};
9949 assign_and_return_true(subtype);
9954 std::uint16_t len{};
9955 std::int8_t subtype{};
9959 assign_and_return_true(subtype);
9964 std::uint32_t len{};
9965 std::int8_t subtype{};
9969 assign_and_return_true(subtype);
9974 std::int8_t subtype{};
9977 assign_and_return_true(subtype);
9982 std::int8_t subtype{};
9985 assign_and_return_true(subtype);
9990 std::int8_t subtype{};
9993 assign_and_return_true(subtype);
9998 std::int8_t subtype{};
10001 assign_and_return_true(subtype);
10006 std::int8_t subtype{};
10009 assign_and_return_true(subtype);
10028 for (std::size_t i = 0; i < len; ++i)
10036 return sax->end_array();
10051 for (std::size_t i = 0; i < len; ++i)
10066 return sax->end_object();
10115 std::uint8_t len{};
10127 std::int16_t len{};
10133 std::int32_t len{};
10139 std::int64_t len{};
10145 return sax->parse_error(
chars_read, last_token,
parse_error::create(113,
chars_read,
exception_message(
input_format_t::ubjson,
"expected length type specification (U, i, I, l, L); last byte: 0x" + last_token,
"string"), BasicJsonType()));
10159 std::uint8_t number{};
10164 result =
static_cast<std::size_t
>(number);
10170 std::int8_t number{};
10175 result =
static_cast<std::size_t
>(number);
10181 std::int16_t number{};
10186 result =
static_cast<std::size_t
>(number);
10192 std::int32_t number{};
10197 result =
static_cast<std::size_t
>(number);
10203 std::int64_t number{};
10208 result =
static_cast<std::size_t
>(number);
10215 return sax->parse_error(
chars_read, last_token,
parse_error::create(113,
chars_read,
exception_message(
input_format_t::ubjson,
"expected length type specification (U, i, I, l, L) after '#'; last byte: 0x" + last_token,
"size"), BasicJsonType()));
10232 result.first = string_t::npos;
10275 case std::char_traits<char_type>::eof():
10279 return sax->boolean(
true);
10281 return sax->boolean(
false);
10284 return sax->null();
10288 std::uint8_t number{};
10294 std::int8_t number{};
10300 std::int16_t number{};
10306 std::int32_t number{};
10312 std::int64_t number{};
10346 return sax->string(s);
10374 std::pair<std::size_t, char_int_type> size_and_type;
10380 if (size_and_type.first != string_t::npos)
10387 if (size_and_type.second != 0)
10389 if (size_and_type.second !=
'N')
10391 for (std::size_t i = 0; i < size_and_type.first; ++i)
10402 for (std::size_t i = 0; i < size_and_type.first; ++i)
10428 return sax->end_array();
10436 std::pair<std::size_t, char_int_type> size_and_type;
10443 if (size_and_type.first != string_t::npos)
10450 if (size_and_type.second != 0)
10452 for (std::size_t i = 0; i < size_and_type.first; ++i)
10467 for (std::size_t i = 0; i < size_and_type.first; ++i)
10503 return sax->end_object();
10512 std::size_t size{};
10520 std::vector<char> number_vector;
10521 for (std::size_t i = 0; i < size; ++i)
10528 number_vector.push_back(
static_cast<char>(
current));
10534 const auto result_number = number_lexer.scan();
10535 const auto number_string = number_lexer.get_token_string();
10536 const auto result_remainder = number_lexer.scan();
10545 switch (result_number)
10547 case token_type::value_integer:
10548 return sax->number_integer(number_lexer.get_number_integer());
10549 case token_type::value_unsigned:
10550 return sax->number_unsigned(number_lexer.get_number_unsigned());
10551 case token_type::value_float:
10552 return sax->number_float(number_lexer.get_number_float(), std::move(number_string));
10553 case token_type::uninitialized:
10554 case token_type::literal_true:
10555 case token_type::literal_false:
10556 case token_type::literal_null:
10557 case token_type::value_string:
10558 case token_type::begin_array:
10559 case token_type::begin_object:
10560 case token_type::end_array:
10561 case token_type::end_object:
10562 case token_type::name_separator:
10563 case token_type::value_separator:
10564 case token_type::parse_error:
10565 case token_type::end_of_input:
10566 case token_type::literal_or_value:
10618 template<
typename NumberType,
bool InputIsLittleEndian = false>
10622 std::array<std::uint8_t,
sizeof(NumberType)> vec{};
10623 for (std::size_t i = 0; i <
sizeof(NumberType); ++i)
10634 vec[
sizeof(NumberType) - i - 1] =
static_cast<std::uint8_t
>(
current);
10638 vec[i] =
static_cast<std::uint8_t
>(
current);
10643 std::memcpy(&
result, vec.data(),
sizeof(NumberType));
10661 template<
typename NumberType>
10663 const NumberType len,
10666 bool success =
true;
10667 for (NumberType i = 0; i < len; i++)
10675 result.push_back(
static_cast<typename string_t::value_type
>(
current));
10694 template<
typename NumberType>
10696 const NumberType len,
10699 bool success =
true;
10700 for (NumberType i = 0; i < len; i++)
10734 std::array<char, 3> cr{{}};
10735 (std::snprintf)(cr.data(), cr.size(),
"%.2hhX",
static_cast<unsigned char>(
current));
10736 return std::string{cr.data()};
10746 const std::string& detail,
10747 const std::string& context)
const
10749 std::string error_msg =
"syntax error while parsing ";
10754 error_msg +=
"CBOR";
10758 error_msg +=
"MessagePack";
10762 error_msg +=
"UBJSON";
10766 error_msg +=
"BSON";
10774 return error_msg +
" " + context +
": " + detail;
10805 #include <functional>
10849 template<
typename BasicJsonType>
10858 template<
typename BasicJsonType,
typename InputAdapterType>
10872 const bool allow_exceptions_ =
true,
10873 const bool skip_comments =
false)
10875 ,
m_lexer(
std::move(adapter), skip_comments)
10917 if (
result.is_discarded())
10943 result.assert_invariant();
10958 template<
typename SAX>
10977 template<
typename SAX>
10983 std::vector<bool> states;
10985 bool skip_to_state_evaluation =
false;
10989 if (!skip_to_state_evaluation)
10994 case token_type::begin_object:
11002 if (
get_token() == token_type::end_object)
11032 states.push_back(
false);
11039 case token_type::begin_array:
11047 if (
get_token() == token_type::end_array)
11057 states.push_back(
true);
11063 case token_type::value_float:
11082 case token_type::literal_false:
11091 case token_type::literal_null:
11100 case token_type::literal_true:
11109 case token_type::value_integer:
11118 case token_type::value_string:
11127 case token_type::value_unsigned:
11136 case token_type::parse_error:
11144 case token_type::uninitialized:
11145 case token_type::end_array:
11146 case token_type::end_object:
11147 case token_type::name_separator:
11148 case token_type::value_separator:
11149 case token_type::end_of_input:
11150 case token_type::literal_or_value:
11161 skip_to_state_evaluation =
false;
11165 if (states.empty())
11174 if (
get_token() == token_type::value_separator)
11195 skip_to_state_evaluation =
true;
11207 if (
get_token() == token_type::value_separator)
11249 skip_to_state_evaluation =
true;
11267 std::string error_msg =
"syntax error ";
11269 if (!context.empty())
11271 error_msg +=
"while parsing " + context +
" ";
11286 if (expected != token_type::uninitialized)
11376 return lhs.m_it == rhs.m_it;
11381 return lhs.m_it < rhs.m_it;
11393 return lhs.m_it - rhs.m_it;
11463 #include <iterator>
11464 #include <type_traits>
11486 template<
typename IteratorType>
class iteration_proxy;
11487 template<
typename IteratorType>
class iteration_proxy_value;
11505 template<
typename BasicJsonType>
11520 "iter_impl only accepts (const) basic_json");
11537 typename BasicJsonType::const_pointer,
11542 typename BasicJsonType::const_reference,
11560 switch (m_object->m_type)
11607 : m_object(other.m_object),
m_it(other.m_it)
11618 if (&other !=
this)
11620 m_object = other.m_object;
11632 : m_object(other.m_object),
m_it(other.m_it)
11643 m_object = other.m_object;
11653 void set_begin() noexcept
11657 switch (m_object->m_type)
11701 switch (m_object->m_type)
11740 switch (m_object->m_type)
11784 switch (m_object->m_type)
11837 switch (m_object->m_type)
11888 switch (m_object->m_type)
11924 template <
typename IterImpl, detail::enable_if_t < (std::is_same<IterImpl, iter_impl>::value || std::is_same<IterImpl, other_iter_impl>::value), std::
nullptr_t > =
nullptr >
11935 switch (m_object->m_type)
11960 template <
typename IterImpl, detail::enable_if_t < (std::is_same<IterImpl, iter_impl>::value || std::is_same<IterImpl, other_iter_impl>::value), std::
nullptr_t > =
nullptr >
11980 switch (m_object->m_type)
12007 return !other.operator < (*this);
12036 switch (m_object->m_type)
12115 switch (m_object->m_type)
12144 switch (m_object->m_type)
12178 const typename object_t::key_type&
key()
const
12214 #include <iterator>
12243 template<
typename Base>
12317 auto it = --this->base();
12324 auto it = --this->base();
12325 return it.operator * ();
12336 #include <algorithm>
12355 template<
typename BasicJsonType>
12406 [](
const std::string &
a,
const std::string &
b)
12408 return a +
"/" + detail::escape(b);
12413 operator std::string()
const
12437 ptr.reference_tokens.begin(),
12438 ptr.reference_tokens.end());
12671 static typename BasicJsonType::size_type
array_index(
const std::string& s)
12673 using size_type =
typename BasicJsonType::size_type;
12687 std::size_t processed_chars = 0;
12688 unsigned long long res = 0;
12691 res = std::stoull(s, &processed_chars);
12711 return static_cast<size_type
>(
res);
12748 if (reference_token ==
"0")
12820 if (ptr->is_null())
12824 std::all_of(reference_token.begin(), reference_token.end(),
12825 [](
const unsigned char x)
12827 return std::isdigit(x);
12831 *ptr = (nums || reference_token ==
"-")
12836 switch (ptr->type())
12841 ptr = &ptr->operator[](reference_token);
12847 if (reference_token ==
"-")
12850 ptr = &ptr->operator[](ptr->m_value.array->size());
12855 ptr = &ptr->operator[](
array_index(reference_token));
12886 switch (ptr->type())
12891 ptr = &ptr->at(reference_token);
12901 "array index '-' (" +
std::to_string(ptr->m_value.array->size()) +
12902 ") is out of range", *ptr));
12943 switch (ptr->type())
12948 ptr = &ptr->operator[](reference_token);
12961 ptr = &ptr->operator[](
array_index(reference_token));
12991 switch (ptr->type())
12996 ptr = &ptr->at(reference_token);
13006 "array index '-' (" +
std::to_string(ptr->m_value.array->size()) +
13007 ") is out of range", *ptr));
13039 switch (ptr->type())
13043 if (!ptr->contains(reference_token))
13049 ptr = &ptr->operator[](reference_token);
13060 if (
JSON_HEDLEY_UNLIKELY(reference_token.size() == 1 && !(
"0" <= reference_token && reference_token <=
"9")))
13072 for (std::size_t i = 1; i < reference_token.size(); i++)
13083 if (idx >= ptr->size())
13089 ptr = &ptr->operator[](idx);
13123 static std::vector<std::string>
split(
const std::string& reference_string)
13125 std::vector<std::string>
result;
13128 if (reference_string.empty())
13144 std::size_t slash = reference_string.find_first_of(
'/', 1),
13151 start = (slash == std::string::npos) ? 0 : slash + 1,
13153 slash = reference_string.find_first_of(
'/', start))
13157 auto reference_token = reference_string.substr(start, slash - start);
13160 for (std::size_t pos = reference_token.find_first_of(
'~');
13161 pos != std::string::npos;
13162 pos = reference_token.find_first_of(
'~', pos + 1))
13168 (reference_token[pos + 1] !=
'0' &&
13169 reference_token[pos + 1] !=
'1')))
13191 static void flatten(
const std::string& reference_string,
13195 switch (
value.type())
13199 if (
value.m_value.array->empty())
13202 result[reference_string] =
nullptr;
13207 for (std::size_t i = 0; i <
value.m_value.array->size(); ++i)
13218 if (
value.m_value.object->empty())
13221 result[reference_string] =
nullptr;
13303 return lhs.reference_tokens == rhs.reference_tokens;
13320 return !(lhs == rhs);
13331 #include <initializer_list>
13341 template<
typename BasicJsonType>
13410 #include <algorithm>
13426 #include <algorithm>
13428 #include <iterator>
13436 #endif // JSON_NO_IO
13448 virtual void write_character(CharType
c) = 0;
13449 virtual void write_characters(
const CharType* s, std::size_t length) = 0;
13460 template<
typename CharType>
13464 template<
typename CharType>
13478 void write_characters(const CharType* s,
std::
size_t length)
override
13480 std::copy(s, s + length, std::back_inserter(v));
13484 std::vector<CharType>&
v;
13488 template<
typename CharType>
13503 void write_characters(const CharType* s,
std::
size_t length)
override
13505 stream.write(s,
static_cast<std::streamsize
>(length));
13511 #endif // JSON_NO_IO
13514 template<
typename CharType,
typename StringType = std::basic_
string<CharType>>
13528 void write_characters(const CharType* s,
std::
size_t length)
override
13530 str.append(s, length);
13537 template<
typename CharType,
typename StringType = std::basic_
string<CharType>>
13547 #endif // JSON_NO_IO
13575 template<
typename BasicJsonType,
typename CharType>
13638 oa->write_character(j.m_value.boolean
13646 if (j.m_value.number_integer >= 0)
13651 if (j.m_value.number_integer <= 0x17)
13653 write_number(
static_cast<std::uint8_t
>(j.m_value.number_integer));
13658 write_number(
static_cast<std::uint8_t
>(j.m_value.number_integer));
13663 write_number(
static_cast<std::uint16_t
>(j.m_value.number_integer));
13668 write_number(
static_cast<std::uint32_t
>(j.m_value.number_integer));
13673 write_number(
static_cast<std::uint64_t
>(j.m_value.number_integer));
13680 const auto positive_number = -1 - j.m_value.number_integer;
13681 if (j.m_value.number_integer >= -24)
13683 write_number(
static_cast<std::uint8_t
>(0x20 + positive_number));
13688 write_number(
static_cast<std::uint8_t
>(positive_number));
13693 write_number(
static_cast<std::uint16_t
>(positive_number));
13698 write_number(
static_cast<std::uint32_t
>(positive_number));
13703 write_number(
static_cast<std::uint64_t
>(positive_number));
13711 if (j.m_value.number_unsigned <= 0x17)
13713 write_number(
static_cast<std::uint8_t
>(j.m_value.number_unsigned));
13718 write_number(
static_cast<std::uint8_t
>(j.m_value.number_unsigned));
13723 write_number(
static_cast<std::uint16_t
>(j.m_value.number_unsigned));
13728 write_number(
static_cast<std::uint32_t
>(j.m_value.number_unsigned));
13733 write_number(
static_cast<std::uint64_t
>(j.m_value.number_unsigned));
13740 if (std::isnan(j.m_value.number_float))
13747 else if (std::isinf(j.m_value.number_float))
13764 const auto N = j.m_value.string->size();
13793 oa->write_characters(
13794 reinterpret_cast<const CharType*
>(j.m_value.string->c_str()),
13795 j.m_value.string->size());
13802 const auto N = j.m_value.array->size();
13831 for (
const auto& el : *j.m_value.array)
13840 if (j.m_value.binary->has_subtype())
13845 write_number(
static_cast<std::uint8_t
>(j.m_value.binary->subtype()));
13850 write_number(
static_cast<std::uint16_t
>(j.m_value.binary->subtype()));
13855 write_number(
static_cast<std::uint32_t
>(j.m_value.binary->subtype()));
13860 write_number(
static_cast<std::uint64_t
>(j.m_value.binary->subtype()));
13865 const auto N = j.m_value.binary->size();
13894 oa->write_characters(
13895 reinterpret_cast<const CharType*
>(j.m_value.binary->data()),
13904 const auto N = j.m_value.object->size();
13933 for (
const auto& el : *j.m_value.object)
13962 oa->write_character(j.m_value.boolean
13970 if (j.m_value.number_integer >= 0)
13975 if (j.m_value.number_unsigned < 128)
13978 write_number(
static_cast<std::uint8_t
>(j.m_value.number_integer));
13984 write_number(
static_cast<std::uint8_t
>(j.m_value.number_integer));
13990 write_number(
static_cast<std::uint16_t
>(j.m_value.number_integer));
13996 write_number(
static_cast<std::uint32_t
>(j.m_value.number_integer));
14002 write_number(
static_cast<std::uint64_t
>(j.m_value.number_integer));
14007 if (j.m_value.number_integer >= -32)
14010 write_number(
static_cast<std::int8_t
>(j.m_value.number_integer));
14012 else if (j.m_value.number_integer >= (std::numeric_limits<std::int8_t>::min)() &&
14017 write_number(
static_cast<std::int8_t
>(j.m_value.number_integer));
14019 else if (j.m_value.number_integer >= (std::numeric_limits<std::int16_t>::min)() &&
14024 write_number(
static_cast<std::int16_t
>(j.m_value.number_integer));
14026 else if (j.m_value.number_integer >= (std::numeric_limits<std::int32_t>::min)() &&
14031 write_number(
static_cast<std::int32_t
>(j.m_value.number_integer));
14033 else if (j.m_value.number_integer >= (std::numeric_limits<std::int64_t>::min)() &&
14038 write_number(
static_cast<std::int64_t
>(j.m_value.number_integer));
14046 if (j.m_value.number_unsigned < 128)
14049 write_number(
static_cast<std::uint8_t
>(j.m_value.number_integer));
14055 write_number(
static_cast<std::uint8_t
>(j.m_value.number_integer));
14061 write_number(
static_cast<std::uint16_t
>(j.m_value.number_integer));
14067 write_number(
static_cast<std::uint32_t
>(j.m_value.number_integer));
14073 write_number(
static_cast<std::uint64_t
>(j.m_value.number_integer));
14087 const auto N = j.m_value.string->size();
14113 oa->write_characters(
14114 reinterpret_cast<const CharType*
>(j.m_value.string->c_str()),
14115 j.m_value.string->size());
14122 const auto N = j.m_value.array->size();
14142 for (
const auto& el : *j.m_value.array)
14153 const bool use_ext = j.m_value.binary->has_subtype();
14156 const auto N = j.m_value.binary->size();
14159 std::uint8_t output_type{};
14166 output_type = 0xD4;
14169 output_type = 0xD5;
14172 output_type = 0xD6;
14175 output_type = 0xD7;
14178 output_type = 0xD8;
14181 output_type = 0xC7;
14189 output_type = 0xC4;
14201 std::uint8_t output_type = use_ext
14210 std::uint8_t output_type = use_ext
14221 write_number(
static_cast<std::int8_t
>(j.m_value.binary->subtype()));
14225 oa->write_characters(
14226 reinterpret_cast<const CharType*
>(j.m_value.binary->data()),
14235 const auto N = j.m_value.object->size();
14239 write_number(
static_cast<std::uint8_t
>(0x80 | (N & 0xF)));
14255 for (
const auto& el : *j.m_value.object)
14276 const bool use_type,
const bool add_prefix =
true)
14293 oa->write_character(j.m_value.boolean
14325 oa->write_characters(
14326 reinterpret_cast<const CharType*
>(j.m_value.string->c_str()),
14327 j.m_value.string->size());
14338 bool prefix_required =
true;
14339 if (use_type && !j.m_value.array->empty())
14343 const bool same_prefix = std::all_of(j.begin() + 1, j.end(),
14344 [
this, first_prefix](
const BasicJsonType & v)
14346 return ubjson_prefix(v) == first_prefix;
14351 prefix_required =
false;
14353 oa->write_character(first_prefix);
14363 for (
const auto& el : *j.m_value.array)
14365 write_ubjson(el, use_count, use_type, prefix_required);
14383 if (use_type && !j.m_value.binary->empty())
14387 oa->write_character(
'U');
14398 oa->write_characters(
14399 reinterpret_cast<const CharType*
>(j.m_value.binary->data()),
14400 j.m_value.binary->size());
14404 for (
size_t i = 0; i < j.m_value.binary->size(); ++i)
14407 oa->write_character(j.m_value.binary->data()[i]);
14426 bool prefix_required =
true;
14427 if (use_type && !j.m_value.object->empty())
14431 const bool same_prefix = std::all_of(j.begin(), j.end(),
14432 [
this, first_prefix](
const BasicJsonType & v)
14434 return ubjson_prefix(v) == first_prefix;
14439 prefix_required =
false;
14441 oa->write_character(first_prefix);
14451 for (
const auto& el : *j.m_value.object)
14454 oa->write_characters(
14455 reinterpret_cast<const CharType*
>(el.first.c_str()),
14457 write_ubjson(el.second, use_count, use_type, prefix_required);
14485 const auto it =
name.find(
static_cast<typename string_t::value_type
>(0));
14489 static_cast<void>(j);
14492 return 1ul +
name.size() + 1u;
14499 const std::uint8_t element_type)
14502 oa->write_characters(
14503 reinterpret_cast<const CharType*
>(
name.c_str()),
14521 const double value)
14524 write_number<double, true>(value);
14532 return sizeof(std::int32_t) + value.size() + 1ul;
14543 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(value.size() + 1ul));
14544 oa->write_characters(
14545 reinterpret_cast<const CharType*
>(value.c_str()),
14563 ?
sizeof(std::int32_t)
14564 :
sizeof(std::int64_t);
14571 const std::int64_t value)
14576 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(value));
14581 write_number<std::int64_t, true>(
static_cast<std::int64_t
>(value));
14591 ?
sizeof(std::int32_t)
14592 :
sizeof(std::int64_t);
14599 const BasicJsonType& j)
14604 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(j.m_value.number_unsigned));
14609 write_number<std::int64_t, true>(
static_cast<std::int64_t
>(j.m_value.number_unsigned));
14621 const typename BasicJsonType::object_t& value)
14632 std::size_t array_index = 0ul;
14634 const std::size_t embedded_document_size = std::accumulate(std::begin(value), std::end(value), std::size_t(0), [&array_index](std::size_t
result,
const typename BasicJsonType::array_t::value_type & el)
14639 return sizeof(std::int32_t) + embedded_document_size + 1ul;
14647 return sizeof(std::int32_t) + value.size() + 1ul;
14654 const typename BasicJsonType::array_t& value)
14659 std::size_t array_index = 0ul;
14661 for (
const auto& el : value)
14677 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(value.size()));
14678 write_number(value.has_subtype() ?
static_cast<std::uint8_t
>(value.subtype()) : std::uint8_t(0x00));
14680 oa->write_characters(
reinterpret_cast<const CharType*
>(value.data()), value.size());
14688 const BasicJsonType& j)
14703 return header_size + 1ul;
14706 return header_size + 8ul;
14718 return header_size + 0ul;
14736 const BasicJsonType& j)
14784 std::size_t document_size = std::accumulate(value.begin(), value.end(), std::size_t(0),
14785 [](
size_t result,
const typename BasicJsonType::object_t::value_type & el)
14787 return result += calc_bson_element_size(el.first, el.second);
14790 return sizeof(std::int32_t) + document_size + 1ul;
14801 for (
const auto& el : value)
14842 template<
typename NumberType,
typename std::enable_if<
14845 const bool add_prefix)
14855 template<
typename NumberType,
typename std::enable_if<
14858 const bool add_prefix)
14907 const auto number = BasicJsonType(n).dump();
14909 for (std::size_t i = 0; i < number.size(); ++i)
14911 oa->write_character(
to_char_type(
static_cast<std::uint8_t
>(number[i])));
14917 template <
typename NumberType,
typename std::enable_if <
14921 const bool add_prefix)
14971 const auto number = BasicJsonType(n).dump();
14973 for (std::size_t i = 0; i < number.size(); ++i)
14975 oa->write_character(
to_char_type(
static_cast<std::uint8_t
>(number[i])));
14992 return j.m_value.boolean ?
'T' :
'F';
15090 template<
typename NumberType,
bool OutputIsLittleEndian = false>
15094 std::array<CharType,
sizeof(NumberType)> vec{};
15095 std::memcpy(vec.data(), &n,
sizeof(NumberType));
15101 std::reverse(vec.begin(), vec.end());
15104 oa->write_characters(vec.data(),
sizeof(NumberType));
15110 #pragma GCC diagnostic push
15111 #pragma GCC diagnostic ignored "-Wfloat-equal"
15113 if (
static_cast<double>(n) >=
static_cast<double>(std::numeric_limits<float>::lowest()) &&
15115 static_cast<double>(
static_cast<float>(n)) ==
static_cast<double>(n))
15130 #pragma GCC diagnostic pop
15139 template <
typename C = CharType,
15143 return *
reinterpret_cast<char*
>(&
x);
15146 template <
typename C = CharType,
15150 static_assert(
sizeof(std::uint8_t) ==
sizeof(CharType),
"size of CharType must be equal to std::uint8_t");
15153 std::memcpy(&
result, &
x,
sizeof(
x));
15157 template<
typename C = CharType,
15164 template <
typename InputCharType,
typename C = CharType,
15190 #include <algorithm>
15199 #include <type_traits>
15210 #include <type_traits>
15239 namespace dtoa_impl
15242 template<
typename Target,
typename Source>
15245 static_assert(
sizeof(
Target) ==
sizeof(Source),
"size mismatch");
15248 std::memcpy(&target, &source,
sizeof(Source));
15259 constexpr
diyfp(std::uint64_t f_,
int e_) noexcept :
f(f_),
e(e_) {}
15270 return {
x.f -
y.f,
x.e};
15279 static_assert(
kPrecision == 64,
"internal error");
15304 const std::uint64_t u_lo =
x.f & 0xFFFFFFFFu;
15305 const std::uint64_t u_hi =
x.f >> 32u;
15306 const std::uint64_t v_lo =
y.f & 0xFFFFFFFFu;
15307 const std::uint64_t v_hi =
y.f >> 32u;
15309 const std::uint64_t p0 = u_lo * v_lo;
15310 const std::uint64_t p1 = u_lo * v_hi;
15311 const std::uint64_t p2 = u_hi * v_lo;
15312 const std::uint64_t p3 = u_hi * v_hi;
15314 const std::uint64_t p0_hi = p0 >> 32u;
15315 const std::uint64_t p1_lo = p1 & 0xFFFFFFFFu;
15316 const std::uint64_t p1_hi = p1 >> 32u;
15317 const std::uint64_t p2_lo = p2 & 0xFFFFFFFFu;
15318 const std::uint64_t p2_hi = p2 >> 32u;
15320 std::uint64_t Q = p0_hi + p1_lo + p2_lo;
15331 Q += std::uint64_t{1} << (64u - 32u - 1u);
15333 const std::uint64_t h = p3 + p2_hi + p1_hi + (Q >> 32u);
15335 return {h,
x.e +
y.e + 64};
15346 while ((
x.f >> 63u) == 0)
15361 const int delta =
x.e - target_exponent;
15366 return {
x.f << delta, target_exponent};
15383 template<
typename FloatType>
15396 static_assert(std::numeric_limits<FloatType>::is_iec559,
15397 "internal error: dtoa_short requires an IEEE-754 floating-point implementation");
15399 constexpr
int kPrecision = std::numeric_limits<FloatType>::digits;
15400 constexpr
int kBias = std::numeric_limits<FloatType>::max_exponent - 1 + (kPrecision - 1);
15401 constexpr
int kMinExp = 1 - kBias;
15402 constexpr std::uint64_t kHiddenBit = std::uint64_t{1} << (kPrecision - 1);
15406 const auto bits =
static_cast<std::uint64_t
>(reinterpret_bits<bits_type>(value));
15407 const std::uint64_t E = bits >> (kPrecision - 1);
15408 const std::uint64_t F = bits & (kHiddenBit - 1);
15410 const bool is_denormal = E == 0;
15411 const diyfp v = is_denormal
15412 ?
diyfp(F, kMinExp)
15413 :
diyfp(F + kHiddenBit,
static_cast<int>(E) - kBias);
15436 const bool lower_boundary_is_closer = F == 0 && E > 1;
15438 const diyfp m_minus = lower_boundary_is_closer
15439 ?
diyfp(4 * v.
f - 1, v.
e - 2)
15440 :
diyfp(2 * v.
f - 1, v.
e - 1);
15575 constexpr
int kCachedPowersMinDecExp = -300;
15576 constexpr
int kCachedPowersDecStep = 8;
15578 static constexpr std::array<cached_power, 79> kCachedPowers =
15581 { 0xAB70FE17C79AC6CA, -1060, -300 },
15582 { 0xFF77B1FCBEBCDC4F, -1034, -292 },
15583 { 0xBE5691EF416BD60C, -1007, -284 },
15584 { 0x8DD01FAD907FFC3C, -980, -276 },
15585 { 0xD3515C2831559A83, -954, -268 },
15586 { 0x9D71AC8FADA6C9B5, -927, -260 },
15587 { 0xEA9C227723EE8BCB, -901, -252 },
15588 { 0xAECC49914078536D, -874, -244 },
15589 { 0x823C12795DB6CE57, -847, -236 },
15590 { 0xC21094364DFB5637, -821, -228 },
15591 { 0x9096EA6F3848984F, -794, -220 },
15592 { 0xD77485CB25823AC7, -768, -212 },
15593 { 0xA086CFCD97BF97F4, -741, -204 },
15594 { 0xEF340A98172AACE5, -715, -196 },
15595 { 0xB23867FB2A35B28E, -688, -188 },
15596 { 0x84C8D4DFD2C63F3B, -661, -180 },
15597 { 0xC5DD44271AD3CDBA, -635, -172 },
15598 { 0x936B9FCEBB25C996, -608, -164 },
15599 { 0xDBAC6C247D62A584, -582, -156 },
15600 { 0xA3AB66580D5FDAF6, -555, -148 },
15601 { 0xF3E2F893DEC3F126, -529, -140 },
15602 { 0xB5B5ADA8AAFF80B8, -502, -132 },
15603 { 0x87625F056C7C4A8B, -475, -124 },
15604 { 0xC9BCFF6034C13053, -449, -116 },
15605 { 0x964E858C91BA2655, -422, -108 },
15606 { 0xDFF9772470297EBD, -396, -100 },
15607 { 0xA6DFBD9FB8E5B88F, -369, -92 },
15608 { 0xF8A95FCF88747D94, -343, -84 },
15609 { 0xB94470938FA89BCF, -316, -76 },
15610 { 0x8A08F0F8BF0F156B, -289, -68 },
15611 { 0xCDB02555653131B6, -263, -60 },
15612 { 0x993FE2C6D07B7FAC, -236, -52 },
15613 { 0xE45C10C42A2B3B06, -210, -44 },
15614 { 0xAA242499697392D3, -183, -36 },
15615 { 0xFD87B5F28300CA0E, -157, -28 },
15616 { 0xBCE5086492111AEB, -130, -20 },
15617 { 0x8CBCCC096F5088CC, -103, -12 },
15618 { 0xD1B71758E219652C, -77, -4 },
15619 { 0x9C40000000000000, -50, 4 },
15620 { 0xE8D4A51000000000, -24, 12 },
15621 { 0xAD78EBC5AC620000, 3, 20 },
15622 { 0x813F3978F8940984, 30, 28 },
15623 { 0xC097CE7BC90715B3, 56, 36 },
15624 { 0x8F7E32CE7BEA5C70, 83, 44 },
15625 { 0xD5D238A4ABE98068, 109, 52 },
15626 { 0x9F4F2726179A2245, 136, 60 },
15627 { 0xED63A231D4C4FB27, 162, 68 },
15628 { 0xB0DE65388CC8ADA8, 189, 76 },
15629 { 0x83C7088E1AAB65DB, 216, 84 },
15630 { 0xC45D1DF942711D9A, 242, 92 },
15631 { 0x924D692CA61BE758, 269, 100 },
15632 { 0xDA01EE641A708DEA, 295, 108 },
15633 { 0xA26DA3999AEF774A, 322, 116 },
15634 { 0xF209787BB47D6B85, 348, 124 },
15635 { 0xB454E4A179DD1877, 375, 132 },
15636 { 0x865B86925B9BC5C2, 402, 140 },
15637 { 0xC83553C5C8965D3D, 428, 148 },
15638 { 0x952AB45CFA97A0B3, 455, 156 },
15639 { 0xDE469FBD99A05FE3, 481, 164 },
15640 { 0xA59BC234DB398C25, 508, 172 },
15641 { 0xF6C69A72A3989F5C, 534, 180 },
15642 { 0xB7DCBF5354E9BECE, 561, 188 },
15643 { 0x88FCF317F22241E2, 588, 196 },
15644 { 0xCC20CE9BD35C78A5, 614, 204 },
15645 { 0x98165AF37B2153DF, 641, 212 },
15646 { 0xE2A0B5DC971F303A, 667, 220 },
15647 { 0xA8D9D1535CE3B396, 694, 228 },
15648 { 0xFB9B7CD9A4A7443C, 720, 236 },
15649 { 0xBB764C4CA7A44410, 747, 244 },
15650 { 0x8BAB8EEFB6409C1A, 774, 252 },
15651 { 0xD01FEF10A657842C, 800, 260 },
15652 { 0x9B10A4E5E9913129, 827, 268 },
15653 { 0xE7109BFBA19C0C9D, 853, 276 },
15654 { 0xAC2820D9623BF429, 880, 284 },
15655 { 0x80444B5E7AA7CF85, 907, 292 },
15656 { 0xBF21E44003ACDD2D, 933, 300 },
15657 { 0x8E679C2F5E44FF8F, 960, 308 },
15658 { 0xD433179D9C8CB841, 986, 316 },
15659 { 0x9E19DB92B4E31BA9, 1013, 324 },
15669 const int f =
kAlpha - e - 1;
15670 const int k = (f * 78913) / (1 << 18) +
static_cast<int>(f > 0);
15672 const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep;
15690 if (n >= 1000000000)
15692 pow10 = 1000000000;
15696 if (n >= 100000000)
15742 std::uint64_t
rest, std::uint64_t ten_k)
15769 && delta -
rest >= ten_k
15770 && (
rest + ten_k < dist || dist - rest >
rest + ten_k - dist))
15785 static_assert(
kAlpha >= -60,
"internal error");
15786 static_assert(
kGamma <= -32,
"internal error");
15803 std::uint64_t delta =
diyfp::sub(M_plus, M_minus).
f;
15813 const diyfp one(std::uint64_t{1} << -M_plus.
e, M_plus.
e);
15815 auto p1 =
static_cast<std::uint32_t
>(M_plus.
f >> -one.e);
15816 std::uint64_t p2 = M_plus.
f & (one.f - 1);
15824 std::uint32_t pow10{};
15852 const std::uint32_t d = p1 / pow10;
15853 const std::uint32_t
r = p1 % pow10;
15859 buffer[length++] =
static_cast<char>(
'0' + d);
15878 const std::uint64_t
rest = (std::uint64_t{p1} << -one.e) + p2;
15883 decimal_exponent += n;
15894 const std::uint64_t ten_n = std::uint64_t{pow10} << -one.e;
15958 const std::uint64_t d = p2 >> -one.e;
15959 const std::uint64_t
r = p2 & (one.f - 1);
15966 buffer[length++] =
static_cast<char>(
'0' + d);
15991 decimal_exponent -=
m;
15999 const std::uint64_t ten_m = one.f;
16040 const diyfp c_minus_k(cached.
f, cached.
e);
16068 const diyfp M_minus(w_minus.
f + 1, w_minus.
e);
16069 const diyfp M_plus (w_plus.
f - 1, w_plus.
e );
16071 decimal_exponent = -cached.
k;
16081 template<
typename FloatType>
16086 "internal error: not enough precision");
16138 auto k =
static_cast<std::uint32_t
>(e);
16144 *
buf++ =
static_cast<char>(
'0' + k);
16148 *
buf++ =
static_cast<char>(
'0' + k / 10);
16150 *
buf++ =
static_cast<char>(
'0' + k);
16154 *
buf++ =
static_cast<char>(
'0' + k / 100);
16156 *
buf++ =
static_cast<char>(
'0' + k / 10);
16158 *
buf++ =
static_cast<char>(
'0' + k);
16176 int min_exp,
int max_exp)
16182 const int n = len + decimal_exponent;
16188 if (k <= n && n <= max_exp)
16193 std::memset(
buf + k,
'0',
static_cast<size_t>(n) -
static_cast<size_t>(k));
16197 return buf + (
static_cast<size_t>(n) + 2);
16200 if (0 < n && n <= max_exp)
16207 std::memmove(
buf + (
static_cast<size_t>(n) + 1),
buf + n,
static_cast<size_t>(k) -
static_cast<size_t>(n));
16209 return buf + (
static_cast<size_t>(k) + 1U);
16212 if (min_exp < n && n <= 0)
16217 std::memmove(
buf + (2 +
static_cast<size_t>(-n)),
buf,
static_cast<size_t>(k));
16220 std::memset(
buf + 2,
'0',
static_cast<size_t>(-n));
16221 return buf + (2U +
static_cast<size_t>(-n) +
static_cast<size_t>(k));
16236 std::memmove(
buf + 2,
buf + 1,
static_cast<size_t>(k) - 1);
16238 buf += 1 +
static_cast<size_t>(k);
16257 template<
typename FloatType>
16260 char*
to_chars(
char* first, const
char* last, FloatType value)
16262 static_cast<void>(last);
16266 if (std::signbit(value))
16273 #pragma GCC diagnostic push
16274 #pragma GCC diagnostic ignored "-Wfloat-equal"
16285 #pragma GCC diagnostic pop
16288 JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
16295 int decimal_exponent = 0;
16298 JSON_ASSERT(len <= std::numeric_limits<FloatType>::max_digits10);
16301 constexpr
int kMinExp = -4;
16303 constexpr
int kMaxExp = std::numeric_limits<FloatType>::digits10;
16306 JSON_ASSERT(last - first >= 2 + (-kMinExp - 1) + std::numeric_limits<FloatType>::max_digits10);
16307 JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10 + 6);
16344 template<
typename BasicJsonType>
16364 ,
loc(
std::localeconv())
16402 const bool pretty_print,
16404 const unsigned int indent_step,
16405 const unsigned int current_indent = 0)
16407 switch (val.m_type)
16411 if (val.m_value.object->empty())
16413 o->write_characters(
"{}", 2);
16419 o->write_characters(
"{\n", 2);
16422 const auto new_indent = current_indent + indent_step;
16429 auto i = val.m_value.object->cbegin();
16430 for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
16433 o->write_character(
'\"');
16435 o->write_characters(
"\": ", 3);
16437 o->write_characters(
",\n", 2);
16444 o->write_character(
'\"');
16446 o->write_characters(
"\": ", 3);
16449 o->write_character(
'\n');
16451 o->write_character(
'}');
16455 o->write_character(
'{');
16458 auto i = val.m_value.object->cbegin();
16459 for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
16461 o->write_character(
'\"');
16463 o->write_characters(
"\":", 2);
16465 o->write_character(
',');
16471 o->write_character(
'\"');
16473 o->write_characters(
"\":", 2);
16476 o->write_character(
'}');
16484 if (val.m_value.array->empty())
16486 o->write_characters(
"[]", 2);
16492 o->write_characters(
"[\n", 2);
16495 const auto new_indent = current_indent + indent_step;
16502 for (
auto i = val.m_value.array->cbegin();
16503 i != val.m_value.array->cend() - 1; ++i)
16507 o->write_characters(
",\n", 2);
16513 dump(val.m_value.array->back(),
true,
ensure_ascii, indent_step, new_indent);
16515 o->write_character(
'\n');
16517 o->write_character(
']');
16521 o->write_character(
'[');
16524 for (
auto i = val.m_value.array->cbegin();
16525 i != val.m_value.array->cend() - 1; ++i)
16528 o->write_character(
',');
16533 dump(val.m_value.array->back(),
false,
ensure_ascii, indent_step, current_indent);
16535 o->write_character(
']');
16543 o->write_character(
'\"');
16545 o->write_character(
'\"');
16553 o->write_characters(
"{\n", 2);
16556 const auto new_indent = current_indent + indent_step;
16564 o->write_characters(
"\"bytes\": [", 10);
16566 if (!val.m_value.binary->empty())
16568 for (
auto i = val.m_value.binary->cbegin();
16569 i != val.m_value.binary->cend() - 1; ++i)
16572 o->write_characters(
", ", 2);
16574 dump_integer(val.m_value.binary->back());
16577 o->write_characters(
"],\n", 3);
16580 o->write_characters(
"\"subtype\": ", 11);
16581 if (val.m_value.binary->has_subtype())
16583 dump_integer(val.m_value.binary->subtype());
16587 o->write_characters(
"null", 4);
16589 o->write_character(
'\n');
16591 o->write_character(
'}');
16595 o->write_characters(
"{\"bytes\":[", 10);
16597 if (!val.m_value.binary->empty())
16599 for (
auto i = val.m_value.binary->cbegin();
16600 i != val.m_value.binary->cend() - 1; ++i)
16603 o->write_character(
',');
16605 dump_integer(val.m_value.binary->back());
16608 o->write_characters(
"],\"subtype\":", 12);
16609 if (val.m_value.binary->has_subtype())
16611 dump_integer(val.m_value.binary->subtype());
16612 o->write_character(
'}');
16616 o->write_characters(
"null}", 5);
16624 if (val.m_value.boolean)
16626 o->write_characters(
"true", 4);
16630 o->write_characters(
"false", 5);
16637 dump_integer(val.m_value.number_integer);
16643 dump_integer(val.m_value.number_unsigned);
16649 dump_float(val.m_value.number_float);
16655 o->write_characters(
"<discarded>", 11);
16661 o->write_characters(
"null", 4);
16687 std::uint32_t codepoint{};
16695 for (std::size_t i = 0; i < s.size(); ++i)
16697 const auto byte =
static_cast<std::uint8_t
>(s[i]);
16699 switch (decode(
state, codepoint,
byte))
16758 if ((codepoint <= 0x1F) || (
ensure_ascii && (codepoint >= 0x7F)))
16760 if (codepoint <= 0xFFFF)
16764 static_cast<std::uint16_t
>(codepoint));
16771 static_cast<std::uint16_t
>(0xD7C0u + (codepoint >> 10u)),
16772 static_cast<std::uint16_t
>(0xDC00u + (codepoint & 0x3FFu)));
16807 std::string sn(9,
'\0');
16809 (std::snprintf)(&sn[0], sn.size(),
"%.2X", byte);
16902 std::string sn(9,
'\0');
16904 (std::snprintf)(&sn[0], sn.size(),
"%.2X",
static_cast<std::uint8_t
>(s.back()));
16922 o->write_characters(
"\\ufffd", 6);
16926 o->write_characters(
"\xEF\xBF\xBD", 3);
16948 unsigned int n_digits = 1;
16957 return n_digits + 1;
16961 return n_digits + 2;
16965 return n_digits + 3;
16987 void dump_integer(NumberType
x)
16989 static constexpr std::array<std::array<char, 2>, 100> digits_to_99
16992 {{
'0',
'0'}}, {{
'0',
'1'}}, {{
'0',
'2'}}, {{
'0',
'3'}}, {{
'0',
'4'}}, {{
'0',
'5'}}, {{
'0',
'6'}}, {{
'0',
'7'}}, {{
'0',
'8'}}, {{
'0',
'9'}},
16993 {{
'1',
'0'}}, {{
'1',
'1'}}, {{
'1',
'2'}}, {{
'1',
'3'}}, {{
'1',
'4'}}, {{
'1',
'5'}}, {{
'1',
'6'}}, {{
'1',
'7'}}, {{
'1',
'8'}}, {{
'1',
'9'}},
16994 {{
'2',
'0'}}, {{
'2',
'1'}}, {{
'2',
'2'}}, {{
'2',
'3'}}, {{
'2',
'4'}}, {{
'2',
'5'}}, {{
'2',
'6'}}, {{
'2',
'7'}}, {{
'2',
'8'}}, {{
'2',
'9'}},
16995 {{
'3',
'0'}}, {{
'3',
'1'}}, {{
'3',
'2'}}, {{
'3',
'3'}}, {{
'3',
'4'}}, {{
'3',
'5'}}, {{
'3',
'6'}}, {{
'3',
'7'}}, {{
'3',
'8'}}, {{
'3',
'9'}},
16996 {{
'4',
'0'}}, {{
'4',
'1'}}, {{
'4',
'2'}}, {{
'4',
'3'}}, {{
'4',
'4'}}, {{
'4',
'5'}}, {{
'4',
'6'}}, {{
'4',
'7'}}, {{
'4',
'8'}}, {{
'4',
'9'}},
16997 {{
'5',
'0'}}, {{
'5',
'1'}}, {{
'5',
'2'}}, {{
'5',
'3'}}, {{
'5',
'4'}}, {{
'5',
'5'}}, {{
'5',
'6'}}, {{
'5',
'7'}}, {{
'5',
'8'}}, {{
'5',
'9'}},
16998 {{
'6',
'0'}}, {{
'6',
'1'}}, {{
'6',
'2'}}, {{
'6',
'3'}}, {{
'6',
'4'}}, {{
'6',
'5'}}, {{
'6',
'6'}}, {{
'6',
'7'}}, {{
'6',
'8'}}, {{
'6',
'9'}},
16999 {{
'7',
'0'}}, {{
'7',
'1'}}, {{
'7',
'2'}}, {{
'7',
'3'}}, {{
'7',
'4'}}, {{
'7',
'5'}}, {{
'7',
'6'}}, {{
'7',
'7'}}, {{
'7',
'8'}}, {{
'7',
'9'}},
17000 {{
'8',
'0'}}, {{
'8',
'1'}}, {{
'8',
'2'}}, {{
'8',
'3'}}, {{
'8',
'4'}}, {{
'8',
'5'}}, {{
'8',
'6'}}, {{
'8',
'7'}}, {{
'8',
'8'}}, {{
'8',
'9'}},
17001 {{
'9',
'0'}}, {{
'9',
'1'}}, {{
'9',
'2'}}, {{
'9',
'3'}}, {{
'9',
'4'}}, {{
'9',
'5'}}, {{
'9',
'6'}}, {{
'9',
'7'}}, {{
'9',
'8'}}, {{
'9',
'9'}},
17008 o->write_character(
'0');
17018 unsigned int n_chars{};
17026 n_chars = 1 + count_digits(abs_value);
17031 n_chars = count_digits(abs_value);
17039 buffer_ptr += n_chars;
17043 while (abs_value >= 100)
17045 const auto digits_index =
static_cast<unsigned>((abs_value % 100));
17047 *(--buffer_ptr) = digits_to_99[digits_index][1];
17048 *(--buffer_ptr) = digits_to_99[digits_index][0];
17051 if (abs_value >= 10)
17053 const auto digits_index =
static_cast<unsigned>(abs_value);
17054 *(--buffer_ptr) = digits_to_99[digits_index][1];
17055 *(--buffer_ptr) = digits_to_99[digits_index][0];
17059 *(--buffer_ptr) =
static_cast<char>(
'0' + abs_value);
17076 if (!std::isfinite(
x))
17078 o->write_characters(
"null", 4);
17087 static constexpr
bool is_ieee_single_or_double
17088 = (std::numeric_limits<number_float_t>::is_iec559 && std::numeric_limits<number_float_t>::digits == 24 && std::numeric_limits<number_float_t>::max_exponent == 128) ||
17089 (std::numeric_limits<number_float_t>::is_iec559 && std::numeric_limits<number_float_t>::digits == 53 && std::numeric_limits<number_float_t>::max_exponent == 1024);
17091 dump_float(
x, std::integral_constant<bool, is_ieee_single_or_double>());
17099 o->write_characters(begin,
static_cast<size_t>(end - begin));
17105 static constexpr
auto d = std::numeric_limits<number_float_t>::max_digits10;
17136 o->write_characters(
number_buffer.data(),
static_cast<std::size_t
>(len));
17139 const bool value_is_int_like =
17143 return c ==
'.' || c ==
'e';
17146 if (value_is_int_like)
17148 o->write_characters(
".0", 2);
17173 static std::uint8_t decode(std::uint8_t&
state, std::uint32_t& codep,
const std::uint8_t
byte) noexcept
17175 static const std::array<std::uint8_t, 400> utf8d =
17178 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
17179 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
17180 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
17181 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
17182 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
17183 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
17184 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
17185 0xA, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3,
17186 0xB, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8,
17187 0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, 0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1,
17188 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1,
17189 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
17190 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1,
17191 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
17196 const std::uint8_t
type = utf8d[byte];
17199 ? (
byte & 0x3fu) | (codep << 6u)
17200 : (0xFFu >>
type) & (byte);
17202 std::size_t
index = 256u +
static_cast<size_t>(
state) * 16u +
static_cast<size_t>(
type);
17236 output_adapter_t<char>
o =
nullptr;
17269 #include <functional>
17270 #include <initializer_list>
17271 #include <iterator>
17273 #include <stdexcept>
17274 #include <type_traits>
17286 template <
class Key,
class T,
class IgnoredLess = std::less<Key>,
17287 class Allocator = std::allocator<std::pair<const Key, T>>>
17288 struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>
17292 using Container = std::vector<std::pair<const Key, T>, Allocator>;
17293 using typename Container::iterator;
17294 using typename Container::const_iterator;
17295 using typename Container::size_type;
17296 using typename Container::value_type;
17301 template <
class It>
17309 for (
auto it = this->begin(); it != this->end(); ++it)
17311 if (it->first == key)
17313 return {it,
false};
17316 Container::emplace_back(key,
t);
17317 return {--this->end(),
true};
17322 return emplace(key, T{}).first->second;
17332 for (
auto it = this->begin(); it != this->end(); ++it)
17334 if (it->first == key)
17340 JSON_THROW(std::out_of_range(
"key not found"));
17343 const T&
at(
const Key& key)
const
17345 for (
auto it = this->begin(); it != this->end(); ++it)
17347 if (it->first == key)
17353 JSON_THROW(std::out_of_range(
"key not found"));
17358 for (
auto it = this->begin(); it != this->end(); ++it)
17360 if (it->first == key)
17363 for (
auto next = it; ++
next != this->end(); ++it)
17366 new (&*it) value_type{std::move(*
next)};
17368 Container::pop_back();
17380 for (
auto next = it; ++
next != this->end(); ++it)
17383 new (&*it) value_type{std::move(*
next)};
17385 Container::pop_back();
17391 for (
auto it = this->begin(); it != this->end(); ++it)
17393 if (it->first == key)
17403 for (
auto it = this->begin(); it != this->end(); ++it)
17405 if (it->first == key)
17410 return Container::end();
17413 const_iterator
find(
const Key& key)
const
17415 for (
auto it = this->begin(); it != this->end(); ++it)
17417 if (it->first == key)
17422 return Container::end();
17425 std::pair<iterator, bool>
insert( value_type&& value )
17427 return emplace(value.first, std::move(value.second));
17430 std::pair<iterator, bool>
insert(
const value_type& value )
17432 for (
auto it = this->begin(); it != this->end(); ++it)
17434 if (it->first == value.first)
17436 return {it,
false};
17439 Container::push_back(value);
17440 return {--this->end(),
true};
17443 template<
typename InputIt>
17444 using require_input_iter =
typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category,
17447 template<
typename InputIt,
typename = require_input_iter<InputIt>>
17450 for (
auto it = first; it != last; ++it)
17460 #if defined(JSON_HAS_CPP_17)
17461 #include <string_view>
17561 friend ::nlohmann::json_pointer<basic_json>;
17563 template<
typename BasicJsonType,
typename InputType>
17565 friend ::nlohmann::detail::serializer<basic_json>;
17566 template<
typename BasicJsonType>
17567 friend class ::nlohmann::detail::iter_impl;
17568 template<
typename BasicJsonType,
typename CharType>
17569 friend class ::nlohmann::detail::binary_writer;
17570 template<
typename BasicJsonType,
typename InputType,
typename SAX>
17571 friend class ::nlohmann::detail::binary_reader;
17572 template<
typename BasicJsonType>
17573 friend class ::nlohmann::detail::json_sax_dom_parser;
17574 template<
typename BasicJsonType>
17575 friend class ::nlohmann::detail::json_sax_dom_callback_parser;
17576 friend class ::nlohmann::detail::exception;
17585 template<
typename InputAdapterType>
17586 static ::nlohmann::detail::parser<basic_json, InputAdapterType>
parser(
17587 InputAdapterType adapter,
17589 const bool allow_exceptions =
true,
17590 const bool ignore_comments =
false
17593 return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),
17594 std::move(cb), allow_exceptions, ignore_comments);
17599 template<
typename BasicJsonType>
17601 template<
typename BasicJsonType>
17603 template<
typename Iterator>
17607 template<
typename CharType>
17610 template<
typename InputType>
17621 template<
typename T,
typename SFINAE>
17684 using pointer =
typename std::allocator_traits<allocator_type>::pointer;
17686 using const_pointer =
typename std::allocator_traits<allocator_type>::const_pointer;
17739 result[
"copyright"] =
"(C) 2013-2021 Niels Lohmann";
17740 result[
"name"] =
"JSON for Modern C++";
17741 result[
"url"] =
"https://github.com/nlohmann/json";
17742 result[
"version"][
"string"] =
17751 result[
"platform"] =
"win32";
17752 #elif defined __linux__
17753 result[
"platform"] =
"linux";
17754 #elif defined __APPLE__
17755 result[
"platform"] =
"apple";
17756 #elif defined __unix__
17757 result[
"platform"] =
"unix";
17759 result[
"platform"] =
"unknown";
17762 #if defined(__ICC) || defined(__INTEL_COMPILER)
17763 result[
"compiler"] = {{
"family",
"icc"}, {
"version", __INTEL_COMPILER}};
17764 #elif defined(__clang__)
17765 result[
"compiler"] = {{
"family",
"clang"}, {
"version", __clang_version__}};
17766 #elif defined(__GNUC__) || defined(__GNUG__)
17768 #elif defined(__HP_cc) || defined(__HP_aCC)
17769 result[
"compiler"] =
"hp"
17770 #elif defined(__IBMCPP__)
17771 result[
"compiler"] = {{
"family",
"ilecpp"}, {
"version", __IBMCPP__}};
17772 #elif defined(_MSC_VER)
17773 result[
"compiler"] = {{
"family",
"msvc"}, {
"version", _MSC_VER}};
17774 #elif defined(__PGI)
17775 result[
"compiler"] = {{
"family",
"pgcpp"}, {
"version", __PGI}};
17776 #elif defined(__SUNPRO_CC)
17777 result[
"compiler"] = {{
"family",
"sunpro"}, {
"version", __SUNPRO_CC}};
17779 result[
"compiler"] = {{
"family",
"unknown"}, {
"version",
"unknown"}};
17785 result[
"compiler"][
"c++"] =
"unknown";
17800 #if defined(JSON_HAS_CPP_14)
17891 using object_t = ObjectType<StringType,
17894 AllocatorType<std::pair<
const StringType,
17941 using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
18308 template<
typename T,
typename... Args>
18312 AllocatorType<T> alloc;
18313 using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
18315 auto deleter = [&](T *
obj)
18317 AllocatorTraits::deallocate(alloc,
obj, 1);
18319 std::unique_ptr<T, decltype(deleter)>
obj(AllocatorTraits::allocate(alloc, 1), deleter);
18320 AllocatorTraits::construct(alloc,
obj.get(), std::forward<Args>(
args)...);
18322 return obj.release();
18391 object = create<object_t>();
18397 array = create<array_t>();
18403 string = create<string_t>(
"");
18409 binary = create<binary_t>();
18459 string = create<string_t>(
value);
18465 string = create<string_t>(std::move(
value));
18471 object = create<object_t>(
value);
18477 object = create<object_t>(std::move(
value));
18521 std::vector<basic_json> stack;
18526 stack.reserve(
array->size());
18527 std::move(
array->begin(),
array->end(), std::back_inserter(stack));
18531 stack.reserve(
object->size());
18532 for (
auto&& it : *
object)
18534 stack.push_back(std::move(it.second));
18538 while (!stack.empty())
18541 basic_json current_item(std::move(stack.back()));
18546 if (current_item.is_array())
18548 std::move(current_item.m_value.array->begin(), current_item.m_value.array->end(), std::back_inserter(stack));
18550 current_item.m_value.array->clear();
18552 else if (current_item.is_object())
18554 for (
auto&& it : *current_item.m_value.object)
18556 stack.push_back(std::move(it.second));
18559 current_item.m_value.object->clear();
18571 AllocatorType<object_t> alloc;
18572 std::allocator_traits<decltype(alloc)>
::destroy(alloc,
object);
18573 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
object, 1);
18579 AllocatorType<array_t> alloc;
18581 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
array, 1);
18587 AllocatorType<string_t> alloc;
18588 std::allocator_traits<decltype(alloc)>
::destroy(alloc,
string);
18589 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
string, 1);
18595 AllocatorType<binary_t> alloc;
18597 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
binary, 1);
18641 #if JSON_DIAGNOSTICS
18647 return j.m_parent ==
this;
18652 static_cast<void>(check_parents);
18657 #if JSON_DIAGNOSTICS
18673 element.second.m_parent =
this;
18694 #if JSON_DIAGNOSTICS
18697 (it + i)->m_parent =
this;
18700 static_cast<void>(
count);
18707 #if JSON_DIAGNOSTICS
18708 if (old_capacity != std::size_t(-1))
18722 static_cast<void>(j);
18723 static_cast<void>(old_capacity);
18932 template <
typename CompatibleType,
18938 std::forward<CompatibleType>(val))))
18971 template <
typename BasicJsonType,
18976 using other_boolean_t =
typename BasicJsonType::boolean_t;
18977 using other_number_float_t =
typename BasicJsonType::number_float_t;
18978 using other_number_integer_t =
typename BasicJsonType::number_integer_t;
18979 using other_number_unsigned_t =
typename BasicJsonType::number_unsigned_t;
18980 using other_string_t =
typename BasicJsonType::string_t;
18981 using other_object_t =
typename BasicJsonType::object_t;
18982 using other_array_t =
typename BasicJsonType::array_t;
18983 using other_binary_t =
typename BasicJsonType::binary_t;
18985 switch (val.type())
19099 bool type_deduction =
true,
19104 bool is_an_object = std::all_of(
init.begin(),
init.end(),
19107 return element_ref->is_array() && element_ref->size() == 2 && (*element_ref)[0].is_string();
19111 if (!type_deduction)
19116 is_an_object =
false;
19132 for (
auto& element_ref :
init)
19136 std::move(*((*
element.m_value.array)[0].m_value.string)),
19137 std::move((*
element.m_value.array)[1]));
19230 res.m_value = std::move(
init);
19356 m_value.array = create<array_t>(cnt, val);
19416 template <
class InputIT,
typename std::enable_if <
19431 m_type = first.m_object->m_type;
19443 || !last.m_it.primitive_iterator.is_end()))
19463 m_value.number_integer = first.m_object->m_value.number_integer;
19469 m_value.number_unsigned = first.m_object->m_value.number_unsigned;
19475 m_value.number_float = first.m_object->m_value.number_float;
19481 m_value.boolean = first.m_object->m_value.boolean;
19487 m_value = *first.m_object->m_value.string;
19493 m_value.object = create<object_t>(first.m_it.object_iterator,
19494 last.m_it.object_iterator);
19500 m_value.array = create<array_t>(first.m_it.array_iterator,
19501 last.m_it.array_iterator);
19507 m_value = *first.m_object->m_value.binary;
19526 template<
typename JsonRef,
19528 std::is_same<typename JsonRef::value_type, basic_json>>
::value,
int> = 0 >
19557 : m_type(other.m_type)
19560 other.assert_invariant();
19566 m_value = *other.m_value.object;
19572 m_value = *other.m_value.array;
19578 m_value = *other.m_value.string;
19584 m_value = other.m_value.boolean;
19590 m_value = other.m_value.number_integer;
19596 m_value = other.m_value.number_unsigned;
19602 m_value = other.m_value.number_float;
19608 m_value = *other.m_value.binary;
19649 : m_type(std::move(other.m_type)),
19650 m_value(std::move(other.m_value))
19653 other.assert_invariant(
false);
19657 other.m_value = {};
19697 swap(m_type, other.m_type);
19785 const char indent_char =
' ',
19786 const bool ensure_ascii =
false,
19794 s.dump(*
this,
true, ensure_ascii,
static_cast<unsigned int>(indent));
19798 s.dump(*
this,
false, ensure_ascii, 0);
20325 template<
typename ReferenceType,
typename ThisType>
20370 template<
typename PointerType,
typename std::enable_if<
20375 return get_impl_ptr(
static_cast<PointerType
>(
nullptr));
20382 template <
typename PointerType,
typename std::enable_if <
20388 return get_impl_ptr(
static_cast<PointerType
>(
nullptr));
20430 template <
typename ValueType,
20473 template <
typename ValueType,
20498 template <
typename BasicJsonType,
20521 template<
typename BasicJsonType,
20534 template<
typename PointerType,
20539 -> decltype(std::declval<const basic_json_t&>().
template get_ptr<PointerType>())
20542 return get_ptr<PointerType>();
20569 template <
typename ValueTypeCV,
typename ValueType = detail::uncvref_t<ValueTypeCV>>
20570 #if defined(JSON_HAS_CPP_14)
20581 "get() cannot be used with reference types, you might want to use get_ref()");
20582 return get_impl<ValueType>(detail::priority_tag<4> {});
20612 template<
typename PointerType,
typename std::enable_if<
20617 return get_ptr<PointerType>();
20653 template <
typename ValueType,
20658 ValueType &
get_to(ValueType& v)
const noexcept(noexcept(
20667 template<
typename ValueType,
20678 typename T, std::size_t N,
20679 typename Array = T (&)[N],
20684 std::declval<const basic_json_t&>(), v)))
20716 template<
typename ReferenceType,
typename std::enable_if<
20721 return get_ref_impl<ReferenceType>(*
this);
20728 template <
typename ReferenceType,
typename std::enable_if <
20734 return get_ref_impl<ReferenceType>(*
this);
20766 template <
typename ValueType,
typename std::enable_if <
20774 #if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914))
20782 return get<ValueType>();
20801 return *get_ptr<binary_t*>();
20812 return *get_ptr<const binary_t*>();
20906 return m_value.array->at(idx);
21008 return m_value.object->at(key);
21053 m_value.array = create<array_t>();
21061 if (idx >=
m_value.array->size())
21063 #if JSON_DIAGNOSTICS
21065 const auto previous_size =
m_value.array->size();
21067 m_value.array->resize(idx + 1);
21069 #if JSON_DIAGNOSTICS
21075 return m_value.array->operator[](idx);
21105 return m_value.array->operator[](idx);
21144 m_value.object = create<object_t>();
21193 return m_value.object->find(key)->second;
21226 template<
typename T>
21277 template<
typename T>
21285 return m_value.object->find(key)->second;
21342 template <
class ValueType,
typename std::enable_if <
21345 ValueType
value(
const typename object_t::key_type& key,
const ValueType& default_value)
const
21351 const auto it =
find(key);
21354 return it->template get<ValueType>();
21357 return default_value;
21367 string_t value(
const typename object_t::key_type& key,
const char* default_value)
const
21415 template<
class ValueType,
typename std::enable_if<
21425 return ptr.get_checked(
this).template get<ValueType>();
21429 return default_value;
21578 template <
class IteratorType,
typename std::enable_if <
21608 AllocatorType<string_t> alloc;
21610 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.string, 1);
21615 AllocatorType<binary_t> alloc;
21617 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.binary, 1);
21628 result.m_it.object_iterator =
m_value.object->erase(pos.m_it.object_iterator);
21634 result.m_it.array_iterator =
m_value.array->erase(pos.m_it.array_iterator);
21693 template <
class IteratorType,
typename std::enable_if <
21697 IteratorType
erase(IteratorType first, IteratorType last)
21717 || !last.m_it.primitive_iterator.is_end()))
21724 AllocatorType<string_t> alloc;
21726 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.string, 1);
21731 AllocatorType<binary_t> alloc;
21733 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.binary, 1);
21744 result.m_it.object_iterator =
m_value.object->erase(first.m_it.object_iterator,
21745 last.m_it.object_iterator);
21751 result.m_it.array_iterator =
m_value.array->erase(first.m_it.array_iterator,
21752 last.m_it.array_iterator);
21799 return m_value.object->erase(key);
21881 template<
typename KeyT>
21888 result.m_it.object_iterator =
m_value.object->find(std::forward<KeyT>(key));
21898 template<
typename KeyT>
21905 result.m_it.object_iterator =
m_value.object->find(std::forward<KeyT>(key));
21932 template<
typename KeyT>
21964 template <
typename KeyT,
typename std::enable_if <
21999 return ptr.contains(
this);
22346 return ref.items();
22355 return ref.items();
22504 return m_value.array->empty();
22510 return m_value.object->empty();
22584 return m_value.array->size();
22590 return m_value.object->size();
22656 return m_value.array->max_size();
22662 return m_value.object->max_size();
22824 const auto old_capacity =
m_value.array->capacity();
22825 m_value.array->push_back(std::move(val));
22861 const auto old_capacity =
m_value.array->capacity();
22862 m_value.array->push_back(val);
22957 push_back(
typename object_t::value_type(
22958 std::move(key.get_ref<
string_t&>()), (
init.begin() + 1)->moved_or_copied()));
22999 template<
class... Args>
23017 const auto old_capacity =
m_value.array->capacity();
23018 m_value.array->emplace_back(std::forward<Args>(
args)...);
23049 template<
class... Args>
23067 auto res =
m_value.object->emplace(std::forward<Args>(
args)...);
23072 it.m_it.object_iterator =
res.first;
23075 return {it,
res.second};
23081 template<
typename... Args>
23089 result.m_it.array_iterator =
m_value.array->begin() + insert_pos;
23145 return insert(pos, val);
23362 m_value.object = create<object_t>();
23375 for (
auto it = j.
cbegin(); it != j.
cend(); ++it)
23377 m_value.object->operator[](it.key()) = it.value();
23413 m_value.object = create<object_t>();
23430 || !last.m_object->is_object()))
23435 for (
auto it = first; it != last; ++it)
23437 m_value.object->operator[](it.key()) = it.value();
23465 std::swap(m_type, other.m_type);
23466 std::swap(
m_value, other.m_value);
23469 other.set_parents();
23526 std::swap(*(
m_value.array), other);
23559 std::swap(*(
m_value.object), other);
23592 std::swap(*(
m_value.string), other);
23625 std::swap(*(
m_value.binary), other);
23639 std::swap(*(
m_value.binary), other);
23715 #pragma GCC diagnostic push
23716 #pragma GCC diagnostic ignored "-Wfloat-equal"
23718 const auto lhs_type = lhs.type();
23719 const auto rhs_type = rhs.type();
23721 if (lhs_type == rhs_type)
23726 return *lhs.m_value.array == *rhs.m_value.array;
23729 return *lhs.m_value.object == *rhs.m_value.object;
23735 return *lhs.m_value.string == *rhs.m_value.string;
23738 return lhs.m_value.boolean == rhs.m_value.boolean;
23741 return lhs.m_value.number_integer == rhs.m_value.number_integer;
23744 return lhs.m_value.number_unsigned == rhs.m_value.number_unsigned;
23747 return lhs.m_value.number_float == rhs.m_value.number_float;
23750 return *lhs.m_value.binary == *rhs.m_value.binary;
23759 return static_cast<number_float_t>(lhs.m_value.number_integer) == rhs.m_value.number_float;
23763 return lhs.m_value.number_float ==
static_cast<number_float_t>(rhs.m_value.number_integer);
23767 return static_cast<number_float_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_float;
23771 return lhs.m_value.number_float ==
static_cast<number_float_t>(rhs.m_value.number_unsigned);
23775 return static_cast<number_integer_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_integer;
23779 return lhs.m_value.number_integer ==
static_cast<number_integer_t>(rhs.m_value.number_unsigned);
23784 #pragma GCC diagnostic pop
23792 template<
typename ScalarType,
typename std::enable_if<
23803 template<
typename ScalarType,
typename std::enable_if<
23830 return !(lhs == rhs);
23837 template<
typename ScalarType,
typename std::enable_if<
23848 template<
typename ScalarType,
typename std::enable_if<
23883 const auto lhs_type = lhs.type();
23884 const auto rhs_type = rhs.type();
23886 if (lhs_type == rhs_type)
23893 return (*lhs.m_value.array) < (*rhs.m_value.array);
23896 return (*lhs.m_value.object) < (*rhs.m_value.object);
23902 return (*lhs.m_value.string) < (*rhs.m_value.string);
23905 return (lhs.m_value.boolean) < (rhs.m_value.boolean);
23908 return (lhs.m_value.number_integer) < (rhs.m_value.number_integer);
23911 return (lhs.m_value.number_unsigned) < (rhs.m_value.number_unsigned);
23914 return (lhs.m_value.number_float) < (rhs.m_value.number_float);
23917 return (*lhs.m_value.binary) < (*rhs.m_value.binary);
23926 return static_cast<number_float_t>(lhs.m_value.number_integer) < rhs.m_value.number_float;
23930 return lhs.m_value.number_float <
static_cast<number_float_t>(rhs.m_value.number_integer);
23934 return static_cast<number_float_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_float;
23938 return lhs.m_value.number_float <
static_cast<number_float_t>(rhs.m_value.number_unsigned);
23942 return lhs.m_value.number_integer <
static_cast<number_integer_t>(rhs.m_value.number_unsigned);
23946 return static_cast<number_integer_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_integer;
23959 template<
typename ScalarType,
typename std::enable_if<
23970 template<
typename ScalarType,
typename std::enable_if<
23998 return !(rhs < lhs);
24005 template<
typename ScalarType,
typename std::enable_if<
24016 template<
typename ScalarType,
typename std::enable_if<
24044 return !(lhs <= rhs);
24051 template<
typename ScalarType,
typename std::enable_if<
24062 template<
typename ScalarType,
typename std::enable_if<
24090 return !(lhs < rhs);
24097 template<
typename ScalarType,
typename std::enable_if<
24108 template<
typename ScalarType,
typename std::enable_if<
24158 const bool pretty_print =
o.width() > 0;
24159 const auto indentation = pretty_print ?
o.width() : 0;
24166 s.dump(j, pretty_print,
false,
static_cast<unsigned int>(indentation));
24183 #endif // JSON_NO_IO
24245 template<
typename InputType>
24249 const bool allow_exceptions =
true,
24250 const bool ignore_comments =
false)
24283 template<
typename IteratorType>
24288 const bool allow_exceptions =
true,
24289 const bool ignore_comments =
false)
24300 const
bool allow_exceptions = true,
24301 const
bool ignore_comments = false)
24304 parser(i.get(), cb, allow_exceptions, ignore_comments).parse(
true,
result);
24338 template<
typename InputType>
24340 const bool ignore_comments =
false)
24345 template<
typename IteratorType>
24346 static bool accept(IteratorType first, IteratorType last,
24347 const bool ignore_comments =
false)
24354 static
bool accept(detail::span_input_adapter&& i,
24355 const
bool ignore_comments = false)
24357 return parser(i.get(),
nullptr,
false, ignore_comments).accept(
true);
24400 template <
typename InputType,
typename SAX>
24404 const
bool strict = true,
24405 const
bool ignore_comments = false)
24409 ?
parser(std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax, strict)
24413 template<
class IteratorType,
class SAX>
24415 static
bool sax_parse(IteratorType first, IteratorType last, SAX* sax,
24417 const
bool strict = true,
24418 const
bool ignore_comments = false)
24422 ?
parser(std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax, strict)
24426 template <
typename SAX>
24431 const
bool strict = true,
24432 const
bool ignore_comments = false)
24437 ?
parser(std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax, strict)
24486 #endif // JSON_NO_IO
24543 return "discarded";
24565 #if JSON_DIAGNOSTICS
24678 std::vector<std::uint8_t>
result;
24773 std::vector<std::uint8_t>
result;
24875 const bool use_size =
false,
24876 const bool use_type =
false)
24878 std::vector<std::uint8_t>
result;
24884 const bool use_size =
false,
const bool use_type =
false)
24890 const bool use_size =
false,
const bool use_type =
false)
24954 std::vector<std::uint8_t>
result;
25083 template<
typename InputType>
25086 const bool strict =
true,
25087 const bool allow_exceptions =
true,
25100 template<
typename IteratorType>
25103 const bool strict =
true,
25104 const bool allow_exceptions =
true,
25114 template<
typename T>
25118 const
bool strict = true,
25119 const
bool allow_exceptions = true,
25122 return from_cbor(ptr, ptr + len, strict, allow_exceptions, tag_handler);
25129 const
bool strict = true,
25130 const
bool allow_exceptions = true,
25227 template<
typename InputType>
25230 const bool strict =
true,
25231 const bool allow_exceptions =
true)
25243 template<
typename IteratorType>
25246 const bool strict =
true,
25247 const bool allow_exceptions =
true)
25257 template<
typename T>
25261 const
bool strict = true,
25262 const
bool allow_exceptions = true)
25264 return from_msgpack(ptr, ptr + len, strict, allow_exceptions);
25270 const
bool strict = true,
25271 const
bool allow_exceptions = true)
25344 template<
typename InputType>
25347 const bool strict =
true,
25348 const bool allow_exceptions =
true)
25360 template<
typename IteratorType>
25363 const bool strict =
true,
25364 const bool allow_exceptions =
true)
25373 template<
typename T>
25377 const
bool strict = true,
25378 const
bool allow_exceptions = true)
25380 return from_ubjson(ptr, ptr + len, strict, allow_exceptions);
25386 const
bool strict = true,
25387 const
bool allow_exceptions = true)
25458 template<
typename InputType>
25461 const bool strict =
true,
25462 const bool allow_exceptions =
true)
25474 template<
typename IteratorType>
25477 const bool strict =
true,
25478 const bool allow_exceptions =
true)
25487 template<
typename T>
25491 const
bool strict = true,
25492 const
bool allow_exceptions = true)
25494 return from_bson(ptr, ptr + len, strict, allow_exceptions);
25500 const
bool strict = true,
25501 const
bool allow_exceptions = true)
25554 return ptr.get_unchecked(
this);
25582 return ptr.get_unchecked(
this);
25625 return ptr.get_checked(
this);
25668 return ptr.get_checked(
this);
25797 enum class patch_operations {add, remove,
replace, move, copy, test, invalid};
25799 const auto get_op = [](
const std::string &
op)
25803 return patch_operations::add;
25805 if (
op ==
"remove")
25807 return patch_operations::remove;
25809 if (
op ==
"replace")
25815 return patch_operations::move;
25819 return patch_operations::copy;
25823 return patch_operations::test;
25826 return patch_operations::invalid;
25841 if (top_pointer != ptr)
25847 const auto last_path = ptr.back();
25851 switch (parent.m_type)
25857 parent[last_path] = val;
25863 if (last_path ==
"-")
25866 parent.push_back(val);
25878 parent.insert(parent.begin() +
static_cast<difference_type>(idx), val);
25900 const auto last_path = ptr.back();
25905 if (parent.is_object())
25908 auto it = parent.find(last_path);
25918 else if (parent.is_array())
25932 for (
const auto& val : json_patch)
25935 const auto get_value = [&val](
const std::string &
op,
25936 const std::string & member,
25940 auto it = val.
m_value.object->find(member);
25943 const auto error_msg = (
op ==
"op") ?
"operation" :
"operation '" +
op +
"'";
25970 const auto op = get_value(
"op",
"op",
true).template get<std::string>();
25971 const auto path = get_value(
op,
"path",
true).template get<std::string>();
25974 switch (get_op(
op))
25976 case patch_operations::add:
25978 operation_add(ptr, get_value(
"add",
"value",
false));
25982 case patch_operations::remove:
25984 operation_remove(ptr);
25991 result.at(ptr) = get_value(
"replace",
"value",
false);
25995 case patch_operations::move:
25997 const auto from_path = get_value(
"move",
"from",
true).template get<std::string>();
26007 operation_remove(from_ptr);
26008 operation_add(ptr, v);
26012 case patch_operations::copy:
26014 const auto from_path = get_value(
"copy",
"from",
true).template get<std::string>();
26023 operation_add(ptr, v);
26027 case patch_operations::test:
26029 bool success =
false;
26034 success = (
result.at(ptr) == get_value(
"test",
"value",
false));
26050 case patch_operations::invalid:
26098 const std::string&
path =
"")
26104 if (source == target)
26109 if (source.type() != target.type())
26114 {
"op",
"replace"}, {
"path",
path}, {
"value", target}
26119 switch (source.type())
26125 while (i < source.size() && i < target.size())
26129 result.insert(
result.end(), temp_diff.begin(), temp_diff.end());
26138 while (i < source.size())
26151 while (i < target.size())
26156 {
"path",
path +
"/-"},
26157 {
"value", target[i]}
26168 for (
auto it = source.cbegin(); it != source.cend(); ++it)
26173 if (target.find(it.key()) != target.end())
26176 auto temp_diff =
diff(it.value(), target[it.key()], path_key);
26177 result.insert(
result.end(), temp_diff.begin(), temp_diff.end());
26182 result.push_back(
object(
26184 {
"op",
"remove"}, {
"path", path_key}
26190 for (
auto it = target.cbegin(); it != target.cend(); ++it)
26192 if (source.find(it.key()) == source.end())
26198 {
"op",
"add"}, {
"path", path_key},
26199 {
"value", it.value()}
26220 {
"op",
"replace"}, {
"path",
path}, {
"value", target}
26282 if (apply_patch.is_object())
26288 for (
auto it = apply_patch.begin(); it != apply_patch.end(); ++it)
26290 if (it.value().is_null())
26302 *
this = apply_patch;
26366 #ifndef JSON_HAS_CPP_20
26428 #if defined(__clang__)
26429 #pragma clang diagnostic pop
26434 #undef JSON_INTERNAL_CATCH
26438 #undef JSON_PRIVATE_UNLESS_TESTED
26439 #undef JSON_HAS_CPP_11
26440 #undef JSON_HAS_CPP_14
26441 #undef JSON_HAS_CPP_17
26442 #undef JSON_HAS_CPP_20
26443 #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION
26444 #undef NLOHMANN_BASIC_JSON_TPL
26445 #undef JSON_EXPLICIT
26450 #undef JSON_HEDLEY_ALWAYS_INLINE
26451 #undef JSON_HEDLEY_ARM_VERSION
26452 #undef JSON_HEDLEY_ARM_VERSION_CHECK
26453 #undef JSON_HEDLEY_ARRAY_PARAM
26454 #undef JSON_HEDLEY_ASSUME
26455 #undef JSON_HEDLEY_BEGIN_C_DECLS
26456 #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE
26457 #undef JSON_HEDLEY_CLANG_HAS_BUILTIN
26458 #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
26459 #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
26460 #undef JSON_HEDLEY_CLANG_HAS_EXTENSION
26461 #undef JSON_HEDLEY_CLANG_HAS_FEATURE
26462 #undef JSON_HEDLEY_CLANG_HAS_WARNING
26463 #undef JSON_HEDLEY_COMPCERT_VERSION
26464 #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK
26465 #undef JSON_HEDLEY_CONCAT
26466 #undef JSON_HEDLEY_CONCAT3
26467 #undef JSON_HEDLEY_CONCAT3_EX
26468 #undef JSON_HEDLEY_CONCAT_EX
26469 #undef JSON_HEDLEY_CONST
26470 #undef JSON_HEDLEY_CONSTEXPR
26471 #undef JSON_HEDLEY_CONST_CAST
26472 #undef JSON_HEDLEY_CPP_CAST
26473 #undef JSON_HEDLEY_CRAY_VERSION
26474 #undef JSON_HEDLEY_CRAY_VERSION_CHECK
26475 #undef JSON_HEDLEY_C_DECL
26476 #undef JSON_HEDLEY_DEPRECATED
26477 #undef JSON_HEDLEY_DEPRECATED_FOR
26478 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
26479 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_
26480 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
26481 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
26482 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
26483 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION
26484 #undef JSON_HEDLEY_DIAGNOSTIC_POP
26485 #undef JSON_HEDLEY_DIAGNOSTIC_PUSH
26486 #undef JSON_HEDLEY_DMC_VERSION
26487 #undef JSON_HEDLEY_DMC_VERSION_CHECK
26488 #undef JSON_HEDLEY_EMPTY_BASES
26489 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION
26490 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK
26491 #undef JSON_HEDLEY_END_C_DECLS
26492 #undef JSON_HEDLEY_FLAGS
26493 #undef JSON_HEDLEY_FLAGS_CAST
26494 #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE
26495 #undef JSON_HEDLEY_GCC_HAS_BUILTIN
26496 #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE
26497 #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
26498 #undef JSON_HEDLEY_GCC_HAS_EXTENSION
26499 #undef JSON_HEDLEY_GCC_HAS_FEATURE
26500 #undef JSON_HEDLEY_GCC_HAS_WARNING
26501 #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
26502 #undef JSON_HEDLEY_GCC_VERSION
26503 #undef JSON_HEDLEY_GCC_VERSION_CHECK
26504 #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE
26505 #undef JSON_HEDLEY_GNUC_HAS_BUILTIN
26506 #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
26507 #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
26508 #undef JSON_HEDLEY_GNUC_HAS_EXTENSION
26509 #undef JSON_HEDLEY_GNUC_HAS_FEATURE
26510 #undef JSON_HEDLEY_GNUC_HAS_WARNING
26511 #undef JSON_HEDLEY_GNUC_VERSION
26512 #undef JSON_HEDLEY_GNUC_VERSION_CHECK
26513 #undef JSON_HEDLEY_HAS_ATTRIBUTE
26514 #undef JSON_HEDLEY_HAS_BUILTIN
26515 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE
26516 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS
26517 #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE
26518 #undef JSON_HEDLEY_HAS_EXTENSION
26519 #undef JSON_HEDLEY_HAS_FEATURE
26520 #undef JSON_HEDLEY_HAS_WARNING
26521 #undef JSON_HEDLEY_IAR_VERSION
26522 #undef JSON_HEDLEY_IAR_VERSION_CHECK
26523 #undef JSON_HEDLEY_IBM_VERSION
26524 #undef JSON_HEDLEY_IBM_VERSION_CHECK
26525 #undef JSON_HEDLEY_IMPORT
26526 #undef JSON_HEDLEY_INLINE
26527 #undef JSON_HEDLEY_INTEL_CL_VERSION
26528 #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK
26529 #undef JSON_HEDLEY_INTEL_VERSION
26530 #undef JSON_HEDLEY_INTEL_VERSION_CHECK
26531 #undef JSON_HEDLEY_IS_CONSTANT
26532 #undef JSON_HEDLEY_IS_CONSTEXPR_
26533 #undef JSON_HEDLEY_LIKELY
26534 #undef JSON_HEDLEY_MALLOC
26535 #undef JSON_HEDLEY_MCST_LCC_VERSION
26536 #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK
26537 #undef JSON_HEDLEY_MESSAGE
26538 #undef JSON_HEDLEY_MSVC_VERSION
26539 #undef JSON_HEDLEY_MSVC_VERSION_CHECK
26540 #undef JSON_HEDLEY_NEVER_INLINE
26541 #undef JSON_HEDLEY_NON_NULL
26542 #undef JSON_HEDLEY_NO_ESCAPE
26543 #undef JSON_HEDLEY_NO_RETURN
26544 #undef JSON_HEDLEY_NO_THROW
26545 #undef JSON_HEDLEY_NULL
26546 #undef JSON_HEDLEY_PELLES_VERSION
26547 #undef JSON_HEDLEY_PELLES_VERSION_CHECK
26548 #undef JSON_HEDLEY_PGI_VERSION
26549 #undef JSON_HEDLEY_PGI_VERSION_CHECK
26550 #undef JSON_HEDLEY_PREDICT
26551 #undef JSON_HEDLEY_PRINTF_FORMAT
26552 #undef JSON_HEDLEY_PRIVATE
26553 #undef JSON_HEDLEY_PUBLIC
26554 #undef JSON_HEDLEY_PURE
26555 #undef JSON_HEDLEY_REINTERPRET_CAST
26556 #undef JSON_HEDLEY_REQUIRE
26557 #undef JSON_HEDLEY_REQUIRE_CONSTEXPR
26558 #undef JSON_HEDLEY_REQUIRE_MSG
26559 #undef JSON_HEDLEY_RESTRICT
26560 #undef JSON_HEDLEY_RETURNS_NON_NULL
26561 #undef JSON_HEDLEY_SENTINEL
26562 #undef JSON_HEDLEY_STATIC_ASSERT
26563 #undef JSON_HEDLEY_STATIC_CAST
26564 #undef JSON_HEDLEY_STRINGIFY
26565 #undef JSON_HEDLEY_STRINGIFY_EX
26566 #undef JSON_HEDLEY_SUNPRO_VERSION
26567 #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK
26568 #undef JSON_HEDLEY_TINYC_VERSION
26569 #undef JSON_HEDLEY_TINYC_VERSION_CHECK
26570 #undef JSON_HEDLEY_TI_ARMCL_VERSION
26571 #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK
26572 #undef JSON_HEDLEY_TI_CL2000_VERSION
26573 #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK
26574 #undef JSON_HEDLEY_TI_CL430_VERSION
26575 #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK
26576 #undef JSON_HEDLEY_TI_CL6X_VERSION
26577 #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK
26578 #undef JSON_HEDLEY_TI_CL7X_VERSION
26579 #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK
26580 #undef JSON_HEDLEY_TI_CLPRU_VERSION
26581 #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK
26582 #undef JSON_HEDLEY_TI_VERSION
26583 #undef JSON_HEDLEY_TI_VERSION_CHECK
26584 #undef JSON_HEDLEY_UNAVAILABLE
26585 #undef JSON_HEDLEY_UNLIKELY
26586 #undef JSON_HEDLEY_UNPREDICTABLE
26587 #undef JSON_HEDLEY_UNREACHABLE
26588 #undef JSON_HEDLEY_UNREACHABLE_RETURN
26589 #undef JSON_HEDLEY_VERSION
26590 #undef JSON_HEDLEY_VERSION_DECODE_MAJOR
26591 #undef JSON_HEDLEY_VERSION_DECODE_MINOR
26592 #undef JSON_HEDLEY_VERSION_DECODE_REVISION
26593 #undef JSON_HEDLEY_VERSION_ENCODE
26594 #undef JSON_HEDLEY_WARNING
26595 #undef JSON_HEDLEY_WARN_UNUSED_RESULT
26596 #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG
26597 #undef JSON_HEDLEY_FALL_THROUGH
26601 #endif // INCLUDE_NLOHMANN_JSON_HPP_