-- 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 .
$ godocdown > README.md
$ go get github.com/zenixls2/stl
https://godoc.org/github.com/zenixls2/stl
type Iterator interface {
Value() uintptr
Key() int
Next() Iterator
Prev() Iterator
}
type Map struct {
}
func NewMap() Map
creates a new empty map
func (sm Map) Add(key int, value interface{})
Add key, value pair to map
func (sm Map) Free()
Free release memory hold by map containers. be sure to call this to prevent memory leak.
func (sm Map) Get(key int) uintptr
Get value by key from map
func (sm Map) LowerBound(key int) Iterator
returns an iterator to the first element not less than the given key.
func (sm Map) UpperBound(key int) Iterator
returns an iterator to the first element greater than the given key
type MapIterator struct {
}
func (si MapIterator) Key() int
get element key from iterator
func (si MapIterator) Next() Iterator
iterator move to next
func (si MapIterator) Prev() Iterator
iterator move to prev
func (si MapIterator) Value() uintptr
get element pointer from iterator