Update lectures/08-generics/lecture.slide
This commit is contained in:
parent
a62fc07303
commit
e6a1932822
1 changed files with 2 additions and 2 deletions
|
@ -329,14 +329,14 @@ Why don't we need explicit type parameters?
|
||||||
* Relationships between type parameters
|
* Relationships between type parameters
|
||||||
|
|
||||||
type Pointer[T any] interface {
|
type Pointer[T any] interface {
|
||||||
type *T
|
*T
|
||||||
}
|
}
|
||||||
|
|
||||||
func f[T any, PT Pointer[T]](x T)
|
func f[T any, PT Pointer[T]](x T)
|
||||||
|
|
||||||
or with inlined constraint
|
or with inlined constraint
|
||||||
|
|
||||||
func foo[T any, PT interface{type *T}](x T)
|
func foo[T any, PT interface{*T}](x T)
|
||||||
|
|
||||||
* When to use generics
|
* When to use generics
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue