awsong / go-darts

Double-ARray Trie System for golang
Other
95 stars 24 forks source link

Darts.go:75 cap func should be replaced by len func #4

Open CrisisTM opened 5 years ago

CrisisTM commented 5 years ago

if you wanna build a DA Trie with thousands of nodes, there may cause errors.

awsong commented 5 years ago

Could you elaborate or give some test case? I intended to get the capacity of the slice, thus using cap func. Can't simply replace it with len func.

wxf4150 commented 1 year ago

https://github.com/awsong/go-darts/blob/1b63d94fdbea0f52b98c2d5ff42fb0b8f9de77b2/darts.go#L74-L84

"if newSize > cap(d.darts.Base) " 应该换成 if newSize > len(d.darts.Base) 。不改 TestExactMatchSearch测试都通不过。