Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
iv::assert Namespace Reference

Functions

void assertionFailure (const char *exprString, const char *assertionMade, const char *func, const char *file, int line)
 
void throwInvalidArgument (const char *message, const char *func, const char *file)
 
void throwInvalidState (const char *expr, const char *func, const char *file)
 
void assertUnreachable (const char *file, int line)
 
void assertionMessage (const char *message, const char *func, const char *file, int line)
 
void debugInfo (std::string_view message)
 
void debugMessage (std::string_view message)
 
void debugError (std::string_view message)
 
template<typename T >
void ignoreParam (T &&)
 
template<typename... T>
void ignoreParams (T &&...args)
 

Variables

template<class... >
constexpr bool always_false = false
 

Function Documentation

◆ assertionFailure()

void iv::assert::assertionFailure ( const char * exprString,
const char * assertionMade,
const char * func,
const char * file,
int line )

Called when an assertion fails Throws an Exception object

◆ assertionMessage()

void iv::assert::assertionMessage ( const char * message,
const char * func,
const char * file,
int line )

◆ assertUnreachable()

void iv::assert::assertUnreachable ( const char * file,
int line )

Define assertUnreachable and IV_ASSERT_UNREACHABLE

This is intended to be used in the same situations as std::unreachable(); a codepath that (should not) be reachable but where the compiler cannot tell that it is unreachable.

Unlike std::unreachable(), or equivalent compiler builtins like GCC's __builtin_unreachable, this function is not UB. By default it will throw an exception. If IV_TERMINATE_ON_ASSERTS is defined, it will instead print a message to stderr and abort.

Due to this difference, and the fact that it is not inlined, calling this is significantly more costly than using std::unreachable.

◆ debugError()

void iv::assert::debugError ( std::string_view message)

◆ debugInfo()

void iv::assert::debugInfo ( std::string_view message)

◆ debugMessage()

void iv::assert::debugMessage ( std::string_view message)

◆ ignoreParam()

template<typename T >
void iv::assert::ignoreParam ( T && )

Mark variable as unused.

Takes any number of arguments and marks all as unused, for instance IV_UNUSED(a); or IV_UNUSED(x, y, z);

◆ ignoreParams()

template<typename... T>
void iv::assert::ignoreParams ( T &&... args)

◆ throwInvalidArgument()

void iv::assert::throwInvalidArgument ( const char * message,
const char * func,
const char * file )

◆ throwInvalidState()

void iv::assert::throwInvalidState ( const char * expr,
const char * func,
const char * file )

Variable Documentation

◆ always_false

template<class... >
bool iv::assert::always_false = false
inlineconstexpr