You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, it's impossible to clear the OrderedMap keeping its capacity.
A simple implementation would be:
func (l*list[K, V]) Clear() {
l.root=Element[K, V]{} // just in case K & V are pointer types
}
func (m*OrderedMap[K, V]) Clear() {
clear(m.kv)
m.ll.Clear()
}
The text was updated successfully, but these errors were encountered:
Happy to accept a PR for this. I see clear() was introduced in Go 1.21, so for backwards compatibility it shouldn't use that function in this implementation.
Currently, it's impossible to clear the
OrderedMap
keeping its capacity.A simple implementation would be:
The text was updated successfully, but these errors were encountered: