windows C中的标准数据结构库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1819416/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:30:54  来源:igfitidea点击:

Standard data structure library in C?

cwindowsdata-structures

提问by K Singh

I am looking for standard tried and tested library in C language (Windows platform) which implements data structures like stacks, queues, trees etc.

我正在寻找 C 语言(Windows 平台)中标准的久经考验的库,它实现了堆栈、队列、树等数据结构。

I would prefer to have a source code along with it. Writing a library on my own is possible; however, I feel it may be better to opt for some industry standard implementation which may be optimised and less buggy.

我宁愿有一个源代码。自己写一个库是可能的;但是,我觉得最好选择一些可以优化且错误更少的行业标准实现。

Compiler is Visual Studio 2005/2008.

编译器是 Visual Studio 2005/2008。

回答by qrdl

Glib

油嘴滑舌

Download Glib for Windows here

在此处下载适用于 Windows 的 Glib

回答by Vijay Mathew

  • GDSL. As per the documents, it is pure ANSI C and should work with Visual C++.
  • C-generic-library
  • Kompimi. C data structure library, with an emphasis on collections. Comes with Visual Studio project files.
  • GDSL。根据文档,它是纯 ANSI C,应该与 Visual C++ 一起使用。
  • C-泛型库
  • 孔皮米。C 数据结构库,重点是集合。附带 Visual Studio 项目文件。

回答by CoreyStup

Check out cbase. Its LGPL (most of the other libraries are GPL) if license is something that concerns you.

查看cbase。它的 LGPL(大多数其他库都是 GPL)如果许可是你关心的事情。

My only comment is that it requires C99 or GCC. It uses variadic macros, which aren't C89 compatible. It should compile fine under VC2005/2008.

我唯一的评论是它需要 C99 或 GCC。它使用与 C89 不兼容的可变参数宏。它应该在 VC2005/2008 下编译得很好。

cbase is a C library of useful functions that simplify systems software development on System V UNIX. The library includes routines for memory management, string parsing, filesystem traversal, subprocess execution, I/O, as well as implementations of common data structures such as linked lists, hash tables, stacks, and queues. The library also includes a high-level interface to Berkeley sockets, and an implementation of a scheduler which has functionality very similar to that of the cron daemon. Note: cbase was formerly known as CFL.

cbase 是一个包含有用函数的 C 库,可简化 System V UNIX 上的系统软件开发。该库包括用于内存管理、字符串解析、文件系统遍历、子进程执行、I/O 以及常见数据结构(如链表、哈希表、堆栈和队列)的实现的例程。该库还包括一个到 Berkeley 套接字的高级接口,以及一个调度程序的实现,其功能与 cron 守护程序的功能非常相似。注意:cbase 以前称为 CFL。

回答by user3474832

Have you checked out qLibc? It's an opensource C implementation that provides various types of data strucutre such as hash table, linked list, queue, stack...

你检查过 qLibc 吗?它是一个开源的 C 实现,提供了各种类型的数据结构,例如哈希表、链表、队列、堆栈......

As of today, from it's website I see it has following feature set:

截至今天,从它的网站我看到它具有以下功能集:

  • Containers
    • List --- Doubly Linked List.
    • List Table --- KEY/VALUE paired table implemented on linked-list.
    • Hash Table --- Hash based KEY/VALUE paired table.
    • Static Hash Table --- Static(array/mmapped/shared) memory based KEY/VALUE paired table.
    • Vector --- implements a growable array of elements.
    • Queue --- FIFO(First In First Out) implementation.
    • Stack --- LIFO(Last In First Out) implementation.
  • General utilities.
    • String
    • I/O
    • File
    • IPC, Semaphore Shared-memory
    • En/decoders
    • Hashes
    • System
    • Time
  • Extensions
    • INI-style Configuration File Parser.
    • Apache-style Configuration File Parser.
    • Rotating File Logger.
    • HTTP client.
    • Database(MySQL) interface.
  • 容器
    • 列表---双向链表。
    • 列表表---在链表上实现的键/值配对表。
    • 哈希表 --- 基于哈希的 KEY/VALUE 配对表。
    • 静态哈希表 --- 基于静态(数组/映射/共享)内存的 KEY/VALUE 配对表。
    • Vector --- 实现了一个可增长的元素数组。
    • 队列 --- FIFO(先进先出)实现。
    • 堆栈 --- LIFO(后进先出)实现。
  • 一般公用事业。
    • 细绳
    • 输入/输出
    • 文件
    • IPC,信号量共享内存
    • 编码器/解码器
    • 哈希值
    • 系统
    • 时间
  • 扩展
    • INI 风格的配置文件解析器。
    • Apache 风格的配置文件解析器。
    • 旋转文件记录器。
    • HTTP 客户端。
    • 数据库(MySQL)接口。

In each container implementation, it clearly explains internal data structure at the top of code. So it would be helpful for you to catch the implementation ideas.

在每个容器实现中,都在代码顶部清楚地说明了内部数据结构。因此,了解实施思路对您很有帮助。

The code can be found at https://github.com/wolkykim/qlibc

代码可以在https://github.com/wolkykim/qlibc找到

Hope this helps. (Please do vote if this helps, I need some points. Thanks :)

希望这可以帮助。(如果这有帮助,请投票,我需要一些积分。谢谢:)

回答by gio

You might want to have a look at http://www.liblfds.org/

你可能想看看http://www.liblfds.org/