Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gostl

> 编程语言
Open source

Data structure and algorithm library for go, designed to provide functions similar to C++ STL

1.1K stars0 likes0 views
WebsiteGitHub

About

Data structure and algorithm library for go, designed to provide functions similar to C++ STL

GoSTL

English | 简体中文

Introduction

GoSTL is a data structure and algorithm library for go, designed to provide functions similar to C++ STL, but more powerful. Combined with the characteristics of go language, most of the data structures have realized goroutine-safe. When creating objects, you can specify whether to turn it on or not through configuration parameters.

Function list

  • data structure
    • slice
    • array
    • vector
    • list
    • deque
    • queue
    • priority_queue
    • stack
    • rbtree(red_black_tree)
    • map/multimap
    • set/multiset
    • bitmap
    • bloom_filter
    • hamt(hash_array_mapped_trie)
    • ketama
    • skiplist
  • algorithm
    • sort(quick_sort)
    • stable_sort(merge_sort)
    • binary_search
    • lower_bound
    • upper_bound
    • next_permutation
    • nth_element
    • swap
    • reverse
    • count/count_if
    • find/find_if
    • min_element/max_element

Examples

slice

The slice in this library is a wrapper of go native slice.

go
package main

import (
 "fmt"
 "github.com/liyue201/gostl/algorithm/sort"
 "github.com/liyue201/gostl/ds/slice"
 "github.com/liyue201/gostl/utils/comparator"
)

func main() {
 a := make([]int, 0)
 a = append(a, 2)
 a = append(a, 1)
 a = append(a, 3)
 fmt.Printf("%v\n", a)

 wa := slice.NewSliceWrapper(a)

 // sort in ascending
 sort.Sort[int](wa.Begin(), wa.End(), comparator.IntComparator)
 fmt.Printf("%v\n", a)

 // sort in descending
 sort.Sort[int](wa.Begin(), wa.End(), comparator.Reverse(comparator.IntComparator))
 fmt.Printf("%v\n", a)
}

array

Array is a data structure with fixed length once it is created, which supports random access and iterator access.

…

Stargazers over time

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gobitmapbloomfilterrdequehamt

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言