Skip to content

Commit

Permalink
improve godoc
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Mar 18, 2023
1 parent 17269e1 commit 6b6e5bf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions osmoutils/slice_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ func ContainsDuplicate[T any](arr []T) bool {
type LessFunc[T any] func(a, b T) bool

// MergeSlices efficiently merges two sorted slices into a single sorted slice.
// The resulting slice contains all elements from slice1 and slice2, sorted according to the less function.
// The input slices must be sorted in ascending order according to the less function.
// The less function takes two elements of type T and returns a boolean value indicating whether the first element is less than the second element.
// The function returns a new slice containing all elements from slice1 and slice2, sorted according to the less function.
// The function does not modify the input slices.
func MergeSlices[T any](slice1, slice2 []T, less LessFunc[T]) []T {
result := make([]T, 0, len(slice1)+len(slice2))
i, j := 0, 0
Expand Down

0 comments on commit 6b6e5bf

Please sign in to comment.