Files
rapidyaml/samples
Joao Paulo Magalhaes 0febd0fa65 Improve behaviour of tree creation and Tree::root_id().
`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
2025-12-02 21:03:48 +00:00
..
2025-09-29 00:01:36 +01:00
2025-09-29 00:01:36 +01:00
2025-09-29 00:01:36 +01:00