Wed, 05/18/2022 - 05:41
Forums:
Hi Bros, I get some question when use the smart pointer "Handle" of OCCT.
As we know, in C++, judge null pointer can use “if(p==nullptr)”.
However, in OCCT it seems not work.
I can use "IsNull()" to judge some smart pointer like "Handle(TopoDS_Shape)", cause TopoDS_Shape has function "IsNull()";
but if I want to judge a smart pointer like:
”Handle(StepRepr_RepresentationItem) treader“
I don't know how to judge it a null pointer.
Wed, 05/18/2022 - 08:19
Hi Linbei,
You may use "IsNull()" here the same way. The "Handle" object has its own "IsNull()" method, which only checks whether the pointer is initialized.
You could also use "if (p == nullptr)" for OCCT handles.
Regards,
Artem
Fri, 05/20/2022 - 10:09
Thanks, Artem. It works. I make mistakes. It works.
Bless you.