I have an object that gets constructed with another object passed by reference. The objects which is passed to the constructor looks like this:
HTTPServerResponse::HTTPServerResponse(Poco::Net::HTTPServerResponse &response)
My wrapper class (HTTPServerResponse) destroys response at some point but it doesn't also destroy itself. Actually there are multiple (external) reasons for which response might get destroyed, even outside my class.
What I want is prior to calling any other methods on response check its existence.
I tried:
if(!response) {...
Which produced error C2675: unary '!' : 'Poco::Net::HTTPServerResponse' does not define this operator or a conversion to a type acceptable to the predefined operator; Naturally, I also tried:
if(response) {...
Which also failed with error C2451: conditional expression of type 'Poco::Net::HTTPServerResponse' is illegal; No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
How do I fix this mess?