mirror of
https://github.com/datarhei/core.git
synced 2025-10-29 18:41:57 +08:00
Make ffmpeg skills compareable
This commit is contained in:
28
slices/equal.go
Normal file
28
slices/equal.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package slices
|
||||
|
||||
// EqualComparableElements returns whether two slices have the same elements.
|
||||
func EqualComparableElements[T comparable](a, b []T) bool {
|
||||
extraA, extraB := DiffComparable(a, b)
|
||||
|
||||
if len(extraA) == 0 && len(extraB) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Equaler defines a type that implements the Equal function.
|
||||
type Equaler[T any] interface {
|
||||
Equal(T) bool
|
||||
}
|
||||
|
||||
// EqualEqualerElements returns whether two slices of Equaler have the same elements.
|
||||
func EqualEqualerElements[T any, X Equaler[T]](a []T, b []X) bool {
|
||||
extraA, extraB := DiffEqualer(a, b)
|
||||
|
||||
if len(extraA) == 0 && len(extraB) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user