There are certain contexts in C++ where an expression of type bool is expected; for example, when an expression is used as an argument to a built-in logical operator (!, && or ||). In such cases, a non-bool expression is contextually converted to bool and the operator is applied to the (bool) result of the conversion.
To evaluate: !node
Convert node to bool (covert pointer to bool, the result is false if the pointer is null, true otherwise).
Apply the logical operator ! to the result of the conversion.
if (!node) return; is conceptually equivalent to:
1 2 3 4
constbool not_null = node ; // not_null is true if node != nullptr is true
constbool is_null = !not_null ; // negation of not_null; is_null is true if not_null is false;
// ie. is_null is true if node == nullptr
if( is_null ) return ;