A collection of useful C++ routines.
Go to file
2020-11-25 14:21:20 +10:00
algo sort: use a comparator object for index sort 2020-10-15 09:40:01 +10:00
alloc alloc/easy: add move initialisation for array allocations 2020-03-18 14:18:27 +11:00
array assert: split CHECK_LIMIT into INCLUSIVE and INDEX 2020-09-24 08:03:41 +10:00
buffer assert: split CHECK_LIMIT into INCLUSIVE and INDEX 2020-09-24 08:03:41 +10:00
concepts concepts: add initial clock concept 2020-09-30 15:14:26 +10:00
coord types/sized: update bits types to follow a more current style 2020-10-22 11:27:25 +10:00
cpuid cpuid/x86: print the AVX feature 2020-04-21 17:15:58 +10:00
debug debug: add is_interactive_console query 2020-10-20 07:01:54 +10:00
encode Header cleanup using include-what-you-use 2020-07-01 17:02:44 +10:00
fixup/experimental build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
geom g/sample: remember to forward generator objects in extent sampler 2020-11-06 12:27:55 +10:00
hash hash: add halfsipmix 2020-11-03 11:45:21 +10:00
introspection introspection: split the header into functional groups 2020-09-24 15:42:14 +10:00
iterator iterator/infix: avoid using references to temporaries in make_infix 2020-11-10 16:22:46 +10:00
job thread: remove thread, mutex, and condition_variable wrappers 2020-08-03 11:21:29 +10:00
list list/node: use the data query for value comparison 2019-09-12 13:34:44 +10:00
log log: make once_flag constinit 2020-08-03 11:48:48 +10:00
map Header cleanup using include-what-you-use 2020-07-01 17:02:44 +10:00
maths debug: split debug headers into components 2019-05-17 12:26:08 +10:00
memory build: update the meson build configuration 2019-06-19 17:28:01 +10:00
parallel parallel/stack: add clone method 2019-08-02 08:13:39 +10:00
parse parse: cookies should be maybe_unused 2020-10-14 12:21:49 +10:00
posix posix/fd: add an ftruncate wrapper 2020-01-21 13:03:49 +11:00
rand rand/dist/uniform: avoid sign comparison warning in assertion 2020-11-12 13:08:11 +10:00
roots rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
set set/dset: prefer view overloads over span overloads 2020-11-10 15:29:24 +10:00
test hash: add halfsipmix 2020-11-03 11:45:21 +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 rand: prefer our own generators 2020-08-18 07:20:26 +10:00
tuple tuple/value: don't use forwarding constructor for map 2020-09-07 16:44:04 +10:00
types types/sized: update bits types to follow a more current style 2020-10-22 11:27:25 +10:00
win32 windows: undef RELATIVE and ABSOLUTE 2019-11-18 16:44:13 +11: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
abnf.rl uri: extract grammar into contained ragel file 2017-12-20 12:45:05 +11:00
adapter.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
adapter.hpp Header cleanup using include-what-you-use 2020-07-01 17:02:44 +10:00
annotation.hpp build: add doxygen comments for various headers 2019-01-03 11:15:00 +11:00
ascii.hpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
backtrace_execinfo.cpp backtrace: give consistent outputs for backtrace 2019-07-02 16:39:40 +10:00
backtrace_null.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
backtrace_stackwalk.cpp backtrace: give consistent outputs for backtrace 2019-07-02 16:39:40 +10:00
backtrace_win32.cpp debug/crash: temporarily disable backtrace reporting 2019-10-21 16:33:51 +11:00
backtrace.hpp backtrace: give consistent outputs for backtrace 2019-07-02 16:39:40 +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 assert: split CHECK_LIMIT into INCLUSIVE and INDEX 2020-09-24 08:03:41 +10:00
bezier.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
bezier.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
bitwise.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
bitwise.hpp bitwise: add word halving query 2020-11-03 15:32:47 +10:00
cast.hpp cast: add an approximate implementation of std::bit_cast 2020-10-27 15:30:40 +10:00
CMakeLists.txt rand: add uniform distribution routines 2020-11-12 11:07:53 +10:00
cmdopt.cpp cmdopt: add simple requires constraint callbacks 2020-01-17 07:58:23 +11:00
cmdopt.hpp introspection: split the header into functional groups 2020-09-24 15:42:14 +10:00
colour.cpp parse: move si and value parsing into common namespace 2019-03-19 12:38:22 +11:00
colour.hpp Header cleanup using include-what-you-use 2020-07-01 17:02:44 +10:00
concepts.hpp concepts: add "supports_indexing" 2020-03-16 14:12:04 +11:00
container.hpp container: add free 'contains' query 2020-01-16 11:58:52 +11:00
coord.hpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
COPYING relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
cpp.cpp Header cleanup using include-what-you-use 2020-07-01 17:02:44 +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 debug;posix: prefer SIGINT for breakpoint 2019-07-02 17:36:09 +10:00
debug_win32.cpp win32: fix the paths to debug headers 2019-06-06 13:28:16 +10:00
Doxyfile.in Doxyfile: Use CMake variables in preference to autotools variables 2019-01-03 11:15:00 +11:00
endian.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
endian.hpp types/sized: update bits types to follow a more current style 2020-10-22 11:27:25 +10:00
except.cpp except: add custom base exception 2018-12-03 15:29:21 +11:00
except.hpp except: error::describe shouldn't be noexcept 2019-02-02 15:35:44 +11: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
exe.hpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
expected.hpp expected: add a trivial move constructor 2019-03-19 17:08:35 +11: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_string.hpp fixed_string: use pointers for copy to storage 2020-11-18 06:50:17 +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
float.cpp types/sized: update bits types to follow a more current style 2020-10-22 11:27:25 +10:00
float.hpp types/sized: update bits types to follow a more current style 2020-10-22 11:27:25 +10:00
format.cpp.rl rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
format.hpp format: support string_view as a string 2019-04-16 10:18:10 +10:00
fourcc.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
fourcc.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
functor.hpp functor: style 2020-02-25 16:15:21 +11:00
gcc.hpp relicense under MPL-2.0 2018-08-04 15:14:06 +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: add runtime initialisation cookie 2020-04-23 08:06:14 +10:00
init.hpp init: add runtime initialisation cookie 2020-04-23 08:06:14 +10:00
io_posix.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
io_posix.hpp io;posix: implement move constructor for mapped_file 2019-01-17 19:49:45 +11:00
io_win32.cpp win32: fix the paths to debug headers 2019-06-06 13:28:16 +10:00
io_win32.hpp io_win32: add move operators to mapped_file 2019-03-27 19:08:55 +11:00
io.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
io.hpp io: add iterative file reading helper 2019-06-19 12:01:26 +10: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_posix.cpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
library_posix.hpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
library_win32.cpp build: many compilation fixes for win32 2019-01-04 17:13:21 +11:00
library_win32.hpp thread: add minimal thread primitives for win32 2019-06-22 15:46:34 +10:00
library.hpp relicense under MPL-2.0 2018-08-04 15:14:06 +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 unary 'max' 2020-10-20 15:34:27 +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
matrix.cpp assert: split CHECK_LIMIT into INCLUSIVE and INDEX 2020-09-24 08:03:41 +10:00
matrix.hpp matrix: add rotation_euler conversion 2020-07-24 13:44:32 +10:00
meson_options.txt build: update the meson build configuration 2019-06-19 17:28:01 +10:00
meson.build meson: add a declared dependency 2019-06-22 08:19:42 +10:00
paths_posix.cpp paths: add a better error message for posix expansion 2020-04-21 11:40:30 +10:00
paths_win32.cpp paths: add expand query for paths 2020-04-21 11:01:03 +10:00
paths.hpp paths: add expand query for paths 2020-04-21 11:01:03 +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 pointer: add thin pointer wrapper 2020-11-25 14:21:20 +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 assert: split CHECK_LIMIT into INCLUSIVE and INDEX 2020-09-24 08:03:41 +10:00
preprocessor.py preprocessor: add the empty, defer, obstruct, and expand macros 2019-08-02 13:41:05 +10:00
quaternion.cpp quaternion: style 2020-08-21 09:34:01 +10:00
quaternion.hpp quaternion: add a subtraction operator 2020-02-18 12:17:06 +11:00
random.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
random.hpp random: prefer internal uniform distributions 2020-11-12 11:08:11 +10:00
range.cpp range: correct the ostream operator template variable refs 2020-11-23 12:01:01 +10:00
range.hpp range: correct the ostream operator template variable refs 2020-11-23 12:01:01 +10:00
rational.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
rational.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
README.adoc thread: remove thread, mutex, and condition_variable wrappers 2020-08-03 11:21:29 +10:00
region.cpp assert: split CHECK_LIMIT into INCLUSIVE and INDEX 2020-09-24 08:03:41 +10:00
region.hpp region: move rotate90 out of the header 2020-08-21 11:34:52 +10:00
registrar.cpp registrar: add skeleton of plugin registry 2019-04-16 11:02:26 +10:00
registrar.hpp introspection: split the header into functional groups 2020-09-24 15:42:14 +10:00
rfc3986.rl rfc3986: don't enforce actions for rules 2017-12-26 17:34:08 +11:00
scoped.hpp scoped: rename disabling methods for consistency 2019-08-12 12:58:44 +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 rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
stats.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +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 Header cleanup using include-what-you-use 2020-07-01 17:02:44 +10:00
string.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
string.hpp string: fancy comparators should take only string_views 2020-10-21 10:23:04 +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: use string_view for accessors 2018-09-18 16:36:03 +10:00
stringid.hpp stringid: add at method 2018-09-18 16:36:28 +10:00
strongdef.cpp strongdef: don't expose the raw data directly 2019-03-20 15:39:24 +11:00
strongdef.hpp strongdef: add is_strongdef type_trait 2020-09-11 13:36:04 +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
sysinfo.hpp sysinfo: add a trivial system stats dump function 2019-06-20 12:37:48 +10:00
tap.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
tap.hpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
term.cpp build: fix range-loop-analysis warnings 2020-02-17 17:40:03 +11:00
term.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +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
time.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
time.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
typeidx.cpp typeidx: add type tagged namespacing to queries 2019-09-04 08:06:46 +10:00
typeidx.hpp typeidx: add variant query 2020-08-12 10:18:23 +10:00
types.hpp types: add the convert trait 2020-02-07 10:15:43 +11:00
uri.cpp.rl debug: split debug headers into components 2019-05-17 12:26:08 +10:00
uri.hpp assert: split CHECK_LIMIT into INCLUSIVE and INDEX 2020-09-24 08:03:41 +10:00
utf8.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +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: split debug headers into components 2019-05-17 12:26:08 +10:00
version.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
view.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
view.hpp view: add an iterator typedef 2020-10-19 17:38:10 +10:00
zlib.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
zlib.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00

== 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.