Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 517 Bytes

File metadata and controls

20 lines (13 loc) · 517 Bytes

assert_not_null

Asserts that a raw pointer value is not null.

This assertion is intentionally limited to raw pointers and std::nullptr_t. It does not treat smart pointers or arbitrary nullable-looking classes as null values.

#include <kaycxx/assert.hpp>

using namespace kaycxx::assert;

int main() {
    auto value = 42;
    auto pointer = &value;

    assert_not_null(pointer);
}

Use this instead of assert_true(pointer != nullptr) so failures report the pointer value as a nullness assertion.