{} OpenCSTL v1.0
Single-header · C89~C23 · MIT

Write C.
Feel STL.

OpenCSTL is a single-header, C-native container library that brings the feel of C++ STL into pure C. push_back, insert, begin/end, rbegin/rend, first/second, even [] access — without templates, codegen, or per-type macro rituals.

example.c
#include "opencstl.h"

int main(void) {
    VECTOR(int) = new_vector(int);

    push_back(v, 10);
    push_back(v, 20);
    push_back(v, 30);

    // STL-like iterators…
    for (int* it = begin(v); it != end(v); it = next(v, it))
        printf("%d\n", *it);

    // …or just index it like an array.
    for (size_t i = 0; i < size(v); i++)
        printf("v[%zu] = %d\n", i, v[i]);
}

Four design choices, end to end.

The differences with STC, M*LIB, and CC are not cosmetic. They change what writing a C file feels like.

Where OpenCSTL fits in the C ecosystem.

The C generic-container space has good libraries. OpenCSTL is the only one that ticks every box on this list — and that combination is what reproduces the C++ STL feel.

ㅁㄱㄱ묘fkd
OpenCSTL STC M*LIB CC CMC Collections-C stb_ds klib
v[i] / q[i] index access
No forward declaration
C99 support
Header-only
Single-file header
Same interface across containers ~ ~ ~

Most of the STL you actually reach for.

The set leans on what C programmers use day to day — sequence, associative, and hashed — plus the adaptor trio (stack, queue, priority_queue).

vector
Dynamic array, v[i] access
deque
Double-ended queue, q[i] access
list
Doubly-linked list
set
Ordered, balanced tree
map
Ordered key → value
unordered_set
Hashed, O(1) avg
unordered_map
Hashed key → value
stack
LIFO adaptor
queue
FIFO adaptor
priority_queue
Heap-based adaptor

STL-like, the C way.

OpenCSTL is not just another C container library. It is a single-header, C-native STL-like library that lets C programmers write containers with familiar C++ STL semantics — without templates, code generation, or per-type macro boilerplate.

OpenCSTL은 단순한 C 컨테이너 라이브러리가 아닙니다. push_back, insert, begin/end, rbegin/rend, first/second, [ ] 접근까지 C++ STL의 사용감을 C 코드 안에서 그대로 구현한 single-header C-native STL-like library입니다.

One file. Drop it in. Compile.

No build system to configure, no submodule to wire up, no per-type template instantiation file to maintain. Curl it, include it, ship.

shell
$ curl -LO https://raw.githubusercontent.com/springkim/OpenCSTL/refs/heads/master/opencstl.h
$ gcc main.c -p main
$ ./main

Nine compilers. Three OSes.

From MSVC 2026 to tcc, from Windows to Linux to macOS — OpenCSTL builds cleanly across the C ecosystem you actually ship in. Every C standard from C89 through C23 is supported, and the single header even compiles on C++ compilers.

9 Compilers
3 Platforms
C89→C23 + C++ compilers
Compiler Windows macOS Linux
MSVC cl
GNU / MinGW64 gcc
LLVM clang
Intel icx-cc
Tiny C Compiler tcc
zig cc
Pelles C pocc
NVCC nvcc
C++Builder bcc64x
Supported Not supported Standards: C89 · C99 · C11 · C17 · C23 · also builds on C++ compilers