Skip to content

Wrap standard library containers list、ring、 heap、 sync.Pool and sync.Map use generics to achieve type safety

Notifications You must be signed in to change notification settings

button-chen/typesafecontainer-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Go 类型安全容器库

使用示例

1. 类型安全的 sync.Map

package main

import (
    "fmt"
    ts "github.com/button-chen/typesafecontainer-go/typesafecontainer"
)

func main() {
    // 创建一个类型安全的TMap(封装sync.Map)
    ssm := ts.TMap[string, string]{}

    ssm.Store("foo", "bar")
    fmt.Println(ssm.Load("foo"))
}

About

Wrap standard library containers list、ring、 heap、 sync.Pool and sync.Map use generics to achieve type safety

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages