GithubHelp home page GithubHelp logo

happy-ferret / stl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zenixls2/stl

0.0 1.0 0.0 9 KB

introduce c++ stl containers to golang (ex: sorted map)

License: MIT License

Go 57.33% C++ 32.83% C 9.83%

stl's Introduction

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

type Iterator interface {
	Value() uintptr
	Key() int
	Next() Iterator
	Prev() Iterator
}

type Map

type Map struct {
}

func NewMap

func NewMap() Map

creates a new empty map

func (Map) Add

func (sm Map) Add(key int, value interface{})

Add key, value pair to map

func (Map) Free

func (sm Map) Free()

Free release memory hold by map containers. be sure to call this to prevent memory leak.

func (Map) Get

func (sm Map) Get(key int) uintptr

Get value by key from map

func (Map) LowerBound

func (sm Map) LowerBound(key int) Iterator

returns an iterator to the first element not less than the given key.

func (Map) UpperBound

func (sm Map) UpperBound(key int) Iterator

returns an iterator to the first element greater than the given key

type MapIterator

type MapIterator struct {
}

func (MapIterator) Key

func (si MapIterator) Key() int

get element key from iterator

func (MapIterator) Next

func (si MapIterator) Next() Iterator

iterator move to next

func (MapIterator) Prev

func (si MapIterator) Prev() Iterator

iterator move to prev

func (MapIterator) Value

func (si MapIterator) Value() uintptr

get element pointer from iterator

stl's People

Contributors

zenixls2 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.