mirror of
https://github.com/biojppm/rapidyaml.git
synced 2026-01-18 21:41:18 +01:00
`Tree` is now non-empty by default, and `Tree::root_id()` will no longer modify the tree when it is empty. To create an empty tree now it is necessary to use the capacity constructor with a capacity of zero: ```c++ // default-constructed tree is now non-empty Tree tree; assert(!tree.empty()); // MODIFIED! was empty on previous version id_type root = tree.root_id(); // OK. default-constructed tree is now non-empty // to create an empty tree: Tree tree(0); // pass capacity of zero assert(tree.empty()); // as expected // but watchout, this is no longer possible: //id_type root = tree.root_id(); // ERROR: cannot get root of empty tree. ``` This changeset also enables the python library to call `root_id()` on a default-constructed tree re #556