Simplify number_float hash case: reuse existing type tag The number_float case introduced a redundant numeric_type local that duplicated the already-computed type variable (both equal value_t::number_float within that case). Removed per review feedback. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
diff --git a/include/nlohmann/detail/hash.hpp b/include/nlohmann/detail/hash.hpp index 9df26dc..5e3f9ef 100644 --- a/include/nlohmann/detail/hash.hpp +++ b/include/nlohmann/detail/hash.hpp
@@ -188,8 +188,7 @@ case BasicJsonType::value_t::number_float: { const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>()); - const auto numeric_type = static_cast<std::size_t>(BasicJsonType::value_t::number_float); - return combine(numeric_type, h); + return combine(type, h); } case BasicJsonType::value_t::binary:
diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 4b233ed..438973e 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp
@@ -6856,8 +6856,7 @@ case BasicJsonType::value_t::number_float: { const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>()); - const auto numeric_type = static_cast<std::size_t>(BasicJsonType::value_t::number_float); - return combine(numeric_type, h); + return combine(type, h); } case BasicJsonType::value_t::binary: