Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. class Empty {};
  2.  
  3. template <int H, class T = Empty>
  4. struct list {
  5. static const int head = H;
  6. typedef T tail;
  7.  
  8. };
  9.  
  10. template <class T,int N>
  11. struct min_elem{};
  12.  
  13.  
  14. template<int H, class T,int N>
  15. struct min_elem<list<H,T>,N >{
  16.  
  17.  
  18. static const int value = (N>H ? min_elem<T,H>::value : min_elem<T,N>::value );
  19.  
  20. };
  21.  
  22.  
  23. template<int N>
  24. struct min_elem<Empty,N>{
  25. static const int value=N;
  26. };
  27.  
  28. template <class T>
  29. struct min{};
  30.  
  31. template <int I, class T>
  32. struct min<list<I,T> > {
  33.  
  34. static const int value = min_elem<list<I,T>, I>::value;
  35. };
  36.  
  37. template<class T, int K>
  38. struct re{};
  39.  
  40. template<int I, class T, int K>
  41. struct re <list<I,T>,K>{
  42.  
  43. typedef list< ?? don't know what should I exactly do here> value;
  44.  
  45. };
  46.  
  47. template<int I>
  48. struct re <Empty,I>{
  49.  
  50. ??
  51.  
  52. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement