mirror of
https://github.com/nlohmann/json.git
synced 2026-09-29 22:10:47 +01:00
With JSON_USE_IMPLICIT_CONVERSIONS=0 the conversion from a basic_json with a different string type is now explicit, but two library paths still assigned such a value implicitly and failed to compile inside the library: - get_to() with a basic_json target (the #2175 overload) did `v = *this`, so json(42).get_to(alt_json&) broke although get<alt_json>() works. - to_json(BasicJsonType&, const std::optional<T>&) is constrained on std::is_constructible (which accepts the explicit constructor) but did `j = *opt`, so converting a std::optional<alt_json> into a json broke. Both now construct the value explicitly, as get_impl() already does. Also replace static_cast<bool>(JSON_USE_IMPLICIT_CONVERSIONS) with a comparison: clang-tidy's modernize-use-bool-literals rejected the cast of the integer literal the macro expands to, failing ci_clang_tidy. Signed-off-by: Niels Lohmann <mail@nlohmann.me>