mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-03 03:47:38 +03:00
16 lines
236 B
Go
16 lines
236 B
Go
//go:build !go1.21
|
|
|
|
package common
|
|
|
|
func ClearArray[T ~[]E, E any](t T) {
|
|
var defaultValue E
|
|
for i := range t {
|
|
t[i] = defaultValue
|
|
}
|
|
}
|
|
|
|
func ClearMap[T ~map[K]V, K comparable, V any](t T) {
|
|
for k := range t {
|
|
delete(t, k)
|
|
}
|
|
}
|