Source file src/cmd/api/testdata/src/pkg/p4/p4.go
1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package p4 6 7 type Pair[T1 interface{ M() }, T2 ~int] struct { 8 f1 T1 9 f2 T2 10 } 11 12 func NewPair[T1 interface{ M() }, T2 ~int](v1 T1, v2 T2) Pair[T1, T2] { 13 return Pair[T1, T2]{f1: v1, f2: v2} 14 } 15 16 func (p Pair[X1, _]) First() X1 { 17 return p.f1 18 } 19 20 func (p Pair[_, X2]) Second() X2 { 21 return p.f2 22 } 23 24 // Deprecated: Use something else. 25 func Clone[S ~[]T, T any](s S) S { 26 return append(S(nil), s...) 27 } 28