fork(2) download
  1. #include <vector>
  2. #include <algorithm>
  3.  
  4. class Foo;
  5.  
  6. class Base {
  7. protected:
  8. bool hasChild() const { return !childs_.empty(); }
  9. std::vector<Foo> childs_;
  10. };
  11.  
  12. class Foo : public Base {
  13. public:
  14. bool hasGrandChild() const {
  15. return std::any_of(childs_.begin(), childs_.end(), [](Foo const &foo) {
  16. return foo.hasChild();
  17. });
  18. }
  19. };
  20.  
  21. int main()
  22. {
  23. Foo foo;
  24. foo.hasGrandChild();
  25. return 0;
  26. }
Success #stdin #stdout 0s 2924KB
stdin
Standard input is empty
stdout
Standard output is empty