Skip to content

13.28 solution confusion #5

@JiaHaoo

Description

@JiaHaoo

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; }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions