1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 08:32:40 +08:00

优化range引用

This commit is contained in:
2022-07-04 12:01:44 +08:00
parent 44304f5b16
commit 886723997e
8 changed files with 143 additions and 12 deletions

View File

@ -88,7 +88,8 @@ func (m *sorted_map[K, V]) Iter() <-chan *Entry[K, V] {
}
func (m *sorted_map[K, V]) ForEach(f func(K, V) bool) {
for _, k := range m.keys {
keys := m.keys[:]
for _, k := range keys {
if v, ok := m.Get(k); ok {
if f(k, v) {
break