Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zenixls2/stl
introduce c++ stl containers to golang (ex: sorted map)
https://github.com/zenixls2/stl
cplusplus-14 golang stl-containers
Last synced: 29 days ago
JSON representation
introduce c++ stl containers to golang (ex: sorted map)
- Host: GitHub
- URL: https://github.com/zenixls2/stl
- Owner: zenixls2
- License: mit
- Created: 2017-02-20T09:55:22.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-20T11:22:47.000Z (almost 8 years ago)
- Last Synced: 2024-10-15T09:51:05.111Z (3 months ago)
- Topics: cplusplus-14, golang, stl-containers
- Language: Go
- Size: 8.79 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stl
--
import "github.com/zenixls2/stl"+build cgo
The stl package provides c++ standard template library binding to golang.
Currently this project only demonstrate several techniques to design the
wrapper. Binding to C++ techniques are based on
http://stackoverflow.com/questions/1713214/how-to-use-c-in-go .### Doc Generation
$ godocdown > README.md
### Installation
$ go get github.com/zenixls2/stl
### Documentation
https://godoc.org/github.com/zenixls2/stl
## Usage
#### type Iterator
```go
type Iterator interface {
Value() uintptr
Key() int
Next() Iterator
Prev() Iterator
}
```#### type Map
```go
type Map struct {
}
```#### func NewMap
```go
func NewMap() Map
```
creates a new empty map#### func (Map) Add
```go
func (sm Map) Add(key int, value interface{})
```
Add key, value pair to map#### func (Map) Free
```go
func (sm Map) Free()
```
Free release memory hold by map containers. be sure to call this to prevent
memory leak.#### func (Map) Get
```go
func (sm Map) Get(key int) uintptr
```
Get value by key from map#### func (Map) LowerBound
```go
func (sm Map) LowerBound(key int) Iterator
```
returns an iterator to the first element not less than the given key.#### func (Map) UpperBound
```go
func (sm Map) UpperBound(key int) Iterator
```
returns an iterator to the first element greater than the given key#### type MapIterator
```go
type MapIterator struct {
}
```#### func (MapIterator) Key
```go
func (si MapIterator) Key() int
```
get element key from iterator#### func (MapIterator) Next
```go
func (si MapIterator) Next() Iterator
```
iterator move to next#### func (MapIterator) Prev
```go
func (si MapIterator) Prev() Iterator
```
iterator move to prev#### func (MapIterator) Value
```go
func (si MapIterator) Value() uintptr
```
get element pointer from iterator