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>
This commit is contained in:
Niels Lohmann
2026-07-10 13:00:37 +02:00
parent 8557b661ab
commit 10d18792bd
2 changed files with 2 additions and 4 deletions
+1 -2
View File
@@ -188,8 +188,7 @@ std::size_t hash(const BasicJsonType& j)
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:
+1 -2
View File
@@ -6856,8 +6856,7 @@ std::size_t hash(const BasicJsonType& j)
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: