It is pretty common for smart pointers nowadays to implement bool() operator. (See std:: for instance) Maybe you could add to UniginePtr.h something like
/**
* Test if the pointer object owns a resource
*/
UNIGINE_INLINE explicit operator bool() const {
return (this->get() != nullptr);
}
With this you can use safe patterns like :
if (Unigine::Ptr<Something> ptr = methodToGetPtr())
{
// ptr is guaranteed not to be nullptr here
// Do something with ptr
...
}
// ptr is not defined here so cannot be misused.