mirror of
https://gitee.com/NorthCityChen/stl-go.git
synced 2025-05-25 20:11:08 +00:00
ADD: readme
This commit is contained in:
parent
18524064a5
commit
89a281434c
52
readme.md
52
readme.md
@ -1,6 +1,6 @@
|
|||||||
<!--
|
<!--
|
||||||
* @Author: NorthCity1984
|
* @Author: NorthCity1984
|
||||||
* @LastEditTime: 2022-04-02 14:23:56
|
* @LastEditTime: 2022-04-02 14:30:28
|
||||||
* @Description:
|
* @Description:
|
||||||
* @Website: https://grimoire.cn
|
* @Website: https://grimoire.cn
|
||||||
* Copyright (c) NorthCity1984 All rights reserved.
|
* Copyright (c) NorthCity1984 All rights reserved.
|
||||||
@ -9,6 +9,56 @@
|
|||||||
|
|
||||||
一个封装了一些简单的数据结构的提供泛型支持的stl库 (go >= 1.18)
|
一个封装了一些简单的数据结构的提供泛型支持的stl库 (go >= 1.18)
|
||||||
|
|
||||||
|
# usage
|
||||||
|
|
||||||
|
## Dequeue
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"gitee.com/NorthCityChen/stl-go/dequeue"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
q := dequeue.Init[int]()
|
||||||
|
q.LPush(12)
|
||||||
|
q.LPush(23)
|
||||||
|
q.LPush(34)
|
||||||
|
q.Clear()
|
||||||
|
q.LPush(34)
|
||||||
|
q.RPush(44)
|
||||||
|
fmt.Println(q.LPop())
|
||||||
|
fmt.Println(q.LPop())
|
||||||
|
fmt.Println(q.LPop())
|
||||||
|
fmt.Println(q.LPop())
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Queue
|
||||||
|
|
||||||
|
```go
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"gitee.com/NorthCityChen/stl-go/queue"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
q := queue.Init[int]()
|
||||||
|
q.Push(12)
|
||||||
|
q.Push(23)
|
||||||
|
q.Push(44)
|
||||||
|
fmt.Println(q.Pop())
|
||||||
|
fmt.Println(q.Pop())
|
||||||
|
fmt.Println(q.Pop())
|
||||||
|
fmt.Println(q.Pop())
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
# RoadMap
|
# RoadMap
|
||||||
|
|
||||||
- [x] 双端队列
|
- [x] 双端队列
|
||||||
|
Loading…
x
Reference in New Issue
Block a user