Skip to content

DmitriBogdanov/UTL

Repository files navigation

UTL

UTL is a collection of small self-contained libraries that aim to provide a set of concise utilities aimed at prototyping with minimal boilerplate. Most of the modules were created during my work in gamedev and math research projects.

For the ease of integration, this library is distributed in a form of a single header, which can be found here.

All modules can also be downloaded individually.

Design goals

Implementation of this library sets following design goals:

  • Header only. Adding library to the project should be as simple as adding a header.
  • Concise. Methods must require minimal boilerplate on user side.
  • Platform agnostic. Implementation should be based around C++ standard and whenever OS-specific methods are unavoidable select appropriate implementation automatically.
  • Fully modular. Every module should be independent of others and reside in a separate namespace. Modules together with their STL dependencies should be toggleable through a #define.

Secondary design goals also include:

  • Modern C++ style. Usage of modern C++ idioms is preferred.
  • Usage examples. Documentation should include 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.

Modules & documentation

Module Short description
utl::enum_reflect Enum reflection
utl::json JSON parsing and serializing
utl::log Logging library
utl::math Math-related utilities
utl::mvl Flexible API for vector and matrix operations
utl::parallel Thread pool, async tasks, parallel for, parallel reductions and etc.
utl::predef Detection of architectures, compilers, platforms and etc.
utl::profiler Scope & expression profiling macros
utl::progressbar Progress bars for CLI apps
utl::random PRNGs & random number generation
utl::shell Shell commands and temporary files
utl::sleep Precise sleep implementations
utl::stre Efficient implementations of common string utils
utl::struct_reflect Struct reflection
utl::table ASCII table rendering tools
utl::timer Timing methods

See also

Requirements

  • Requires C++17 support
  • Some modules require POSIX-compliant system (Linux) or Windows

Third-party tools & libraries

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

Tool Version Used for
clang-format v.14.0.0 Automatic code formatting
clangd v.15.0.7 Language server functionality
CMake v.3.2.11 Build and test automation
valgrind v.3.18.1 Memory leak detection
Library Version License Used for Embedded in repo
doctest v.2.4.11 MIT Unit testing
nanobench v.4.3.11 MIT Benchmarking
nlohmann json v.3.11.3 MIT Benchmark comparison
PicoJSON v.1.3.0 BSD-2 Benchmark comparison
RapidJSON v.1.1.0 MIT, BSD, JSON Benchmark comparison
JSONTestSuite commit 1ef36fa MIT JSON Validation test suite

Work in progress

  • Deprecation/refactoring of following modules: utl::voidstream;
  • Small API improvements for utl::log;
  • Vector support for utl::mvl;
  • Matrix concat functions for utl::mvl;
  • Index span API for utl::mvl;
  • Binary operator refactors for utl::mvl;
  • Coordinate transformations in utl::math;
  • More type traits in utl::math;
  • Test coverage statistics.

License

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