You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ch13/13.28.cpp, line 173: BinStrTree::BinStrTree(const BinStrTree &rhs) : root(new TreeNode(*rhs.root)), use(rhs.use) { ++*use; }
As BinStrTree implements the pointer-like copy control members, I think root should be initialized with rhs.root, not new TreeNode(*rhs.root).
The code might be changed to: BinStrTree::BinStrTree(const BinStrTree &rhs) : root(rhs.root), use(rhs.use) { ++*use; }
The text was updated successfully, but these errors were encountered:
In ch13/13.28.cpp, line 173:
BinStrTree::BinStrTree(const BinStrTree &rhs) : root(new TreeNode(*rhs.root)), use(rhs.use) { ++*use; }
As BinStrTree implements the pointer-like copy control members, I think
root
should be initialized withrhs.root
, notnew TreeNode(*rhs.root)
.The code might be changed to:
BinStrTree::BinStrTree(const BinStrTree &rhs) : root(rhs.root), use(rhs.use) { ++*use; }
The text was updated successfully, but these errors were encountered: