In DOM (Document Object Model) specification, interface Node has a method:
Node GetChild();
It states that if Node has no child then a return value is NULL. What is the right way to implement this approach in C++ without returning a pointer to a child Node. (Better to prevent from memory leaks)
Suggestion:
Have an attribute
bool is_null_;
and overload operator bool() to return this value.
Node child = node.GetChild();
if (child) { ... }