41std::size_t
hash(
const BasicJsonType& j)
43 using string_t =
typename BasicJsonType::string_t;
44 using number_integer_t =
typename BasicJsonType::number_integer_t;
45 using number_unsigned_t =
typename BasicJsonType::number_unsigned_t;
46 using number_float_t =
typename BasicJsonType::number_float_t;
48 const auto type =
static_cast<std::size_t
>(j.type());
51 case BasicJsonType::value_t::null:
52 case BasicJsonType::value_t::discarded:
57 case BasicJsonType::value_t::object:
60 for (
const auto& element : j.items())
62 const auto h = std::hash<string_t> {}(element.key());
69 case BasicJsonType::value_t::array:
72 for (
const auto& element : j)
79 case BasicJsonType::value_t::string:
81 const auto h = std::hash<string_t> {}(j.template get_ref<const string_t&>());
85 case BasicJsonType::value_t::boolean:
87 const auto h = std::hash<bool> {}(j.template
get<bool>());
91 case BasicJsonType::value_t::number_integer:
97 case BasicJsonType::value_t::number_unsigned:
103 case BasicJsonType::value_t::number_float:
109 case BasicJsonType::value_t::binary:
112 const auto h = std::hash<bool> {}(j.get_binary().has_subtype());
114 seed =
combine(seed,
static_cast<std::size_t
>(j.get_binary().subtype()));
115 for (
const auto byte : j.get_binary())
117 seed =
combine(seed, std::hash<std::uint8_t> {}(byte));