Changed generic type constraint
This commit is contained in:
8
Tree.go
8
Tree.go
@ -15,7 +15,7 @@ const (
|
||||
)
|
||||
|
||||
// Tree represents a radix tree.
|
||||
type Tree[T comparable] struct {
|
||||
type Tree[T any] struct {
|
||||
root treeNode[T]
|
||||
static map[string]T
|
||||
canBeStatic [2048]bool
|
||||
@ -238,12 +238,8 @@ begin:
|
||||
|
||||
// Bind binds all handlers to a new one provided by the callback.
|
||||
func (tree *Tree[T]) Bind(transform func(T) T) {
|
||||
var empty T
|
||||
|
||||
tree.root.each(func(node *treeNode[T]) {
|
||||
if node.data != empty {
|
||||
node.data = transform(node.data)
|
||||
}
|
||||
node.data = transform(node.data)
|
||||
})
|
||||
|
||||
for key, value := range tree.static {
|
||||
|
Reference in New Issue
Block a user