This library provides various containers. Each container has utility functions
to manipulate the data it holds. This is an abstraction as to not have to
manually manage and reallocate memory.
Inspired by the C++ standard library; however, implemented using C with
different function interfaces as the C++ standard library but with the same
It is possible to compile this library as either static
.a or dynamic
- A static library is slightly faster than a dynamic one, however, if the
library is modified, the entire project codebase which uses it will need to be
- A dynamic library can be changed without relinking the codebase, assuming
no function definitions have changed.
The installation process is as follows:
- Clone this repository and navigate to it.
make static_gcc or
make dynamic_gcc for either a static or dynamic library.
- Then, you can copy-paste
into your project to include the containers.
- Finally, you remember to link the library by including
containers.so -ldl as an argument.
For high-level documentation and usage, visit the
documentation page. For in-depth documentation, visit the
code docs page.
The container types that this library contains are described below.
Data structures which can be accessed sequentially.
- array - static contiguous array
- vector - dynamic contiguous array
- deque - double-ended queue
- forward_list - singly-linked list
- list - doubly-linked list
Data structures that can be quickly searched which use comparators.
- set - collection of unique keys, sorted by keys
- map - collection of key-value pairs, sorted by keys, keys are unique
- multiset - collection of keys, sorted by keys
- multimap - collection of key-value pairs, sorted by keys
Unordered associative containers
Data structures that can be quickly searched which use hashing.
- unordered_set - collection of unique keys, hashed by keys
- unordered_map - collection of key-value pairs, hashed by keys, keys are unique
- unordered_multiset - collection of keys, hashed by keys
- unordered_multimap - collection of key-value pairs, hashed by keys
Data structures which adapt other containers to enhance functionality.
- stack - adapts a container to provide stack (last-in first-out)
- queue - adapts a container to provide queue (first-in first-out)
- priority_queue - adapts a container to provide priority queue