Debian Codegraph @

yo/advancedtemplates/examples/listsize.h

raw
1 #include "typelist.h"
2
3 //LISTSIZE
4 template <typename TypeList>
5 struct ListSize;
6 //=
7
8 //NULLTYPE
9 template <>
10 struct ListSize<NullType>
11 {
12 enum { size = 0 };
13 };
14 //=
15
16 //TYPELIST
17 template <typename Head, typename Tail>
18 struct ListSize<TypeList<Head, Tail> >
19 {
20 enum { size = 1 + ListSize<Tail>::size };
21 };
22 //=