Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

https://godoc.org/github.com/gogf/gf/container/gring

gring支持链式操作。


...

New(cap int, safe ...bool) *Ring

  • 说明:New创建并返回cap元素的环形结构。可选参数safe指定是否在并发安全中使用此结构,默认情况下为false

    Code Block
    languagego
    func ExampleNew() {
    	gring.New(10)
    	gring.New(10, true)
    
    	// Output:
    }


...

使用示例,约瑟夫问题

我们使用ring来模拟一下约瑟夫问题

...