UTL

Collection of self-contained header-only libraries for C++17

View on GitHub

Selecting only specific UTL modules

<- back to README.md

Specific modules can be selected to restrict accessible functionality and reduce the amount of included standard headers.

This is achievable by declaring #define UTL_PICK_MODULES and #define <module_identifier> for all necessary modules before including the library header, see examples.

Module Identifiers

Name Identifier
utl::json UTLMODULE_JSON
utl::math UTLMODULE_MATH
utl::mvl UTLMODULE_MVL
utl::predef UTLMODULE_PREDEF
utl::profiler UTLMODULE_PROFILER
utl::progressbar UTLMODULE_PROGRESSBAR
utl::random UTLMODULE_RANDOM
utl::shell UTLMODULE_SHELL
utl::sleep UTLMODULE_SLEEP
utl::stre UTLMODULE_STRE
utl::table UTLMODULE_TABLE
utl::timer UTLMODULE_TIMER
utl::voidstream UTLMODULE_VOIDSTREAM

Examples

Selecting specific modules

[ Run this code ]

// Indicate that you want to select specific modules
#define UTL_PICK_MODULES

// List modules that should be compiled
#define UTLMODULE_MATH
#define UTLMODULE_PROGRESSBAR

#include "UTL.hpp"


int main() {
    // < your code here >
}

Selecting modules in different locations

[ Run this code ]

// Pick some modules in one header
#define UTL_PICK_MODULES
#define UTLMODULE_JSON
#include "UTL.hpp"

// ...

// Pick some more modules in another header
#define UTL_PICK_MODULES
#define UTLMODULE_RANDOM
#define UTLMODULE_LOG
#include "UTL.hpp"

// ...

// Translation unit that includes both headers in any order will
// have access to utl::json, utl::random and utl::log


// This allows one to pull only necessary modules in each header.
// Essentially, as long as UTL_PICK_MODULES is defined, "UTL.hpp"
// acts as a collection of individual module headers concatenated
// into a single file and enabled with #define UTLMODULE_{NAME}
//
// Alternatively, just grab individual modules directly from the repo.


int main() {
    // < your code here >
}

Including modules directly

Individual modules can also be grabbed directly from include/UTL/. In this case they can be included directly and no other action is needed.