Skip to content

AUI_ASSERTX#

Asserts that the passed condition evaluates to true. Adds extra message string.

Header:#include <AUI/Util/Assert.h>
CMake:aui_link(my_target PUBLIC aui::core)

Definition#

#define AUI_ASSERTX(condition, what) AUI_IMPL_ASSERTX(condition, what)

Detailed Description#

If the condition evaluates to false, throws AAssertionFailedException, so it can be handled and reported properly. See also: AUI_ASSERT.

int v = 2 + 2;
AUI_ASSERTX(v >= 0, "positive value expected"); // does not trigger
AUI_ASSERTX(v != 4, "4 is unacceptable value"); // triggers

AUI_ASSERT appears in both debug and release builds on all platforms. To remove it from release builds, wrap with #if AUI_DEBUG.

#if AUI_DEBUG
AUI_ASSERTX(v > 0, "v should be positive");
#endif