Skip to content

About

C++ standard library types and concurrency primitives implemented from scratch.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpp-from-scratch

CI

C++ implementations of standard library types and concurrency primitives, written to understand how they work.

Folder Contents
os/ threads, atomics, mutex, semaphore, condition variable, reader-writer lock, producer-consumer, dining philosophers, thread pool, promise/future/async
smartptr/ auto_ptr, unique_ptr, shared_ptr
stl/ vector, hash table, BST, AVL tree, red-black tree
oop/ encapsulation, abstraction, inheritance, polymorphism

Tests

The classes are tested in tests/ against their standard-library counterparts, under AddressSanitizer and UndefinedBehaviorSanitizer, with ThreadSanitizer for the threaded ones:

tests/run.sh        # or: tests/run.sh g++

GitHub Actions runs them with GCC 16 and clang on Ubuntu 26.04 on every push. Before GCC 16, libstdc++'s std::counting_semaphore can deadlock under contention (GCC bug 104928), which occasionally hung the semaphore-based producer-consumer, dining philosophers and reader-writer.

Pre-commit hook

Checks that each staged file is clang-formatted and compiles. Enable it once per clone:

git config core.hooksPath .githooks

Competitive programming

My contest snippets (modular arithmetic, combinatorics, sieve, Euler's totient, extended GCD, matrix power, DSU, sparse table, Fenwick tree, segment trees with lazy propagation, merge sort tree, LCA, heavy-light decomposition, SCC with condensation, bridges and articulation points, rolling hash, KMP, Z-function, Manacher, tries) are in a gist: cp-snippets.cpp.

About

C++ standard library types and concurrency primitives implemented from scratch.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages