Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#167 Use std::map as the default mapping node type #174

Merged
merged 2 commits into from
Oct 22, 2023

Conversation

fktn-k
Copy link
Owner

@fktn-k fktn-k commented Oct 22, 2023

Currently, mapping nodes preserves the order of insertions by using ordere_map class.
However, I noticed that YAML specification 1.2.2 defines mapping as “an unordered association of unique keys to values“.
(See for more information here.)

To follow the specification, basic_node class will be changed to use std::map as mapping container class by default.
Note that std::unordered_map is not supported since it does not support the use of incomplete types on template instantiation.

This change will change the serialization/deserialization results, but bring the fkYAML library more efficiency in performance.

Lastly, the ordered_map class will still be available as an optional mapping container type for customization(, rather than using a sequence of mapping node as the specification suggests).

#include <fkYAML/node.hpp>
using ordered_node = fkyaml::basic_node<std::vector, fkyaml::ordered_map>;

@fktn-k fktn-k added the improvement refactoring or optimization without public API changes label Oct 22, 2023
@fktn-k fktn-k added this to the Release v0.1.3 milestone Oct 22, 2023
@fktn-k fktn-k self-assigned this Oct 22, 2023
@fktn-k fktn-k modified the milestones: Release v0.1.3, Release v0.2.0 Oct 22, 2023
@coveralls
Copy link

Coverage Status

coverage: 100.0%. remained the same when pulling c1fce5e on feature/167_make_mapping_node_unordered_by_default into e5c30c3 on develop.

@fktn-k fktn-k merged commit e9b07c3 into develop Oct 22, 2023
104 checks passed
@fktn-k fktn-k deleted the feature/167_make_mapping_node_unordered_by_default branch October 22, 2023 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement refactoring or optimization without public API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants