4.0初步改造

This commit is contained in:
dexter
2022-02-02 10:39:09 +08:00
parent 6ace71fac6
commit b2489b2305
59 changed files with 6192 additions and 2061 deletions

21
util/slice.go Normal file
View File

@@ -0,0 +1,21 @@
package util
type Slice[T comparable] []T
func (s Slice[T]) Len() int {
return len(s)
}
func (s *Slice[T]) Add(v T) {
*s = append(*s, v)
}
func (s *Slice[T]) Delete(v T) bool {
for i, val := range *s {
if val == v {
*s = append((*s)[:i], (*s)[i+1:]...)
return true
}
}
return false
}