Commit graph

6 commits

Author SHA1 Message Date
James R
ff838a08a5 cxxutil.hpp: fix std::hash include 2023-03-06 04:45:46 -08:00
Eidolon
d855d96a10 hwr2: Add hardware 2D rendering 2023-02-26 18:47:42 -06:00
Eidolon
f43de07fd1 cxx: clang-format adjustments 2023-01-09 20:02:19 -06:00
Eidolon
1b859f5073 cxx: Add srb2::Overload for using std::visit 2023-01-09 13:05:35 -06:00
Eidolon
6af003771d Add SRB2_ASSERT, srb2::NotNull<T>
Add SRB2_ASSERT, superceding I_Assert

This assertion macro always expands to a call of srb2::do_assert, which
is overloaded with two templates: one which applies if the provided
Level is less than or equal to the SRB2_ASSERTION_LEVEL, and one which
is a no-op. When optimizations are enabled, this will verifiably remove
the evaluation of the expression in all cases, instead of evaluating the
expression and doing nothing with it.

Add srb2::NotNull wrapper utility

This is meant to be used in places where pointers are used as
parameters. It can be used with any pointer-like type, not just raw
pointers. During construction of NotNull, the pointer will be asserted
not-null in debug and paranoia builds, and in release optimizations with
no assertions, the code decays gracefully to standard pointer-passing.
2022-12-30 23:49:29 -06:00
Eidolon
51e0bed20a c++: add finally RAII utility
This mirrors the `finally` utility in Guidelines Support Library for
ensuring that a cleanup function is always called when the utility
object leaves scope, even when unwinding the stack from an exception.
This is to aid in transitioning malloc/free pairs in function bodies to
be more exception-safe.
2022-12-12 16:40:56 -06:00