mirror of
https://github.com/nlohmann/json.git
synced 2026-07-10 12:35:09 +00:00
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:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user