Should probably put a space before the parenthesis, as with other loops: foreach (...  Also, might as well loop on a reference: foreach (const SharedNodePointer& otherNode...