Skip to content

Commit 7fc406a

Browse files
committed
v1.34.4: fix optional<Json> return to avoid implicit conversion warnings
1 parent 73d86ef commit 7fc406a

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

include/vix/json/json.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ namespace vix::json
127127
* Json j = R"({"a": 1, "b": 2})"_json;
128128
* @endcode
129129
*/
130-
namespace literals = nlohmann::literals;
130+
#if defined(NLOHMANN_JSON_VERSION_MAJOR)
131+
#if (NLOHMANN_JSON_VERSION_MAJOR > 3) || \
132+
(NLOHMANN_JSON_VERSION_MAJOR == 3 && NLOHMANN_JSON_VERSION_MINOR >= 10)
133+
namespace literals = nlohmann::literals::json_literals;
134+
#endif
135+
#endif
131136

132137
} // namespace vix::json
133138

include/vix/json/loads.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ namespace vix::json
145145
{
146146
try
147147
{
148-
return Json::parse(s);
148+
Json j = Json::parse(s);
149+
return j;
149150
}
150151
catch (...)
151152
{

0 commit comments

Comments
 (0)