File: testvariables_generic.go

package info (click to toggle)
delve 1.26.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 15,084 kB
  • sloc: ansic: 111,947; sh: 194; asm: 147; makefile: 43; python: 23
file content (22 lines) | stat: -rw-r--r-- 304 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"fmt"
	"runtime"
)

type astruct struct {
	x, y int
}

func testfn[T any, K comparable](arg1 T, arg2 K) {
	m := make(map[K]T)
	m[arg2] = arg1
	runtime.Breakpoint()
	fmt.Println(arg1, arg2, m)
}

func main() {
	testfn[int, float32](3, 2.1)
	testfn(&astruct{0, 1}, astruct{2, 3})
}