C++11 introduced the nullptr
keyword, which I don't have available.
I suppose there is the NULL
macro from C, which I read about using in C++ from some stuff here and here, but I'm still unsure what's the proper way of checking for a null pointer in this older standard of C++.
I essentially want to be able to write this code for my test case with Boost Test:
aWrapperDataStructure x;
BOOST_CHECK_NE(x.get_ptr(), static_cast<decltype(x.get_ptr())>(nullptr));
But maybe, as Tutorials Point suggested, something like this is more appropriate given the constraints:
BOOST_CHECK(x.get_ptr()); //true when not NULL
Something about that throws me off though, so I'm wondering what the best practice is here. If it's somewhere online, or on SO, it's been long buried and I can't find it. Thank you!