jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
4.91k stars 1.77k forks source link

Adding support for handling YAML Merge Key (#41) #1243

Open nlescoua opened 7 months ago

nlescoua commented 7 months ago

Support for YAML Merge keys ( <<: [dict1, dict2] ) is added. The merge key is a specific scalar with value << (and tag !!merge) that implies that during node construction, the map (or sequence of maps) are merged into the current map. The priority rules are that each key from maps within the value associated with << are added iff the key is not yet present in the current map (and first map gets higher priority). Test cases have been added accordingly.

bradnelson commented 5 months ago

I tested this PR and it appears to work as expected for my project. Thanks for the contribution, @nlescoua !