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

Main namespace for dxx::assert module. More...

Classes

struct  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

Main namespace for dxx::assert module.

Function Documentation

◆ always()

template<std::constructible_from< std::string > Failure = failure>
void dxx::assert::always ( bool condition,
std::source_location st = std::source_location::current() )
inlineexport

Check if the condition is true and throw Failure if it's not.

condition
the condition to check
st
if <stacktrace> is not available, defaut argument provides minimal info about the failure location

◆ debug()

template<std::constructible_from< std::string > Failure = failure>
void dxx::assert::debug ( bool condition,
std::source_location st = std::source_location::current() )
inlineexport

Same as assert but only performs the check if the library is built in Debug mode.

condition
the condition to check
st
if <stacktrace> is not available, defaut argument provides minimal info about the failure location