Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. template<typename t, typename return_type, typename... xs>
  4. using memfun_ptr = return_type(t::*)(xs...);
  5.  
  6. template<typename t, typename u>
  7. void whatever(t datum, memfun_ptr<t, u> ptr)
  8. {
  9. (datum.*ptr)();
  10. }
  11.  
  12. struct dupa
  13. {
  14. void call()
  15. {
  16. printf("dupa\n");
  17. }
  18. };
  19.  
  20. int main(void)
  21. {
  22. dupa x{};
  23. whatever<dupa, void>(x, &dupa::call);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement