A header-only C library providing generic, type-safe data structures using macros for easy integration and modularity.
C Macro Collections is a header-only library that provides generic, type-safe implementations of common data structures for the C programming language. It uses macros to generate type-specific code at compile time, solving the problem of C's lack of built-in generics while maintaining performance and safety. The library includes a wide range of collections like lists, maps, sets, and queues, all designed for easy integration and modular use.
C developers needing robust, reusable data structures without external dependencies, particularly those working on embedded systems, performance-critical applications, or projects where avoiding complex build systems is essential.
It offers a pure C solution with no runtime overhead, full type safety through macros, and a modular design that lets developers include only the collections they need. Unlike template-based approaches in other languages, it keeps compilation fast and integrates seamlessly into existing C codebases.
Easy to use, modular, header only, macro based, generic and type-safe Data Structures in C
No installation or build system required; simply include headers with a compiler flag, making it easy to integrate into any C project without dependencies.
Uses C macros to generate type-specific implementations at compile time, ensuring type safety and reducing code duplication while maintaining performance.
Offers a wide range of data structures including lists, maps, sets, and specialized types like interval heaps, covering most common use cases in C development.
Supports custom allocators, function tables for data operations, and callbacks for CRUD actions, providing fine-grained control over memory and behavior.
Heavy reliance on macros can make code harder to read, debug, and maintain, especially for developers unfamiliar with macro metaprogramming in C.
All collections must be allocated on the heap, as noted in the design decisions, which may not suit performance-critical or embedded systems preferring stack allocation.
Several collections like SkipList and TreeBidiMap are marked as WIP in the README, indicating the library is still under development and lacks some advanced structures.
Modifying a collection invalidates all iterators (except for LinkedList using node-based functions), limiting flexibility during traversal and updates.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.