Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Free and FreeChild methods #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

winway
Copy link

@winway winway commented Feb 28, 2018

add methods:
func Free(t *Trie) Free all Nodes of the Trie, renew the root Node.
func (n *Node) FreeChild() Free the node and it's children.

add methods:
func Free(t *Trie) Free all Nodes of the Trie, renew the root Node.
func (n *Node) FreeChild() Free the node and it's children.
@@ -38,6 +38,31 @@ func New() *Trie {
}
}

// Free all Nodes of the Trie, renew the root Node.
func Free(t *Trie) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being so late to review this. Could you provide a use case in the PR message and also this needs a test.

Aside from that, I'd prefer this to be a method on *Trie and be named (*Trie).Reset().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants