diff options
| author | Ian Lance Taylor <iant@golang.org> | 2022-01-19 14:01:38 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2022-01-19 22:03:08 +0000 |
| commit | 8a167c4e813db1f35da898036c2a2469d2dcb181 (patch) | |
| tree | 880a6ef7a0df1f15e0eec0cb14e0ad82bc05ebb9 | |
| parent | 983df7993af0dda308e4efa51b0e451fbe09aa17 (diff) | |
| download | go-x-proposal-8a167c4e813db1f35da898036c2a2469d2dcb181.tar.xz | |
design/43651-type-parameters: change constraints.Number to Integer
The actual constraints package has the latter but not the former.
Change-Id: I9377c43c4421fde50823119bb3c7b165470e8736
Reviewed-on: https://go-review.googlesource.com/c/proposal/+/379614
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
| -rw-r--r-- | design/43651-type-parameters.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/design/43651-type-parameters.md b/design/43651-type-parameters.md index 7ee6dfe..d280f59 100644 --- a/design/43651-type-parameters.md +++ b/design/43651-type-parameters.md @@ -1459,7 +1459,7 @@ requirement. ``` // Double returns a new slice that contains all the elements of s, doubled. -func Double[E constraints.Number](s []E) []E { +func Double[E constraints.Integer](s []E) []E { r := make([]E, len(s)) for i, v := range s { r[i] = v + v @@ -1491,7 +1491,7 @@ type SC[E any] interface { // DoubleDefined returns a new slice that contains the elements of s, // doubled, and also has the same type as s. -func DoubleDefined[S SC[E], E constraints.Number](s S) S { +func DoubleDefined[S SC[E], E constraints.Integer](s S) S { // Note that here we pass S to make, where above we passed []E. r := make(S, len(s)) for i, v := range s { |
