- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for FromStrings (0.09 sec)
-
src/internal/types/testdata/check/funcinference.go
r[i] = v + v } return r } type MySlice []int var _ = Double(MySlice{1}) // From the draft design. type Setter[B any] interface { Set(string) *B } func FromStrings[T interface{}, PT Setter[T]](s []string) []T { result := make([]T, len(s)) for i, v := range s { // The type of &result[i] is *T which is in the type set // of Setter, so we can convert it to PT. p := PT(&result[i])
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Mar 01 21:01:45 UTC 2023 - 2.3K bytes - Viewed (0) -
test/typeparam/settable.go
// Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "strconv" ) // Various implementations of fromStrings(). type Setter[B any] interface { Set(string) *B } // Takes two type parameters where PT = *T func fromStrings1[T any, PT Setter[T]](s []string) []T { result := make([]T, len(s))
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Mar 01 23:48:58 UTC 2022 - 2.7K bytes - Viewed (0)