A collection of useful C++ routines.
Go to file
Danny Robson ed4ad99851 fixed_string: add string_view operator 2024-03-04 11:45:59 +10:00
algo search::balanced should be constexpr 2021-04-07 12:52:24 +10:00
alloc alloc/malloc: remember to check memalign return value 2023-07-21 14:19:39 +10:00
array build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
buffer build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
cmdopt2 cmdopt2: add tribool support 2022-06-13 15:38:16 +10:00
concepts concepts: add the null_stringy concept 2022-06-20 09:31:29 +10:00
coord Add fmt::formatter specialisations for fmtlib-10 2023-07-21 14:20:49 +10:00
cpuid cpuid/x86: minor type formatting 2024-02-21 14:53:24 +10:00
debug debug/system: include missing header 2023-10-11 10:54:33 +10:00
encode build: address clang-tidy errors 2021-04-20 12:10:53 +10:00
format format: add 'quoted' helper function that emulates std::quoted 2023-07-21 14:19:18 +10:00
fs fs/tmp: make temp queries and path generator more robust 2024-02-21 14:54:53 +10:00
geom geom/ops: workaround ICE using `requires` for `distance` 2021-04-19 16:47:22 +10:00
hash hash/tuple: add is_transparent 2023-07-25 10:00:45 +10:00
introspection job/queue: ignore enum-constexpr-conversion for clang-16 2023-05-15 10:30:50 +10:00
iterator iterator/counting: allow copying of iterator 2023-07-13 06:45:47 +10:00
job job/queue: remove use of deprecated aligned_storage_t 2023-05-15 10:31:17 +10:00
list list/node: remove use of deprecated aligned_storage_t 2023-05-15 10:31:43 +10:00
log log: use format_string to pass format specifiers 2023-11-19 09:39:15 +10:00
map map/multi_fixed: add assignment operators 2021-03-09 12:14:17 +10:00
maths maths/fast: actually account for symmetries in `sin` 2021-05-13 17:01:30 +10:00
memory build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
parallel build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
parse build: add [[fallthrough]] attributes 2022-08-18 13:11:38 +10:00
posix posix/flock: disable this class if under Windows 2024-02-21 14:55:29 +10:00
rand build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
roots build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
serialise serialise: add a simple binary serialisation framework 2022-05-19 10:01:15 +10:00
set set/dset: add `insert` for symmetry with the STL 2021-02-05 12:03:41 +10:00
test log: use format_string to pass format specifiers 2023-11-19 09:39:15 +10:00
thread thread: remove thread, mutex, and condition_variable wrappers 2020-08-03 11:21:29 +10:00
time debug: split debug headers into components 2019-05-17 12:26:08 +10:00
tools tools/cpuid: add cache topology detection 2024-02-21 14:54:15 +10:00
tuple tuple/value: fix various compile time errors 2022-02-09 16:33:44 +10:00
types Use `std` versions of sized types 2023-05-15 10:33:23 +10:00
win32 build;win32: add missing includes 2021-05-18 06:57:45 +10:00
.gitignore build; remove unnecessary gitignore entries 2018-08-06 14:36:23 +10:00
.gitlab-ci.yml build;gitlab: set CMAKE_MODULE_PATH to our local cmake modules 2019-06-29 09:13:26 +10:00
.gitmodules build: don't include cmake modules in this repository 2018-07-24 16:16:53 +10:00
CMakeLists.txt fs/tmp: make temp queries and path generator more robust 2024-02-21 14:54:53 +10:00
COPYING relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
Doxyfile.in Doxyfile: Use CMake variables in preference to autotools variables 2019-01-03 11:15:00 +11:00
README.adoc thread: remove thread, mutex, and condition_variable wrappers 2020-08-03 11:21:29 +10:00
abnf.rl uri: extract grammar into contained ragel file 2017-12-20 12:45:05 +11:00
adapter.cpp adapter: add container transform adapter 2022-06-23 10:58:17 +10:00
adapter.hpp adapter: remove std::iterator due to deprecation 2022-07-25 11:57:29 +10:00
annotation.hpp build: add doxygen comments for various headers 2019-01-03 11:15:00 +11:00
ascii.hpp build: don't use a space in user string literals 2023-11-19 09:26:37 +10:00
backtrace.hpp Add fmt::formatter specialisations for fmtlib-10 2023-07-21 14:20:49 +10:00
backtrace_execinfo.cpp Add fmt::formatter specialisations for fmtlib-10 2023-07-21 14:20:49 +10:00
backtrace_null.cpp backtrace_null: correct the namespace 2022-06-23 07:28:26 +10:00
backtrace_stackwalk.cpp backtrace: use fmtlib formatters for output 2024-02-21 14:52:50 +10:00
backtrace_win32.cpp backtrace: use fmtlib formatters for output 2024-02-21 14:52:50 +10:00
bezier.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
bezier.hpp bezier: add convenience typedefs for various dimensions 2021-04-22 15:49:07 +10:00
bezier1.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
bezier2.cpp assert: split CHECK_LIMIT into INCLUSIVE and INDEX 2020-09-24 08:03:41 +10:00
bezier3.cpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
bitwise.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
bitwise.hpp build: use more explicit headers 2021-01-20 14:19:33 +10:00
bool.cpp bool: add tribool class 2022-06-13 12:47:37 +10:00
bool.hpp bool: avoid implicit casts to bool in tribool 2022-06-13 15:37:24 +10:00
cast.hpp cast: disable warnings for function casts in ffs 2023-11-19 09:27:12 +10:00
cmdopt.cpp cmdopt: add simple `requires` constraint callbacks 2020-01-17 07:58:23 +11:00
cmdopt.hpp introspection: rename enum as enum_manual 2022-04-01 13:45:39 +10:00
colour.cpp colour: add luminance scaling and XYZ/xyY/sRGB conversions 2021-05-12 13:26:52 +10:00
colour.hpp colour: add luminance scaling and XYZ/xyY/sRGB conversions 2021-05-12 13:26:52 +10:00
concepts.hpp concepts: split and remove C++20 re-implementations 2022-03-18 12:19:18 +10:00
container.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
coord.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
cpp.cpp cpp: fix trailing tokens with new tokeniser 2021-12-17 12:07:08 +10:00
cpp.hpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
cpuid.cpp cpuid: add initial trivial CPUID queries 2018-03-18 17:29:44 +11:00
cpuid.hpp cpuid: defend against unknown architectures 2019-06-20 11:44:43 +10:00
debug_posix.cpp Fix some format string specifier type errors in recent compilers 2021-11-07 06:12:34 +10:00
debug_win32.cpp format: remove in favour of libfmt 2021-04-14 10:23:33 +10:00
endian.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
endian.hpp endian: add fmt::formatter for `value` 2023-11-19 09:36:30 +10:00
except.cpp Add fmt::formatter specialisations for fmtlib-10 2023-07-21 14:20:49 +10:00
except.hpp Add fmt::formatter specialisations for fmtlib-10 2023-07-21 14:20:49 +10:00
exe.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
exe_freebsd.cpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
exe_linux.cpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
exe_win32.cpp build: many compilation fixes for win32 2019-01-04 17:13:21 +11:00
expected.hpp build: address clang-tidy errors 2021-04-20 12:10:53 +10:00
extent.cpp extent: add rotate90 2020-08-21 11:34:29 +10:00
extent.hpp extent: add rotate90 2020-08-21 11:34:29 +10:00
fixed.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
fixed.hpp types/sized: update bits types to follow a more current style 2020-10-22 11:27:25 +10:00
fixed_string.hpp fixed_string: add string_view operator 2024-03-04 11:45:59 +10:00
float.cpp types/sized: update bits types to follow a more current style 2020-10-22 11:27:25 +10:00
float.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
fourcc.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
fourcc.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
functor.hpp functor: style 2020-02-25 16:15:21 +11:00
fwd.hpp fwd: add a root set of forward decls 2022-03-22 12:41:25 +10:00
gcc.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
hash.hpp hash: ensure all values passed to `mix` are of the same type 2020-10-27 15:31:43 +10:00
init.cpp init: workaround a double free in cookie allocation 2021-04-09 13:28:49 +10:00
init.hpp init: add runtime initialisation cookie 2020-04-23 08:06:14 +10:00
io.cpp Add fmt::formatter specialisations for fmtlib-10 2023-07-21 14:20:49 +10:00
io.hpp io: add a trivial type reader for fds 2022-09-14 14:18:49 +10:00
io_posix.cpp io: add an `fallocate` wrapper 2020-11-28 08:39:40 +10:00
io_posix.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
io_win32.cpp build;win32: add missing includes 2021-05-18 06:57:45 +10:00
io_win32.hpp io_win32: add move operators to mapped_file 2019-03-27 19:08:55 +11:00
kmeans.hpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
libcruft.pc.in build: correctly install the pkg-config file 2019-06-18 11:26:59 +10:00
library.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
library_posix.cpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
library_posix.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
library_win32.cpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
library_win32.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
log.hpp log: prepare to expand headers 2019-10-10 15:10:41 +11:00
maths.cpp maths: document `log2` and `log2up` 2020-03-16 14:11:23 +11:00
maths.hpp maths: add `sum` helper for containers 2023-07-21 14:21:18 +10:00
matrix.cpp build: remove dead code 2021-04-14 14:17:18 +10:00
matrix.hpp matrix: remove iostream include from the header 2021-04-12 17:17:24 +10:00
matrix2.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
matrix3.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
matrix4.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
meson.build meson: add a declared dependency 2019-06-22 08:19:42 +10:00
meson_options.txt build: update the meson build configuration 2019-06-19 17:28:01 +10:00
paths.cpp paths: add system path queries 2022-01-19 11:24:15 +10:00
paths.hpp paths: add resolve_first 2022-05-20 11:34:27 +10:00
paths_posix.cpp paths: add system path queries 2022-01-19 11:24:15 +10:00
paths_win32.cpp fs/tmp: make temp queries and path generator more robust 2024-02-21 14:54:53 +10:00
platform.hpp build: many compilation fixes for win32 2019-01-04 17:13:21 +11:00
point.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
point.hpp Header cleanup using `include-what-you-use` 2020-07-01 17:02:44 +10:00
pointer.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
polynomial.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
polynomial.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
pool.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
pool.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
preprocessor.py preprocessor: add COUNT_MAP 2021-02-02 11:41:26 +10:00
quaternion.cpp debug/panic: use fmt for `unhandled` messages 2021-04-13 15:18:37 +10:00
quaternion.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
random.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
random.hpp random: add parameter free uniform for integral types 2022-05-10 12:48:52 +10:00
range.cpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
range.hpp range: correct the ostream operator template variable refs 2020-11-23 12:01:01 +10:00
rational.cpp debug/assert: don't use iostream 2021-04-12 16:56:06 +10:00
rational.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
region.cpp region: constructors should be constexpr 2021-06-01 13:14:51 +10:00
region.hpp region: constructors should be constexpr 2021-06-01 13:14:51 +10:00
registrar.cpp registrar: add skeleton of plugin registry 2019-04-16 11:02:26 +10:00
registrar.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
rfc3986.rl uri: allow out of spec chars 2022-02-23 07:26:57 +10:00
scoped.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
signal.cpp signal: reduce templating complexity 2019-03-13 12:08:57 +11:00
signal.hpp signal: simplify the implementation of the cookie and signal 2020-07-23 15:16:15 +10:00
singleton.hpp singleton: add "maybe" pointer accessor 2020-09-11 13:35:51 +10:00
stats.cpp Use `std` versions of sized types 2023-05-15 10:33:23 +10:00
stats.hpp Add fmt::formatter specialisations for fmtlib-10 2023-07-21 14:20:49 +10:00
std.hpp std: clarify header guarantees 2020-01-16 11:58:03 +11:00
stream.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
stream.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
string.cpp string: remove deprecated wstring to_uft8 convertors 2024-02-21 14:56:05 +10:00
string.hpp string: use static operator() for simple transform equality functors 2023-07-04 11:21:07 +10:00
stringcache.cpp stringcache: add a simple bulk string cache 2020-04-23 05:53:40 +10:00
stringcache.hpp stringcache: add a simple bulk string cache 2020-04-23 05:53:40 +10:00
stringid.cpp stringid: add the `key` query 2022-05-13 10:03:48 +10:00
stringid.hpp stringid: add the `key` query 2022-05-13 10:03:48 +10:00
strongdef.cpp strongdef: don't expose the raw data directly 2019-03-20 15:39:24 +11:00
strongdef.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
sysinfo.hpp sysinfo: add a trivial system stats dump function 2019-06-20 12:37:48 +10:00
sysinfo_posix.cpp sysinfo;posix: ensure strings are quoted 2019-06-20 14:42:38 +10:00
sysinfo_win32.cpp sysinfo;win32: don't print the username null terminator 2019-06-28 15:14:34 +10:00
tap.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
tap.hpp log: use format_string to pass format specifiers 2023-11-19 09:39:15 +10:00
term.cpp build: fix range-loop-analysis warnings 2020-02-17 17:40:03 +11:00
term.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
time.cpp Add fmt::formatter specialisations for fmtlib-10 2023-07-21 14:20:49 +10:00
time.hpp time: add wait/reset to period_limiter 2022-03-30 13:29:33 +10:00
time_posix.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
time_win32.cpp thread: remove thread, mutex, and condition_variable wrappers 2020-08-03 11:21:29 +10:00
typeidx.cpp typeidx: add name registration 2021-01-19 12:17:23 +10:00
typeidx.hpp typeidx: ensure fundamental types have a constexpr index 2021-03-25 12:02:14 +10:00
types.hpp types: add the `convert` trait 2020-02-07 10:15:43 +11:00
uri.cpp uri: add fmt::formatter for uri and component 2023-11-19 09:36:13 +10:00
uri.cpp.rl uri: silence some narrowing conversion warnings 2022-08-18 13:11:54 +10:00
uri.hpp uri: add fmt::formatter for uri and component 2023-11-19 09:36:13 +10:00
utf8.cpp build: don't use a space in user string literals 2023-11-19 09:26:37 +10:00
utf8.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
variadic.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
variadic.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
vector.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
vector.hpp coord: add to_radians for vector 2019-12-18 10:52:10 +11:00
version.cpp.rl debug/panic: use fmt for `unhandled` messages 2021-04-13 15:18:37 +10:00
version.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
view.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
view.hpp view: index operator should return auto 2023-05-15 10:32:13 +10:00
zlib.cpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
zlib.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00

README.adoc

== libcruft

A simple cross-platform C++ utility library.

Supported compilers: >=clang-10.x, >=gcc10.x; specifically, we require cxx17 features such as structured bindings which aren't present in older compilers. No attempt has been made to compile under MSVC.

MinGW must be compiled with PThreads support so that the std threading API is available.

=== Environment Variables

The following variables can be defined at runtime to change the library behaviour.

DEBUG:: whether to initialise basic debugging features at load time. the value is irrelevant; the test is for whether the variable is defined.
DEBUG_WAIT:: whether to wait for a debugger to attach before executing `main`.

LOG_LEVEL:: minimum log level that will render to the logging stream. note that a given level may have been compiled out and may not be present, eg. DEBUG tends to only be present for debug builds.
BREAK_LEVEL:: minimum log level that will trigger a breakpoint

CRUFT_LOG_SINK:: The output driver for logging. One of 'CONSOLE', 'PATH'.
CRUFT_LOG_PATH:: The output path for the 'PATH' logging driver. This path is subject to path expansion and will be interpreted as relative to the current working directory if it is relative.

JOB_THREADS:: default number of threads to spin up for job queues.
JOB_DEPTH:: the default size of the pending work item queue for a job queue.

Ideally one would not resort to using these variables, but they may make debugging a little easier in some circumstances.