BidirectionalMap
- Two-way key-value mappingBTree
- Balanced tree for large sorted datasets with efficient range queries and low memory accessDependencyGraph
- Dependency graph for managing dependencies between objectsMeshNetwork
- Graph of shared objects without hierarchySize
- Semantic wrapper aroundstd::size_t
for representing 2D (Size2
: width/height) and 3D (Size3
: width/height/depth) sizesStack
- Type-specific stack without predefined type list (unlikeTypedStack
)Tree
- Hierarchical node structure with parent-child linksTypedStack
- Multi-type stack with exact object size layout, suitable for argument passing and VM stacksVec2
/Vec3
- 2D/3D math vectors with operators and common functions
EventSystem
- Event system to subscribe functions and trigger actions by event namePlanner
- Simple scheduler to run delayed functions on separate threads
Watcher
- File modification watcher
LambdaCalculus
- Compile-time utilities for lambda calculus manipulation
- Tools to create parsers and compilers (CSS, INI, HTML, JSON, Markdown, XML) (work in progress
)
CLikeCompiler
- Compiler for C-inspired languageTreeParser
- Tree parser (work in progress)
VirtualMachine
- Generic virtual machine
Logger
- Formattable logger with customizable log types and appearancesLogRotate
- Log file rotation based on maximum file sizeChronoLogger
- RAII timer that logs elapsed time at scope exit
Hash
- Hashing utilities for strings
Client
- TCP client with synchronous and asynchronous modesServer
- TCP server with multi-client support
Canvas
- Terminal-based 2D drawing surfaceCursor
- Terminal cursor manipulationProgressBar
- Dynamically updating terminal progress barRawTerminal
- Raw input handling (no buffering or echo)Size
- Terminal size utilitiesTextColor
- Terminal text color utilitiesTextModifier
- Utilities to style and color terminal textTitle
- Terminal title utilities
Event
- An event for thread synchronizationThreadLoop
- Thread loop with exception handlingThreadPool
- Fixed-size thread pool for parallel task executionTryAsync
- Launches a function asynchronously, forwards exception to callerUniqueLocker
- RAII wrapper holding a value with exclusive accessSharedLocker
- RAII wrapper holding a value with shared/exclusive accessAccessor
- RAII accessor for reading/writing anUniqueLocker
or exclusive access to aSharedLocker
ReadOnlyAccessor
- RAII accessor for shared (non-exclusive) reading of aSharedLocker
, allowing parallel accessMultipleAccessor
- RAII accessor for multiple lockers, safely acquiring them to avoid deadlocks and data races
Concept
- Extensions to<type_traits>
and<concepts>
providing additional compile-time checks and utilitiesEnum
- Generic enum-to-string conversionMapping
- Static reflection on members (pre-C++26)Tuple
- Visitor forstd::tuple
VariadicTemplate
- Metaprogramming on variadic parametersVariant
- Generic print and comparison operators forstd::variant
DummyObject
- Dummy object that prints construction, destruction, copy and move operations, while counting copies and moves for test verificationUnitTest
- Minimal test framework with assertions and filters
- Many other functions
This library is used in my C++ projects, but you can also use it in your projects. Just follow the installation steps and consult the documentation for each feature you need.
- A C++26 compliant compiler with std module support
- XMake
In your XMake projects:
add_repositories("xmake-repo [email protected]:MorganCaron/xmake-repo.git")
add_requires("CppUtils")
target("YourProject", function()
add_packages("CppUtils", {public = true})
end)
xmake f [--toolchain=llvm] --runtimes="c++_shared" [--sdk=/opt/llvm-git] --menu
xmake f [--toolchain=llvm] --runtimes="c++_shared" [--sdk=/opt/llvm-git] [-y|--yes] [--enable_tests=y] [--sanitize_memory=y] [--sanitize_thread=y]
xmake [b|build] [-vD]
xmake [r|run] [-d|--debug]
xmake watch -r [-d|--debug]