The simplest check for a pointer that is not null is this:
BOOST_CHECK(pointer);
A null pointer is implicitly converted to false , a non-bubble pointer is implicitly converted to true .
As for the problem with your use case: nullptr not a pointer type, then the type is std::nullptr_t . It can be converted to any type of pointer (or a pointer to a member type). However, there is no << overload to insert std::nullptr_t into the stream. You will need to attach nullptr to the appropriate pointer type for it to work.
source share