示例#1
0
func tree_to_chan(tree *llrb_tree.Tree, order int) (channel chan Item) {
	channel = make(chan Item, tree.Len())
	for item := range tree.Iter(order) {
		channel <- item
	}
	close(channel)
	return channel
}
示例#2
0
func tree_to_slice(tree *llrb_tree.Tree, order int) (slice []Item) {
	slice = make([]Item, tree.Len())
	var i int
	for item := range tree.Iter(order) {
		slice[i] = item
		i++
	}
	return
}