You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// returns the number of occurrences of a key in an objectinline size_type count(typenameobject_t::key_type key) const
{
// return 0 for all nonobject typesreturn (m_type == value_t::object) ? m_value.object->count(key) : 0;
}
we should got "2" in program output. By I got "1".
The text was updated successfully, but these errors were encountered:
No, 1 is the correct result, because an object is a mapping of keys to values. Hence, a key can only occur once on the mapping.
The standard nlohmann::json uses std::map to implement JSON's object. You could, if you like, use std::multi_map instead. Then, the result would indeed be 2 (to the price that the container is not compliant JSON any more).
Hello again. :)
If we have code:
Accordingly to comment:
we should got "2" in program output. By I got "1".
The text was updated successfully, but these errors were encountered: