mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
slices: explicitly document nil and empty slice equality
Fixes #68472 Change-Id: I21282621d679d9e2b032256b338c0b5ff107c8f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/599816 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
f0de94ff12
commit
a799fa5189
1 changed files with 1 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ import (
|
|||
// elements equal. If the lengths are different, Equal returns false.
|
||||
// Otherwise, the elements are compared in increasing index order, and the
|
||||
// comparison stops at the first unequal pair.
|
||||
// Empty and nil slices are considered equal.
|
||||
// Floating point NaNs are not considered equal.
|
||||
func Equal[S ~[]E, E comparable](s1, s2 S) bool {
|
||||
if len(s1) != len(s2) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue