dot-xx
A personal collection of small C++ modules
Loading...
Searching...
No Matches
dxx.assert Module Reference

Provides and assert function and its debug-only counterpart. Uses <stacktrace> to display stack trace on failure if possible. More...

Classes

struct  dxx::assert::failure
 A default error type that is thrown when the assertion fails. More...

Functions

template<std::constructible_from< std::string > Failure = failure>
void dxx::assert::always (bool condition, std::source_location st=std::source_location::current())
 Check if the condition is true and throw Failure if it's not.
template<std::constructible_from< std::string > Failure = failure>
void dxx::assert::debug (bool condition, std::source_location st=std::source_location::current())
 Same as assert but only performs the check if the library is built in Debug mode.

Detailed Description

Provides and assert function and its debug-only counterpart. Uses <stacktrace> to display stack trace on failure if possible.

Exports two functions:

Both functions throw dxx::assert::failure (or a user-provided exception type) if the assertion fails.

Files

file  /build-llvm-libcpp/_deps/dot-xx-assert-src/src/assert.xx
 Main and only file of the dxx.assert module.