Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/a-r-r-o-w/traitor
experiments with c++ template metaprogramming and compile-time programming
https://github.com/a-r-r-o-w/traitor
Last synced: about 1 month ago
JSON representation
experiments with c++ template metaprogramming and compile-time programming
- Host: GitHub
- URL: https://github.com/a-r-r-o-w/traitor
- Owner: a-r-r-o-w
- License: mit
- Created: 2023-09-23T08:48:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-17T21:10:51.000Z (about 1 year ago)
- Last Synced: 2024-12-05T17:41:27.589Z (about 1 month ago)
- Language: C++
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# traitor
> Have you ever wanted/were required to sort an array of integers at compile-time? I'm hoping not...
Experiments with C++ template metaprogramming and compile-time hacking.
### installation
You require a C++ compiler installed with C++20 support and CMake. The programs also build with older C++ versions, but the CMakeLists file is configured to use C++20.
```bash
# Tested on g++-10 and above, and clang++-14.git clone https://github.com/a-r-r-o-w/traitor.git
cd traitor
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE .. # If you want to build in debug mode, use -DCMAKE_BUILD_TYPE=DEBUG
make -j4
```### about
I'm using this repository to dump my experiments with C++ template metaprogramming and learn more about compile-time programming. My end goal is to develop a small library for personal use and create all major data structures and algorithms that work at compile-time for fun. Currently, the repository contains the following:
- Bubble sort
- Factorial
- Fibonacci
- For loop - templated and constexpr based; (refer for compile-time if-else)
- GCD
- Insertion sort
- Detecting odd number of template arguments - can be extended to any such condition
- Selection sort