clibIsNull - Determine if C++ object is null - MATLAB (original) (raw)

Main Content

Determine if C++ object is null

Syntax

Description

tf = clibIsNull([cppObj](#mw%5Fe7defdf3-4e79-4f5f-b2b7-9798634f0313)) returns logical1 (true) if cppObj isnullptr. Otherwise, it returns logical 0 (false).

example

Examples

collapse all

Test For nullptr Object

Suppose that you create an interface to librarynullptr, 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

Test for nullptr.

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

Input Arguments

collapse all

cppObj — C++ object created in MATLAB

handle

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

Version History

Introduced in R2019b