Hello, could you explain to me what is my mistake (or not understanding) in this code.
I have a class tree that the designer has
AVL_Tree<Key, mapped_type, Compare>::AVL_Tree(std::string dir) { root = lastAction = nullptr; dirName = dir; count = 0; Key key=10; mapped_type value = 11; insert(std::make_pair(key, value)); }; A tree node is a structure.
struct Tree_ { Key key; std::string* addr; unsigned char height; Tree_* parent; Tree_* left; Tree_* right; Tree_(Key k, std::string* p) { key = k; addr = p; left = right = parent = 0; height = 1; } } when insert, the position of the node is relative to the root and a new object of the node is inserted (I think there is no sense in showing the insert code) I insert the code in this way
p = new Tree_(k.first,&dirName); The problem is that when creating an instance of a tree:
typedef AVL_Tree<Key, FileType> tree; tree strom2; strom2 = (dirName); dirName not saved in my nodes, but if I write this:
tree strom2 = (dirName); that persists.
Can you tell what the reason is and how to solve it?