Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.60 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Nested template specialization depending on enclosing template parameters
  2. template < int ...Indices>
  3.  
  4. class T1 {
  5.     template <int _1, int _2>
  6.     class T2;
  7. };
  8.  
  9. template <int ...Indices>
  10. template <int _1>
  11. class T1<Indices...>::T2<_1, sizeof...(Indices)> {};
  12. //^--error: non-type template argument depends on a template parameter of the partial specialization
  13.        
  14. template < int ...Indices>
  15. class T1
  16. {
  17.     static const int index_size = sizeof...(Indices);
  18.  
  19.     template <int _1, int _2>
  20.     class T2;
  21. };
  22.  
  23. template <int ...Indices>
  24. template <int _1>
  25. class T1<Indices...>::T2<_1, T1<Indices...>::index_size> {};