Main Content

clibIsNull

Determine if C++ object is null

Description

tf = clibIsNull(cppObj) returns logical 1 (true) if cppObj is nullptr. Otherwise, it returns logical 0 (false).

example

Examples

collapse all

Suppose that you create an interface to library nullptr, built from this nullptr.hpp header file, containing a function that returns NULL.

class A {
public:
    double val;
};

// Function returning nullptr object
A* returnObjectNullptr() {
    return nullptr;
}

Display nullptr for an object of class A. The MATLAB® code is used as an illustration and does not execute as is, unless you build the interface.

ret = clib.nullptr.returnObjectNullptr
ret = 
    null A

Test for nullptr.

if clibIsNull(ret) 
% Code to process nullptr
end;

Input Arguments

collapse all

C++ object created in MATLAB, specified as a handle

Version History

Introduced in R2019b