fork download
  1. #include <functional>
  2. #include <boost/bind.hpp>
  3.  
  4. class test {
  5. public:
  6. template<class t> void jopa(t);
  7. void doit();
  8. };
  9.  
  10. template<class t>
  11. class base {
  12. public:
  13. typedef std::function<void(t)> handler;
  14. void send(handler h);
  15. };
  16.  
  17. class x {};
  18. class y {};
  19.  
  20. class derived_x: public base<x> {};
  21. class derived_y: public base<y> {};
  22.  
  23. void test::doit()
  24. {
  25. derived_x X;
  26. derived_y Y;
  27. X.send(boost::bind(&test::jopa, this, _1));
  28. Y.send(boost::bind(&test::jopa, this, _1));
  29. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty