Class endstone::Preconditions¶
ClassList > endstone > Preconditions
Static helpers for validating method arguments and object state.
#include <endstone/check.h>
Public Static Functions¶
| Type | Name |
|---|---|
| void | checkArgument (bool condition, std::format_string< Args... > format, Args &&... args) Ensures the truth of an expression involving one or more parameters to the calling method. |
| void | checkState (bool condition, std::format_string< Args... > format, Args &&... args) Ensures the truth of an expression involving the state of the calling instance. |
Public Static Functions Documentation¶
function checkArgument¶
Ensures the truth of an expression involving one or more parameters to the calling method.
template<typename... Args>
static inline void endstone::Preconditions::checkArgument (
bool condition,
std::format_string< Args... > format,
Args &&... args
)
Parameters:
conditionThe expression that must hold.formatA format string describing the failure, used when the condition isfalse.argsArguments to substitute into the format string.
Exception:
std::invalid_argumentif condition isfalse.
function checkState¶
Ensures the truth of an expression involving the state of the calling instance.
template<typename... Args>
static inline void endstone::Preconditions::checkState (
bool condition,
std::format_string< Args... > format,
Args &&... args
)
Parameters:
conditionThe expression that must hold.formatA format string describing the failure, used when the condition isfalse.argsArguments to substitute into the format string.
Exception:
std::runtime_errorif condition isfalse.
The documentation for this class was generated from the following file include/endstone/check.h