Awesome
putils
Phisko's C++ Utilities
Reflection
A simple, stand-alone, header-only and easily pluggable reflection system.
This does not allow you to introspect any type provided by any library. It simply provides an API that you can implement in your own classes so that you can introspect them.
Good examples can be found in the imgui_helper and json_helper utilities.
Another example is the register_type function provided for lua, that inspects a type and registers all its attributes and methods to a lua state.
Utility classes
- color & normalized_color: helper classes to manipulate colors
- ini_file:
.ini
file parser - observable: A minimalistic (but greatly sufficient) implementation of the observer pattern.
- point: Simple abstraction to a 2D or 3D point.
- rect: Simple abstraction to a 2D or 3D rectangle.
- raii: A class template able to perform RAII on any type.
- spin_lock: Spin lock implementation, "sleep-free" alternative to mutexes.
- timer: Simple timer based on std::chrono.
Standard library replacements
- string: fixed-size drop-in replacement for
std::string
- vector: fixed-size drop-in replacement for
std::vector
- function: fixed-size drop-in replacement for
std::function
Packages
- Lua (enabled with the
PUTILS_LUA
CMake option) - Python (enabled with the
PUTILS_PYTHON
CMake option) - Meta
- plugin_manager (enabled with the
PUTILS_PLUGIN_MANAGER
CMake option) - Reflection
- fmt: formatters and concepts for fmt
- scn: scanners and concepts for scn
Function-only headers
- angle: helper functions when manipulating angles
- anonymous_variable: macro to define an anonymous variable
- casts: static and dynamic casts for std::unique_ptr
- chop: function removing any initial or trailing whitespace, as well as surrounding quotes, from a string
- clamp: function that clamps a value between two bounds
- command_line_arguments: function that parses command-line arguments into a struct
- concatenate: function taking any number of parameters and concatenating them into a string
- curl: function that runs a
curl
request over CLI (to avoid having to install curl packages. This is NOT the optimal way to do an HTTP request) - default_constructors: macros to avoid redundant declarations of default constructors
- epsilon: approximate comparison of floating point types
- forward_to: helper macros to forward arguments to an object
- get_call_stack: function which returns a formatted call-stack
- get_last_error_as_string: function for Windows
- hash: pre-defined hashers for enums and pairs
- lengthof: template function returning the length of an array
- macro_as_string: returns the value of a macro as a string
- magica_voxel: structure declarations for the magica_voxel format
- magica_voxel_to_polyvox_loader: conversion functions to parse the magica_voxel format into PolyVox objects
- on_scope_exit: returns an object that calls a function in its dtor
- parse: uses a
std::stringstream
to parse an object - profiling.hpp: macros wrapping Tracy
- rand: function using C++ 11's random number generation facilities
- range: macro return the
begin
andend
iterators of a container - read_stream: function which extracts an entire std::istream to a std::string
- regex: utilities to easily construct and match regexes through literal operators
- same_sign: function indicating whether two scalars have the same sign
- thread_name: sets or gets the OS-level name for the current thread
- scoped_setter: sets the value of a variable for the duration of the current scope
- sign: function returning -1, 0 or 1 depending on the sign of the parameter
- split: split a string according to a delimiter
- static_assert: type template to let
static_assert
fail for a specific type - url: URL encoder and decoder
- visit:
overloaded
type letting you pass multiple lambdas tostd::visit
- with:
with
macro mimicking the Kotlin construct