Sindex

Share on:

Slice Indexing library for Golang. SIndex is a slice indexing library. It maintains an ordered list, by mapping list positions to slice indexes. sindex.Interface implementation types: List (Basic slice list), LinkedList (Todo)

https://github.com/timob/sindex

Documentation

https://godoc.org/github.com/timob/sindex

Example

func ExampleList() {
    bytes := []byte("helloworld")
    bl := sindex.NewList(&bytes)
    bytes[bl.Insert(5)] = ' '
    bytes[bl.Append()] = '!'

    fmt.Println(string(bytes))

    for iter := bl.Iterator(0); iter.Next(); {
        fmt.Print(string(bytes[iter.Pos()]))
    }

    // Output:
    // hello world!
    // hello world!
}