💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
~~~ package main import "fmt" type Queue []int func (q *Queue) Push(a int) { *q = append(*q, a) } func (q *Queue) Pop() int { head := (*q)[0] *q = (*q)[1:] return head } func (q *Queue) IsEmpty() bool { return len(*q) == 0 } func main() { q := Queue{1} q.Push(2) q.Push(3) q.Pop() fmt.Println(q.IsEmpty()) fmt.Println(q) } ~~~