utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
Getting Started

This tutorial walks you from an empty project to using the Utility library. It assumes you have already built the library.

1. Build the library

cmake -S . -B build -DBUILD_TESTING=ON
cmake --build build
ctest --test-dir build --output-on-failure

2. Use a math type

Utility provides vectors, matrices, and quaternions under utility::math:

#include <utility/math/vector.hpp>
utility::math::Vector3F a(1.0f, 2.0f, 3.0f);
utility::math::Vector3F b(4.0f, 5.0f, 6.0f);
auto sum = a + b;
auto dot = utility::math::dot(a, b);
3D vector class inheriting from glm::vec3.
Definition vector.hpp:83

3. Use a cache

utility::Cache provides a thread-safe key-value store:

#include <utility/cache.hpp>
cache.put("answer", 42);
auto value = cache.get("answer"); // std::optional<int>
A thread-safe cache for storing key-value pairs.
Definition cache.hpp:69
std::optional< Entry > get(const Key &key) const
Retrieve the value associated with a specific key.
Definition cache.hpp:126
void put(const Key &key, const Entry &value)
Add or update a key-value pair in the cache.
Definition cache.hpp:141

4. Consume as a dependency

Once installed, link against utility::utility:

find_package(utility CONFIG REQUIRED)
target_link_libraries(my_app PRIVATE utility::utility)

Next steps