UTL

October 26, 2025 · View on GitHub

UTL

UTL is a collection of small self-contained libraries with a major aim towards usage simplicity. It was mostly created during my work in gamedev and mathematical research for the purpose of fast prototyping.

For the ease of integration, all libraries are distributed as individual headers, which can be found here.

The entire collection can also be downloaded as an amalgamated single-header.

CMake FetchContent() support is also provided.

Design goals

Implementation of this library sets following design goals:

  • Easy integration. Adding libraries to the project should be as simple as including their corresponding headers.
  • Concise syntax. Library usage should require minimal boilerplate on user side.
  • Platform agnostic. Implementation should be based around the C++ standard. Platform-specific features might be provided as optional addons.
  • Non-intrusive. Every library should reside in its own namespace, use its own macro prefix and not introduce any invasive identifiers.

Quality goals include:

  • Modern C++ style. Usage of modern C++ idioms is heavily preferred.
  • Usage examples. Documentation should include practical usage examples for all major methods.
  • Test & benchmark coverage. All modules should have appropriate unit test coverage, performance-focused implementations should be benchmarked against alternative approaches.
  • Easy to build. All headers, tests, benchmarks and examples should build under the strictest warning levels and with minimal tooling.

Modules & documentation

ModuleShort description
utl::assertionAssert macro with more diagnostic info
utl::bitBit-twiddling, enum bitflags
utl::enum_reflectEnum reflection
utl::integralSaturated math, safe integer casts, literals, rounding and etc.
utl::jsonJSON parsing, serializing & reflection
utl::logLogging library
utl::mathAdditional math functions
utl::mvlGeneralized matrix & vector containers
utl::parallelThread pool, async tasks, parallel for, parallel reductions and etc.
utl::predefDetection of architectures, compilers, platforms and etc.
utl::profilerCall graph & thread profiling
utl::progressbarProgress bars for CLI apps
utl::randomPRNGs & random number generation
utl::shellShell commands and temporary files
utl::sleepPrecise sleep implementations
utl::streEfficient implementations of common string utils
utl::strong_typeStrong typedefs & RAII wrappers
utl::struct_reflectStruct reflection
utl::tableExport ASCII, Markdown, LaTeX, Mathematica and CSV tables
utl::timeFloating-point time, timers, stopwatches, datetime

See also

Requirements

  • Requires C++17 support
  • Some headers require a compliant preprocessor flag (/Zc:preprocessor) when using MSVC, such headers specify it in the docs

Developer toolchain

While the library itself consists of isolated headers with no embedded dependencies, it was built and tested using a number of third-party tools and libraries, some of which are embedded in the repo.

ToolVersionUsed for
clang-formatv.14.0.0Automatic code formatting
clangdv.15.0.7Language server functionality
CMakev.3.2.11Build system, CTest testing facilities
GCCv.11.4.0ASan and UBSan test instrumentation
cppcheckv.2.7Static analysis
GitHub ActionslatestMulti-platform CI testing
MkDocslatestBuilding the website
MatplotliblatestData visualization
LibraryVersionLicenseUsed forEmbedded in repo
doctestv.2.4.11MITUnit testing
nanobenchv.4.3.11MITBenchmarking
nlohmann jsonv.3.11.3MITBenchmark comparison
PicoJSONv.1.3.0BSD-2Benchmark comparison
RapidJSONv.1.1.0MIT, BSD, JSONBenchmark comparison
JSONTestSuitecommit 1ef36faMITJSON Validation test suite
BS::thread_poolv.5.0.0MITBenchmark comparison
progschj/ThreadPoolcommit 9a42ec1zlibBenchmark comparison

Roadmap

  • Create packages for Conan and vcpkg
  • Possibly provide PCH targets for internal and external use
  • Set up better test coverage statistics
  • utl::mvl v1.0.0 release, involves a large scale refactor and several bug fixes
  • utl::random v3.0.0 release, includes CBPRNGs and fixed-entropy seeding sequence

License

This project is licensed under the MIT License - see the LICENSE.md for details.