fork download
  1. #include <functional>
  2. #include <iostream>
  3.  
  4. void check(const std::function<void()>& f)
  5. {
  6. std::cout << ((f) ? "NOT empty" : "empty") << std::endl;
  7. }
  8.  
  9. int main()
  10. {
  11. std::function<void()> f;
  12. check(f);
  13.  
  14. f = []{};
  15. check(f);
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
empty
NOT empty