#167 Use std::map as the default mapping node type #174
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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).