September 2016
Intermediate to advanced
588 pages
12h 22m
English
The C++ standard library hold a set of container classes for arrays, lists, vectors, sets, and maps. However, there is no class for a tree structure. Therefore, the Tree class has been added to Small Windows. A tree is made up of a set of nodes, among which, one is the root node. Each node holds a (possibly empty) list of child nodes:
Tree.h
namespace SmallWindows {
template <class NodeType>
class Tree {
public:
Tree();
Tree(NodeType nodeValue,
initializer_list<Tree<NodeType>*> childList = {});
Tree(const Tree& tree);
Tree& operator=(const Tree& tree);
void Init(const Tree& tree);
~Tree();
The tree can be written to, and read from, a file stream or the clipboard:
bool WriteTreeToStream(ostream& outStream) const; bool ReadTreeFromStream(istream& ...
Read now
Unlock full access