From 55b448b70c92040d7d789ac67c1b0d13e6e6d5aa Mon Sep 17 00:00:00 2001 From: Imran Hameed Date: Sun, 4 Oct 2020 16:51:05 -0700 Subject: [PATCH] Use an inline definition of sajson::globals_struct::parse_flags. Improves compatibility with VS2015 and GCC 4.7.2-4.8.5. Fixes https://github.com/chadaustin/sajson/issues/48. --- include/sajson.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/include/sajson.h b/include/sajson.h index 01cad47..d9b07f8 100644 --- a/include/sajson.h +++ b/include/sajson.h @@ -138,17 +138,12 @@ constexpr inline size_t make_element(tag t, size_t value) { // header. This trick courtesy of Rich Geldreich's Purple JSON parser. template struct globals_struct { - static const unsigned char parse_flags[256]; -}; -typedef globals_struct<> globals; - // clang-format off // bit 0 (1) - set if: plain ASCII string character // bit 1 (2) - set if: whitespace // bit 4 (0x10) - set if: 0-9 e E . - template - constexpr uint8_t globals_struct::parse_flags[256] = { + constexpr static const uint8_t parse_flags[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0, 0, // 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1 @@ -167,6 +162,8 @@ typedef globals_struct<> globals; }; // clang-format on +}; +typedef globals_struct<> globals; constexpr inline bool is_plain_string_character(char c) { // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;