A collection of Modern C++ (C++17/C++20) header-only utility snippets and abstractions.
All components are encapsulated within the gh4ck3r namespace (and its sub-namespaces).
- Data Structures & Containers
- String & Formatting Utilities
- System & Process Management
- Functional & Metaprogramming
- Cryptography
Intrusive doubly-linked list implementation inspired by the Linux kernel list_head, adapted for Modern C++ with STL-compatible iterators and range views.
A wrapper for lazy evaluation that defers value fetching until first demanded via GETTER(). Once populated, the value is cached and the getter function is discarded.
SharedSingleton<T>: Ref-counted singleton managed viastd::shared_ptr<T>. InstantiatesTon first use and automatically destructs when all references are released. Subsequent accesses recreate the instance as needed. Thread-safe instance locking.StaticSingleton<T>: Meyer's static singleton wrapper enforcing non-copyable, non-movable semantics forT.
Splits a std::string_view by a character delimiter with optional escape character support:
auto tokens = gh4ck3r::split<',', '\\'>("1\\,2,3"); // {"1\\,2", "3"}Formats binary buffers into human-readable hexadecimal string representation. Accepts raw pointer + length, iterator ranges, or standard containers.
Compile-time (constexpr) concatenation utilities for string views and arrays:
concat<sv1, sv2, ...>(): Concatenates staticstd::string_viewliterals at compile time.concat(array1, array2, ...): Concatenatesstd::arrayinstances at compile time.
Base64 encoding and decoding functions supporting std::string, std::string_view, and byte buffers.
Process inspection and execution helpers for Linux:
ppidof(),nameof(),cmdof(),execof(),exists(): Query process information via/proc.- Process execution with I/O redirection, timeout handling, and exit status collection.
High-level file I/O operations including read_file(), write_file(), append_file(), and temporary file generation.
Indentation-aware std::ostream wrapper for structured logging. Supports indent() and unindent() controls alongside standard stream manipulators.
Generic RAII resource manager (Reaper<T, Cleaner>) for safe resource cleanup (file descriptors, FILE*, dynamic memory, custom handles).
Scope-bound execution guard (defer) that runs a lambda or callable upon leaving the current scope.
Function composition helper recipe(f1, f2, ...) returning a callable pipeline that forwards arguments through a series of functions sequentially. Supports move-only callables and perfect forwarding.
Extracts signature details (return type, argument types, arity) from callables, lambdas, function pointers, and member function pointers.
Hash generation and hash_combine utilities for custom structs, std::pair, std::tuple, and enum types for use with unordered STL containers.
Metaprogramming type traits such as is_complete_v<T> to inspect type completeness at compile time.
Compile-time type-to-type and key-to-type mapping system via typedef_t, declare_t, and at<KEY>. Supports mixed key types (integers, enums, etc.).
OpenSSL wrappers for cryptographic operations including SEED-CBC cipher encryption/decryption and OSSL_LIB_CTX management.