{ "format": 1, "id": "saw-tree_container", "kind": "class", "name": "tree_container", "namespace": "saw", "module": "core", "header": "modules/core/c++/tree.hpp", "brief_description": "Tree object holding branches.", "detailed_description": [ [ "The name comes from the fact that a tree acts as a node while the", {"name": "branch", "id": "saw-branch"}, "class is the edge to a leaf or to other nodes. A container holds the branches, and each branch either has a leaf or another sub tree." ], [ "Growing is done through add, which reports failure as a value instead of throwing, so a tree can be built in code which must not throw." ] ], "templates": [ {"name": "T", "kind": "type", "brief_description": "Leaf value type."}, {"name": "Tree", "kind": "type", "brief_description": "The tree type a branch may hold instead of a leaf."} ], "attributes": { "saw-tree_container-children_": { "id": "saw-tree_container-children_", "name": "children_", "type": ["std::vector<", {"name": "branch", "id": "saw-branch"}, "< T, Tree > >"], "visibility": "private", "brief_description": "Object holding the branch instances." } }, "functions": { "saw-tree_container-reserve": { "id": "saw-tree_container-reserve", "name": "reserve", "type": ["error_or< void >"], "brief_description": "Reserves room for branches up front.", "parameters": [ {"name": "siz", "type": ["std::size_t"]} ] }, "saw-tree_container-add-1": { "id": "saw-tree_container-add-1", "name": "add", "type": ["error_or< std::size_t >"], "brief_description": "Adds a branch holding a leaf.", "parameters": [ {"name": "leaf", "type": ["T"]} ] }, "saw-tree_container-add-2": { "id": "saw-tree_container-add-2", "name": "add", "type": ["error_or< std::size_t >"], "brief_description": "Adds a branch holding a sub tree." }, "saw-tree_container-size": { "id": "saw-tree_container-size", "name": "size", "type": ["std::size_t"], "const": true, "brief_description": "Number of branches." }, "saw-tree_container-at": { "id": "saw-tree_container-at", "name": "at", "type": [{"name": "branch", "id": "saw-branch"}, "< T, Tree > &"], "brief_description": "The branch at an index.", "parameters": [ {"name": "i", "type": ["std::size_t"]} ] } }, "notes": [ "Copy is forbidden, move is allowed." ] }