Disabling implicit conversions.

This commit is contained in:
Pcornat 2022-06-09 21:52:49 +02:00
parent 618dad7df1
commit 340a4516dd
Signed by: Pcornat
GPG Key ID: 2F3932FF46D9ECA0
2 changed files with 6 additions and 4 deletions

View File

@ -97,6 +97,8 @@ option(SPDLOG_NO_ATOMIC_LEVELS "prevent spdlog from using of std::atomic log lev
add_subdirectory(external/spdlog) add_subdirectory(external/spdlog)
set(JSON_BuildTests OFF CACHE INTERNAL "") set(JSON_BuildTests OFF CACHE INTERNAL "")
option(JSON_ImplicitConversions "Enable implicit conversions." OFF)
option(JSON_SystemInclude "Include as system headers (skip for clang-tidy)." ON)
add_subdirectory(external/json) add_subdirectory(external/json)
option(CATCH_INSTALL_DOCS "Install documentation alongside library" OFF) option(CATCH_INSTALL_DOCS "Install documentation alongside library" OFF)

View File

@ -41,10 +41,10 @@ namespace character::characteristic {
[[nodiscard]] std::uint32_t get_additional() const { return additional; } [[nodiscard]] std::uint32_t get_additional() const { return additional; }
friend void from_json(const json &j, Characteristic &charac) { friend void from_json(const json &j, Characteristic &charac) {
const_cast<std::uint32_t &>(charac.base) = j.at("base"); const_cast<std::uint32_t &>(charac.base) = j.at("base").get<std::uint32_t>();
charac.carac = j.at("carac"); charac.carac = j.at("carac").get<std::uint32_t>();
charac.materiel = j.at("materiel"); charac.materiel = j.at("materiel").get<std::uint32_t>();
charac.additional = j.at("additional"); charac.additional = j.at("additional").get<std::uint32_t>();
} }
}; };