16 #ifndef __typelistgen_h
17 #define __typelistgen_h
47 template<
class TList,
class TLenList,
48 template<
class,
id_t>
class DefTrans,
49 class WorkingList=Loki::NullType, id_t ID=0>
53 template<
class H,
class Tail, id_t N,
class NTail,
54 template<
class,
id_t>
class DefTrans,
class WorkingList, id_t ID>
55 struct ListGenerator<Loki::Typelist<H,Tail>,Loki::Typelist<s_uint<N>,NTail>,DefTrans,WorkingList,ID> {
56 typedef Loki::Typelist<H,WorkingList> WList;
61 template<
class H,
class T,
class Tail, id_t N,
class NTail,
62 template<
class,
id_t>
class DefTrans,
class WorkingList, id_t ID>
63 struct ListGenerator<Loki::Typelist<Loki::Typelist<H,T>,Tail>,Loki::Typelist<s_uint<N>,NTail>,DefTrans,WorkingList,ID> {
64 typedef Loki::Typelist<H,WorkingList> WList;
67 typedef typename Loki::TL::Append<L1,L2>::Result Result;
70 template<
class H,
class Tail, id_t N,
class NTail,
71 template<
class,
id_t>
class DefTrans,
class WorkingList, id_t ID>
72 struct ListGenerator<Loki::Typelist<Loki::Typelist<H,Loki::NullType>,Tail>,
73 Loki::Typelist<s_uint<N>,NTail>,DefTrans,WorkingList,ID> {
74 typedef Loki::Typelist<H,WorkingList> WList;
75 typedef typename ListGenerator<Tail,NTail,DefTrans,WList,(ID*N)+H::ID>::Result Result;
78 template<
template<
class,
id_t>
class DefTrans,
class WorkingList, id_t ID>
79 struct ListGenerator<Loki::NullType,Loki::NullType,DefTrans,WorkingList,ID> {
80 typedef Loki::Typelist<typename DefTrans<WorkingList,ID>::Result,Loki::NullType> Result;
86 template<int_t Begin, int_t End,
87 template<
int_t>
class Holder =
SIntID>
89 typedef Loki::Typelist<Holder<Begin>,
90 typename GenNumList<Begin+1,End,Holder>::Result> Result;
94 template<
int_t>
class Holder>
96 typedef Loki::Typelist<Holder<End>,Loki::NullType> Result;
100 template<
int_t M,
int_t P>
102 static const int_t N = IPow<M,P>::value;
103 static const int_t ID = N-1;
104 static const int_t value = N;
108 struct PowerHolder<2,P> {
109 static const int_t N = 1<<P;
110 static const int_t ID = N-1;
111 static const int_t value = N;
115 struct Power2holder :
public PowerHolder<2,P> {};
118 struct Power3holder :
public PowerHolder<3,P> {};
122 template<
int_t PowerBegin,
int_t PowerEnd,
int_t M>
124 typedef Loki::Typelist<PowerHolder<M,PowerBegin>,
125 typename GenPowerList<PowerBegin+1,PowerEnd,M>::Result> Result;
128 template<
int_t PowerEnd,
int_t M>
130 typedef Loki::Typelist<PowerHolder<M,PowerEnd>,Loki::NullType> Result;