go pushback 源码

  • 2022-07-15
  • 浏览 (1062)

golang pushback 代码

文件路径:/src/cmd/compile/internal/ssa/testdata/pushback.go

package main

type Node struct {
	Circular bool
}

type ExtNode[V any] struct {
	v V
	Node
}

type List[V any] struct {
	root *ExtNode[V]
	len  int
}

func (list *List[V]) PushBack(arg V) {
	if list.len == 0 {
		list.root = &ExtNode[V]{v: arg}
		list.root.Circular = true
		list.len++
		return
	}
	list.len++
}

func main() {
	var v List[int]
	v.PushBack(1)
}

相关信息

go 源码目录

相关文章

go convertline 源码

go hist 源码

go i22558 源码

go i22600 源码

go infloop 源码

go inline-dump 源码

go sayhi 源码

go scopes 源码

0  赞