8 #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400
9 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
11 #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
12 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40900
13 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
18 #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wfloat-equal"
24 #if defined(__clang__)
25 #pragma GCC diagnostic push
26 #pragma GCC diagnostic ignored "-Wdocumentation"
30 #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
31 #define JSON_DEPRECATED __attribute__((deprecated))
32 #elif defined(_MSC_VER)
33 #define JSON_DEPRECATED __declspec(deprecated)
35 #define JSON_DEPRECATED
39 #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION)
40 #define JSON_THROW(exception) throw exception
42 #define JSON_CATCH(exception) catch(exception)
44 #define JSON_THROW(exception) std::abort()
45 #define JSON_TRY if(true)
46 #define JSON_CATCH(exception) if(false)
50 #if defined(JSON_THROW_USER)
52 #define JSON_THROW JSON_THROW_USER
54 #if defined(JSON_TRY_USER)
56 #define JSON_TRY JSON_TRY_USER
58 #if defined(JSON_CATCH_USER)
60 #define JSON_CATCH JSON_CATCH_USER
64 #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
65 #define JSON_LIKELY(x) __builtin_expect(!!(x), 1)
66 #define JSON_UNLIKELY(x) __builtin_expect(!!(x), 0)
68 #define JSON_LIKELY(x) x
69 #define JSON_UNLIKELY(x) x
73 #if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
74 #define JSON_HAS_CPP_17
75 #define JSON_HAS_CPP_14
76 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
77 #define JSON_HAS_CPP_14
83 #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \
84 template<template<typename, typename, typename...> class ObjectType, \
85 template<typename, typename...> class ArrayType, \
86 class StringType, class BooleanType, class NumberIntegerType, \
87 class NumberUnsignedType, class NumberFloatType, \
88 template<typename> class AllocatorType, \
89 template<typename, typename = void> class JSONSerializer>
91 #define NLOHMANN_BASIC_JSON_TPL \
92 basic_json<ObjectType, ArrayType, StringType, BooleanType, \
93 NumberIntegerType, NumberUnsignedType, NumberFloatType, \
94 AllocatorType, JSONSerializer>
106 #define NLOHMANN_JSON_HAS_HELPER(type) \
107 template<typename T> struct has_##type { \
109 template<typename U, typename = typename U::type> \
110 static int detect(U &&); \
111 static void detect(...); \
113 static constexpr bool value = \
114 std::is_integral<decltype(detect(std::declval<T>()))>::value; \