From 907803189b2bfc9b3b36f026efa13c72bad537b3 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 7 Jun 2020 12:51:33 +0200 Subject: [PATCH] :checkered_flag: fix MSVC 2015 compilation --- include/nlohmann/detail/input/lexer.hpp | 12 ++++++------ single_include/nlohmann/json.hpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index d7ff4963..e710140b 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -1450,18 +1450,18 @@ scan_number_done: // literals case 't': { - char_type true_literal[] = "true"; - return scan_literal(true_literal, 4, token_type::literal_true); + std::array true_literal = {{'t', 'r', 'u', 'e'}}; + return scan_literal(true_literal.data(), true_literal.size(), token_type::literal_true); } case 'f': { - char_type false_literal[] = "false"; - return scan_literal(false_literal, 5, token_type::literal_false); + std::array false_literal = {{'f', 'a', 'l', 's', 'e'}}; + return scan_literal(false_literal.data(), false_literal.size(), token_type::literal_false); } case 'n': { - char_type null_literal[] = "null"; - return scan_literal(null_literal, 4, token_type::literal_null); + std::array null_literal = {{'n', 'u', 'l', 'l'}}; + return scan_literal(null_literal.data(), null_literal.size(), token_type::literal_null); } // string diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 1b4c8c5b..366a6fe8 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -9514,18 +9514,18 @@ scan_number_done: // literals case 't': { - char_type true_literal[] = "true"; - return scan_literal(true_literal, 4, token_type::literal_true); + std::array true_literal = {{'t', 'r', 'u', 'e'}}; + return scan_literal(true_literal.data(), true_literal.size(), token_type::literal_true); } case 'f': { - char_type false_literal[] = "false"; - return scan_literal(false_literal, 5, token_type::literal_false); + std::array false_literal = {{'f', 'a', 'l', 's', 'e'}}; + return scan_literal(false_literal.data(), false_literal.size(), token_type::literal_false); } case 'n': { - char_type null_literal[] = "null"; - return scan_literal(null_literal, 4, token_type::literal_null); + std::array null_literal = {{'n', 'u', 'l', 'l'}}; + return scan_literal(null_literal.data(), null_literal.size(), token_type::literal_null); } // string