我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

有什么办法可以使Go的频道表现得像个堆栈

Go channels by default behave like a queue as far as I can tell, first in first out. Is there any way to change them to work last in first out?

Basically I am doing a search and want to do DFS instead of BFS for memory constraints.

No, this is not possible - channels are always FIFO. You could use package container/heap.

近期文章

  • 您如何查看特定go功能的文档?
  • 如何在具有非IN条件的已准备好的SQL语句中将[]切片传递给IN条件?
  • Golang对VSTS Git的支持
  • 将已编译的正则表达式转换为字符串
  • 为什么带有匿名结构字段的结构不满足在该类型的别名上定义的方法?
  • 我如何匹配除“ &&”以外的任何字符?
  • 返回数组作为接口
  • Golang,带有指针和接口的用例
  • 继续:关于多项任务的困惑
  • bufio.NewScanner作为函数参数
  • 在Go中包装多个实现
  • 匹配单斜杠时出现golang regex错误
  • 关闭浏览器上的Go服务器
  • 去设定时间,即。 2周,1个月,1年等
  • Golang没有看到其他文件的功能
  • 包含字符串和整数的Golang映射
  • 缓存在内存中并使用go-routine更新的最佳方法是什么?
  • 并发:限制goroutines无法按预期工作
  • 指针字符串切片(* [] string)的Cgo指针传递规则?
  • 通道在workerpool上的死锁

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华