fork download
  1. #include <iostream>
  2. #include <functional>
  3. #include <memory>
  4. using namespace std;
  5.  
  6. struct connection;
  7. struct login;
  8. struct huin;
  9.  
  10. typedef shared_ptr<connection> connection_ptr;
  11. typedef shared_ptr<login> login_ptr;
  12. typedef shared_ptr<huin> huin_ptr;
  13.  
  14. struct login {
  15. static void on_message(const connection_ptr& , const login_ptr message ) {
  16. }
  17. };
  18. struct huin {
  19. static void on_message(const connection_ptr& , const huin_ptr message ) {
  20. }
  21. };
  22.  
  23. template<class T>
  24. void register_yoba() {
  25. connection_ptr a;
  26. shared_ptr<T> b;
  27. [&](){T::on_message(a, b);};
  28. }
  29.  
  30.  
  31. int main() {
  32. register_yoba<login>();
  33. register_yoba<huin>();
  34. return 0;
  35. }
Success #stdin #stdout 0s 4336KB
stdin
Standard input is empty
stdout
Standard output is empty