From b27938aca3e9473ced96d1b57f0f3996c256836f Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 4 May 2021 12:47:20 +0200 Subject: [PATCH] :ok_hand: apply review comments --- include/nlohmann/json.hpp | 4 ++++ single_include/nlohmann/json.hpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 8f4882fd5..cff017725 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -3860,7 +3860,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec detail::is_usable_as_key_type::value > ... > string_t value(const KeyType& key, const char* default_value) const { +#ifdef JSON_HAS_CPP_17 + return value(key, std::string_view(default_value)); +#else return value(key, string_t(default_value)); +#endif } /*! diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 866fcb26e..d787a306d 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -20907,7 +20907,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec detail::is_usable_as_key_type::value > ... > string_t value(const KeyType& key, const char* default_value) const { +#ifdef JSON_HAS_CPP_17 + return value(key, std::string_view(default_value)); +#else return value(key, string_t(default_value)); +#endif } /*!