引用来自“周翼翼”的答案
引用来自“中山野鬼”的答案
引用来自“Jack.arain”的答案
引用来自“中山野鬼”的答案
引用来自“Jack.arain”的答案
引用来自“StormFour”的答案
引用来自“宏哥”的答案
引用来自“mallon”的答案
STL 就是一陀屎,线程都不支持
等看你被喷,哈哈
不管你敢不敢说,我反正不敢
O(∩_∩)O哈哈~ 宏哥要坚持啊~!把好的拿出来,让垃圾见shit去吧
用C的都是高手牛人, 谁敢喷, 只有我等C++用户, 躺着也中枪.
哈。让我想到 “大兵小将”你们。王宝强演的探子了。 中枪了,然后一句“什么情况。。。”
看过不少C的项目代码, 还真没几个用cstl的, 都是自己构造数据结构, 真正的c程序员动手能力非常强的, 而不是吹牛能力强. 不过我们c++程序员就不一样了, 只有逼不得已才可能写数据结构...
C写数据结构是迫不得已。我N多年前,就自己写标准数据结构库了,用C语言。目的就是想不要重写。后来发现,更本不现实。C语言很多算法,和数据结构的存储方式密切相关。因此抽象的数据结构并不能有效的解决实现的问题。最多只能原理性的验证代码是否有BUG。但是如果只是验证原理性,用C语言就有点变态了。
一个典型的例子就是二叉树用2^N数组来排序,树逻辑的存储位置和实际存储地址密切相关。这是C语言要关心的,其他语言不应该关系的。由此,使用C写数据结构,多半都是工程目标导致必须要重写。
如果学习, 还是自己一个一个写来的效果好.
如果生产, 还是自己一个一个写来的可控制.
前面有些同志提到的libcstl, 我跑去看了一下, 就挑它的单链表来看, 一看就太哆嗦.还有一堆的assert, 你敢在生产环境用它嘛, 反正我是不敢.
还有其它的问题, 如果用库, 用你只是想用它的一点点功能, 但还是必须拖一整个库.
http://developer.gnome.org/glib/2.33/
那可以看看这个
Doubly-Linked Lists — linked lists that can be iterated over in both directions
Singly-Linked Lists — linked lists that can be iterated in one direction
Double-ended Queues — double-ended queue data structure
Sequences — scalable lists
Trash Stacks — maintain a stack of unused allocated memory chunks
Hash Tables — associations between keys and values so that given a key the value can be found quickly
Strings — text buffers which grow automatically as text is added
String Chunks — efficient storage of groups of strings
Arrays — arrays of arbitrary elements which grow automatically as elements are added
Pointer Arrays — arrays of pointers to any type of data, which grow automatically as new elements are added
Byte Arrays — arrays of bytes
Balanced Binary Trees — a sorted collection of key/value pairs optimized for searching and traversing in order
N-ary Trees — trees of data with any number of branches
Quarks — a 2-way association between a string and a unique integer identifier
Keyed Data Lists — lists of data elements which are accessible by a string or GQuark identifier
这是他支持的数据结构,而且gtk的基础应该就是他了,稳定性相对应该很好。