Advertisement
frasl

Untitled

Feb 11th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. template <typename T, int int_param> struct dispatch_demo {
  2.     void do_the_job_impl(int_v<0>)
  3.     {
  4.         std::cout << "zero" << std::endl;
  5.     }
  6.  
  7.     void do_the_job_impl(int_v<1>)
  8.     {
  9.         std::cout << "one" << std::endl;
  10.     }  
  11.  
  12.     template <int v> void do_the_job_impl(int_v<v>)
  13.     {
  14.         std::cout << "generic" << std::endl;
  15.     }
  16.  
  17.     void do_the_job()
  18.     {
  19.         do_the_job_impl(int_v<int_param>());
  20.     }
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement