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