From e8cfe1f712296d0b0b9a4ba83aa69b8fea7364b8 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 14 Apr 2024 12:38:17 +0200 Subject: [PATCH] :rotating_light: fix warning --- include/nlohmann/detail/conversions/from_json.hpp | 6 ++++++ single_include/nlohmann/json.hpp | 6 ++++++ tests/src/unit-conversions.cpp | 6 +++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index 84b55f229..566301616 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -380,6 +380,12 @@ inline void from_json(const BasicJsonType& j, ArithmeticType& val) } } +template +std::tuple from_json_tuple_impl_base(const BasicJsonType& j, index_sequence /*unused*/) +{ + return std::make_tuple(j.at(Idx).template get()...); +} + template std::tuple from_json_tuple_impl_base(BasicJsonType&& j, index_sequence /*unused*/) { diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index d88467d85..5703f0d5a 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -5007,6 +5007,12 @@ inline void from_json(const BasicJsonType& j, ArithmeticType& val) } } +template +std::tuple from_json_tuple_impl_base(const BasicJsonType& j, index_sequence /*unused*/) +{ + return std::make_tuple(j.at(Idx).template get()...); +} + template std::tuple from_json_tuple_impl_base(BasicJsonType&& j, index_sequence /*unused*/) { diff --git a/tests/src/unit-conversions.cpp b/tests/src/unit-conversions.cpp index 1d89ec544..8692ada6d 100644 --- a/tests/src/unit-conversions.cpp +++ b/tests/src/unit-conversions.cpp @@ -1515,9 +1515,9 @@ NLOHMANN_JSON_SERIALIZE_ENUM(cards, enum TaskState { - TS_STOPPED, - TS_RUNNING, - TS_COMPLETED, + TS_STOPPED = 0, + TS_RUNNING = 1, + TS_COMPLETED = 2, TS_INVALID = -1, };