SHARE
TWEET

Untitled

a guest Mar 20th, 2017 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. struct INNERMOST{};
  2.  
  3. template<int>
  4. struct param{};
  5.  
  6. template<typename...>
  7. struct params;
  8.  
  9. template<int... Ns>
  10. struct params< param<Ns>... >
  11. {};
  12.  
  13. struct outer{
  14.     template<int,typename,typename>
  15.     struct getinner;
  16.    
  17.     template<int pos, int N, int... Ns>
  18.     struct getinner<
  19.         pos,
  20.         param<N>,
  21.         params<param<Ns>...>
  22.     >
  23.     {
  24.         using type = typename getinner<
  25.             pos-1,
  26.             param<N>,
  27.             params<param<Ns>...>
  28.         >::type;
  29.     };
  30. };
  31.  
  32. template<>
  33. template<int N, int... Ns>
  34. struct outer::getinner<
  35.     0,
  36.     param<N>,
  37.     params<param<Ns>...>
  38. >
  39. {
  40.     typedef INNERMOST type;
  41. };
  42.  
  43. int main()
  44. {
  45.     typedef outer::getinner<
  46.         7,
  47.         param<1>,
  48.         params<
  49.             param<1>,
  50.             param<2>,
  51.             param<3>
  52.         >
  53.     >::type INNERMOST_TYPE;
  54. }
RAW Paste Data
Top