-
Notifications
You must be signed in to change notification settings - Fork 12
ST::assert_handler
Removed in string_theory 3.0.
#include <string_theory/assert>
Type | Definition |
---|---|
Callback object for handling asserts with custom behavior |
Name | Summary |
---|---|
Set a custom assert handler for assertion failures | |
Reset the default assert handler for assertion failures |
Definition |
---|
C++ function object to be called when the string_theory assert handler is called for a failed assertion. This may either hold a function pointer or a C++11 lambda expression.
The function may wish to display message
to the user, as this is the message
that indicates what sort of failure occurred. In addition, the C++ code which
evaluated falsely is provided in condition_str
, as well as the filename
and line
number within the string_theory source code which triggered the
assertion.
It is strongly recommended to abort the process in this function. While it is not strictly necessary, failing to do so may cause parts of string_theory to execute with undefined behavior, potentially leading to other crashes or even unusual and unexpected results.
Removed in String Theory 3.0.
See also ST::set_assert_handler()
Signature |
---|
Sets the assert handler to handler
. This function will be called whenever a
string_theory assertion fails for any reason.
Note that while it is not possible to compile string_theory without asserts, it is possible to handle these assertion failures with your own handler (for example, writing to a log or executing cleanup code prior to termination).
While it is possible to use this function to disable asserts in string_theory, it is not recommended as doing so may cause parts of string_theory to execute with undefined behavior, potentially leading to other crashes or even unusual and unexpected results.
Removed in String Theory 3.0.
See also ST::assert_handler_t
Signature |
---|
Reset the string_theory assert handler back to its default implementation.
The default implementation simply writes the filename, line number, and
message text to stderr, and then calls abort()
.
Removed in String Theory 3.0.