A collection of useful C++ routines.
Go to file
2020-04-21 17:15:58 +10:00
algo algo/search: add balanced scan 2020-02-27 07:59:22 +11:00
alloc alloc/easy: add move initialisation for array allocations 2020-03-18 14:18:27 +11:00
array array: add md stubs 2020-03-16 14:14:16 +11:00
buffer scoped: rename disabling methods for consistency 2019-08-12 12:58:44 +10:00
coord coord/traits: expand value_trait to support scalars 2020-03-16 14:13:02 +11:00
cpuid cpuid/x86: print the AVX feature 2020-04-21 17:15:58 +10:00
debug debug/crash;win32: avoid an unused symbol warning 2019-10-31 13:59:38 +11:00
encode debug: split debug headers into components 2019-05-17 12:26:08 +10:00
fixup/experimental build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
geom goem/segment: indices should be const 2020-02-27 11:50:24 +11:00
hash debug: split debug headers into components 2019-05-17 12:26:08 +10:00
iterator iterator/zip: avoid std::forward_as_tuple for zip value_type 2020-02-26 12:04:02 +11:00
job job/dispatch: explicitly specify the dispatchable region 2020-03-12 12:45:45 +11:00
list list/node: use the data query for value comparison 2019-09-12 13:34:44 +10:00
log log/sink: simply and rename the ostream sink as path 2020-04-21 12:42:05 +10:00
map map/fixed: add a find function, and use it internally 2019-06-04 17:42:59 +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/value: style 2020-01-28 14:13:03 +11:00
posix posix/fd: add an ftruncate wrapper 2020-01-21 13:03:49 +11:00
rand rdrand: silence a type conversion warning under clang 2019-07-29 11:20:09 +10:00
roots rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
test job/dispatch: explicitly specify the dispatchable region 2020-03-12 12:45:45 +11:00
thread thread/win32: add sleep_until implementation 2019-08-20 10:48:18 +10:00
time debug: split debug headers into components 2019-05-17 12:26:08 +10:00
tools tools: use relative header paths 2020-01-01 06:55:11 +11:00
tuple tuple/value: map should return return a forwarding tuple 2020-02-25 12:02:53 +11:00
types types/tagged: add 'visit' call 2020-04-01 14:52:32 +11: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 adapter: add the 'identity' adapter 2019-08-06 14:31:48 +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 rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
bezier3.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +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 popcount overloads for short and char 2019-09-11 07:41:09 +10:00
cast.hpp cast: prefer concepts to SFINAE 2020-03-16 14:12:33 +11:00
CMakeLists.txt log/sink: simply and rename the ostream sink as path 2020-04-21 12:42:05 +10:00
cmdopt.cpp cmdopt: add simple requires constraint callbacks 2020-01-17 07:58:23 +11:00
cmdopt.hpp cmdopt: add simple requires constraint callbacks 2020-01-17 07:58:23 +11:00
colour.cpp parse: move si and value parsing into common namespace 2019-03-19 12:38:22 +11:00
colour.hpp colour: add srgba1 and srgba1f convenience typedefs 2020-03-12 12:44:20 +11: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 view: remove implicit equality for strings 2020-02-17 14:29:09 +11: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 endian: use three-way comparison for endian types 2020-03-21 13:17:18 +11: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 debug: split debug headers into components 2019-05-17 12:26:08 +10:00
extent.hpp extent: use matching types for random calls 2019-04-11 11:48:34 +10:00
fixed_string.hpp fixed_string: add a compile type string suitable for template params 2019-12-03 09:33:39 +11:00
fixed.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
fixed.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
float.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
float.hpp build: many compilation fixes for win32 2019-01-04 17:13:21 +11: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: add a variadic mix operator 2019-05-12 07:52:39 +10:00
introspection.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
introspection.hpp introspection: return the template parameters of a type 2020-02-27 07:59:55 +11: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: prefer brace value initialisation for almost_equal<int> 2020-04-06 13:12:52 +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 debug: split debug headers into components 2019-05-17 12:26:08 +10:00
matrix.hpp matrix: ensure the required coord headers are included for our ostream 2019-11-04 16:49:24 +11: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 rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
pointer.hpp build: many compilation fixes for win32 2019-01-04 17:13:21 +11: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 pool: assert that the pointer for 'index' is within our allocation 2019-08-14 13:53:06 +10:00
preprocessor.py preprocessor: add the empty, defer, obstruct, and expand macros 2019-08-02 13:41:05 +10:00
quaternion.cpp style 2020-03-30 12:29:24 +11: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 build: don't fully qualify the installation path 2019-06-18 15:12:49 +10:00
range.cpp range: add definition for range-scalar addition 2019-05-29 12:58:46 +10:00
range.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +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 log/sink: simply and rename the ostream sink as path 2020-04-21 12:42:05 +10:00
region.cpp region: correct the 'closest' query calculation 2019-09-26 08:08:06 +10:00
region.hpp region: support default construction of step iterator 2020-03-16 14:13:25 +11:00
registrar.cpp registrar: add skeleton of plugin registry 2019-04-16 11:02:26 +10:00
registrar.hpp log: modularise the logging infrastructure 2019-10-10 15:52:37 +11: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 nocopy: remove deprecated header 2019-05-17 13:44:14 +10:00
singleton.hpp singleton: rename valid as is_valid 2020-02-05 15:16:55 +11: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 rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
string.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
string.hpp string: add string_view overload to to_upper 2020-04-01 13:02:28 +11: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: pretend to be an enum for introspection purposes 2019-08-29 14:05:18 +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: add minimal thread primitives for win32 2019-06-22 15:46:34 +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 type tagged namespacing to queries 2019-09-04 08:06:46 +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 uri: constructors should be implicit for ease of use 2020-01-02 11:20:59 +11: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: prefer allocator_traits over allocator for pointer 2020-02-17 14:30:30 +11: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-5.x, >=gcc7.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.

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