move out c/cpp/py

This commit is contained in:
Li Jie
2025-04-03 15:52:18 +08:00
parent 0a8a4eb6a6
commit ed366568b4
777 changed files with 4608 additions and 139122 deletions

37
cl/_testgo/tpinst/main.go Normal file
View File

@@ -0,0 +1,37 @@
package main
type M[T interface{}] struct {
v T
}
func (pt *M[T]) Value() T {
return pt.v
}
func (pt *M[T]) value() T {
return pt.v
}
type I[T interface{}] interface {
Value() T
}
func demo() {
var v1 I[int] = &M[int]{100}
if v1.Value() != 100 {
panic("error")
}
var v2 I[float64] = &M[float64]{100.1}
if v2.Value() != 100.1 {
panic("error")
}
if v1.(interface{ value() int }).value() != 100 {
panic("error")
}
}
func main() {
demo()
}