KlibC 通用库
Klib 是一个 C 通用库,是一个轻量级和独立的 Glib 版本。
包括如下常用组件:
- kavl.h: 通用侵入式AVL树。
-
ksort.h: 通用排序,包括introsort,merge排序,heap排序,comb排序,Knuth随机播放和k-small算法。
-
kvec.h: 通用动态数组。
-
klist.h: 通用单链列表和内存池。
-
kstring.{h,c}: 基本的字符串库。
-
kmath.{h,c}: 包括MT19937-64 伪随机数生成器,基本非线性编程和一些特殊数学函数的数值例程。
- ketopt.h:具有类似getopt_long的API的可移植命令行参数解析器。
示例代码:
#include "khash.h" KHASH_MAP_INIT_INT(m32, char) // instantiate structs and methods int main() { int ret, is_missing; khint_t k; khash_t(m32) *h = kh_init(m32); // allocate a hash table k = kh_put(m32, h, 5, &ret); // insert a key to the hash table if (!ret) kh_del(m32, h, k); kh_value(h, k) = 10; // set the value k = kh_get(m32, h, 10); // query the hash table is_missing = (k == kh_end(h)); // test if the key is present k = kh_get(m32, h, 5); kh_del(m32, h, k); // remove a key-value pair for (k = kh_begin(h); k != kh_end(h); ++k) // traverse if (kh_exist(h, k)) // test if a bucket contains data kh_value(h, k) = 1; kh_destroy(m32, h); // deallocate the hash table return 0; }
评论
GDSL通用数据结构库
GDSL(通用数据结构库)包含一组程序用于操作各种数据结构。这是一个可移植的库,完全由ANSIC编写。为C开发者提供强大的算法和隐藏的数据结构操作方法。目前支持的数据结构包括:lists,queues
GDSL通用数据结构库
0
Common4AndroidAndroid 通用工具库
Common4Android是一个通用Android工具库,包含网络库、线程管理器、常用Util工具
Common4AndroidAndroid 通用工具库
0
Golang-PoolGolang 通用连接池库
Golang实现的连接池功能:连接池中连接类型为interface{},使得更加通用链接的最大空闲时间,超时的链接将关闭丢弃,可避免空闲时链接自动失效问题使用channel处理池中的链接,高效基本用法
Golang-PoolGolang 通用连接池库
0
Collections-C通用数据结构库
Collections-C是一款通用数据结构库,包括:列表,数组,哈希表,双堆队列等。安装安装条件gccautoconfautomakelibtoolm4新建项目在项目目录,运行以下命令:./auto
Collections-C通用数据结构库
0