fork(3) download
  1. #include <iostream>
  2. #include <functional>
  3.  
  4. using namespace std;
  5.  
  6. namespace
  7. {
  8. struct call
  9. {
  10. void operator()() const
  11. {
  12. std::cout << "call::operator()" << std::endl;
  13. }
  14. };
  15.  
  16. struct dummy
  17. {
  18. dummy()
  19. {
  20. std::cout << "dummy()" << std::endl;
  21. }
  22. dummy(const dummy&) = delete;
  23.  
  24. call member;
  25. };
  26. }
  27.  
  28.  
  29. int main() {
  30. dummy d;
  31.  
  32. d.member();
  33.  
  34. auto b = std::bind(&dummy::member, &d);
  35.  
  36.  
  37. std::cout << (void*)&b() << std::endl;
  38. std::cout << (void*)&d.member <<std::endl;
  39.  
  40. b()();
  41. return 0;
  42. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
dummy()
call::operator()
0x7ffd72c859ef
0x7ffd72c859ef
call::operator()