Skip to content

Commit

Permalink
Add comment to cloneIntSlice
Browse files Browse the repository at this point in the history
  • Loading branch information
vzvu3k6k committed Feb 27, 2021
1 parent 2c8fbf0 commit 651bbbc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sorts/sorts_testcases.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ func getSortedVersion(a []int) []int {
return b
}

// cloneIntSlice returns a copy of a given slice of int.
// Useful to protect a slice from in-place sorting functions.
func cloneIntSlice(src []int) []int {
vals := make([]int, len(src))
copy(vals, src)
Expand Down

0 comments on commit 651bbbc

Please sign in to comment.