Skip to content

With non-unique keys, later stored entries are not taken into account anymore #963

Description

@jeremysingy

While updating to 3.1.0, I noticed that the behavior of the library is not consistent with the documentation anymore for objects with non-unique names (also discussed in issue #375).

When the names within an object are not unique, later stored name/value pairs overwrite previously stored name/value pairs, leaving the used names unique. For instance, {"key": 1} and {"key": 2, "key": 1} will be treated as equal and both stored as {"key": 1}.

Whereas it will now be treated equally as {"key": 2} instead.

I bissected to the commit 85c7680 replacing operator[] with emplace to insert an object, which will not update an already existing object in the map.

I actually don't need this "feature" anymore, so not sure if it's best to fix the code for consistency or update the corresponding documentation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions