Written with type-traits (structures, with specialization for types) with extentibility by custom types in mind.
Written for c++11, without such useful things like:
fold expression
- since c++17variable declaration
&if/switch/for
inconstexpr
functionsstd::index_sequence
- since c++14
For enabling in-place compile-time tests (useful during hacking) - add CT_ENABLE_TESTS
define.
This library is header-only (since most of the code is non-splitable template magic), so for usage in your codebase, simply add /include/
directory into include search path.
For example:
CMake
- References: How to properly add include directories with CMake, CMake::include_directories()- Add into
CMakeLists.txt
:set(THIS_LIB_INCLUDE_DIR <path/to/compiletime-utils/include/> ) target_include_directories( <YOUR_TARGET_NAME> PRIVATE ${THIS_LIB_INCLUDE_DIR})
- Add into
QMake
- Inproject_name.pro
file add next line:- Add all includes as part of the project:
include(<path/to/compiletime-utils/include>/ct.pri) include(<path/to/compiletime-utils/include>/rt.pri)
- Add all includes simply into search path:
INCLUDEPATH += <path/to/compiletime-utils/include/>
- Add all includes as part of the project:
gcc
/g++
single-file compilation:$ gcc -c -std=c++11 -O2 -I <path/to/compiletime-utils/include> -o <app_name> main.cpp