Advertisement
Guest User

Untitled

a guest
Aug 19th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. template<typename F>
  4. class Test {
  5. private:
  6.     F f;
  7.  
  8. public:
  9.     Test (F f) : f(f) {}
  10.  
  11.     template<typename... Args>
  12.     void call (Args... a) {
  13.         f(a...);
  14.     }
  15. };
  16.  
  17. void func (int a) {
  18.     std::cout << a << std::endl;
  19. }
  20.  
  21. int main () {
  22.     Test<void(*)(int)> test(func);
  23.  
  24.     test.call(2);
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement