fork download
  1. #include <iostream>
  2. #include <functional>
  3.  
  4. struct A {
  5. // Declare destructor to delete default move constructor
  6. ~A() {}
  7.  
  8. int a = 0;
  9. };
  10.  
  11. void func(const A&)
  12. {
  13. std::cout << "OK!" << std::endl;
  14. }
  15.  
  16. int main() {
  17. A a;
  18. auto f = std::bind(&func, a);
  19. f();
  20. }
Success #stdin #stdout 0s 4388KB
stdin
Standard input is empty
stdout
OK!