Skip to content

aui::non_null#

A contract that enforces non-nullable initialization.

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

Detailed Description#

If initialized with a value that equals to nullptr, issues a runtime assertion failure.

If initialized with nullptr itself, throws a compile-time error.

void render(aui::non_null<_<AView>> view) {
    view->render();
}

render(someView); // ok
someView = nullptr;
render(someView); // assertion failure in runtime
render(nullptr); // compile-time error