fork download
  1. #include <functional>
  2.  
  3. struct Quux {
  4. template <typename Callable>
  5. void part3(int, Callable c){ c(); }
  6.  
  7. template <typename Callable>
  8. void part2(Callable c){
  9. c();
  10. }
  11.  
  12. template <typename Callable>
  13. void part1(Callable c){
  14. part2(std::bind(&Quux::part3, this, 3, c));
  15. }
  16. };
  17.  
  18.  
  19. void f(int){}
  20.  
  21. int main(){
  22. Quux q;
  23. q.part1(std::bind(f, 1));
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function 'void Quux::part1(Callable) [with Callable = std::_Bind<void (*(int))(int)>]':
prog.cpp:23:25:   instantiated from here
prog.cpp:14:3: error: no matching function for call to 'bind(<unresolved overloaded function type>, Quux* const, int, std::_Bind<void (*(int))(int)>&)'
stdout
Standard output is empty