Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. std::unordered_map<std::string, void*> callbackReg;
  2.  
  3. class A
  4. {
  5. public:
  6. void foo(int a)
  7. {
  8. //impl
  9. }
  10. void foo(int a, int b)
  11. {
  12. //impl
  13. }
  14. void foo(int a, double d)
  15. {
  16. //impl
  17. }
  18.  
  19. };
  20.  
  21.  
  22. template<class Instance , typename Function>
  23. void register_func(Instance& obj, Function func)
  24. {
  25. /* have to store function name as the key and
  26. - pointer to raw member function pointer as the value,
  27. - in callbackReg Map */
  28. // ---> Point B
  29. }
  30.  
  31. int main(int argc, const char * argv[])
  32. {
  33. A a;
  34. register_evt(a, &A::foo); //---> point A
  35. system("Pause");
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement