C ++ 11 introduced a keyword nullptrthat I don't have.
I assume that there is a macro NULLfrom C that I read about using in C ++ from some material here and here , but I'm still not sure if the correct way to check for a null pointer is in this older C ++ standard.
I essentially want to be able to write this code for my test case using the Boost test:
aWrapperDataStructure x;
BOOST_CHECK_NE(x.get_ptr(), static_cast<decltype(x.get_ptr())>(nullptr));
But maybe, as suggested in the Tutorials Point, something like this is more suitable given the limitations:
BOOST_CHECK(x.get_ptr()); //true when not NULL
Something about it threw me away, so I wonder what is the best practice here. If he is somewhere on the Internet, or on SO, he was buried for a long time, and I can not find him. Thank!
source
share