#include <vector>
#include <algorithm>
class Foo;
class Base {
protected:
bool hasChild() const { return !childs_.empty(); }
std::vector<Foo> childs_;
};
class Foo : public Base {
public:
bool hasGrandChild() const {
return std::any_of(childs_.begin(), childs_.end(), [](Foo const &foo) {
return foo.hasChild();
});
}
};
int main()
{
Foo foo;
foo.hasGrandChild();
return 0;
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGFsZ29yaXRobT4KCmNsYXNzIEZvbzsKCmNsYXNzIEJhc2Ugewpwcm90ZWN0ZWQ6CiAgICBib29sIGhhc0NoaWxkKCkgY29uc3QgeyByZXR1cm4gIWNoaWxkc18uZW1wdHkoKTsgfQogICAgc3RkOjp2ZWN0b3I8Rm9vPiBjaGlsZHNfOwp9OwoKY2xhc3MgRm9vIDogcHVibGljIEJhc2UgewpwdWJsaWM6CiAgYm9vbCBoYXNHcmFuZENoaWxkKCkgY29uc3QgewogICAgcmV0dXJuIHN0ZDo6YW55X29mKGNoaWxkc18uYmVnaW4oKSwgY2hpbGRzXy5lbmQoKSwgW10oRm9vIGNvbnN0ICZmb28pIHsKICAgICAgICByZXR1cm4gZm9vLmhhc0NoaWxkKCk7CiAgICAgIH0pOwogIH0gIAp9OwogCmludCBtYWluKCkKewogIEZvbyBmb287CiAgZm9vLmhhc0dyYW5kQ2hpbGQoKTsKICByZXR1cm4gMDsKfQ==