deushiro

length

Dec 7th, 2020 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include "typelist.h"
  4. template <class TList>
  5. struct Length;
  6.  
  7.  
  8. template <>
  9. struct Length<NullType>
  10. {
  11.     enum {
  12.         length = 0
  13.     };
  14. };
  15.  
  16.  
  17. template <class Head, class Tail>
  18. struct Length< TypeList<Head, Tail> >
  19. {
  20.     enum {
  21.         length = 1 + Length<Tail>::length
  22.     };
  23. };
Add Comment
Please, Sign In to add comment