G
greek_bill
Hi all,
I'd like to have code that looks like the following :
BEGIN(Foo)
ADD(float);
ADD(int);
ADD(char);
END()
I'd like the above code to somehow append each type into a typelist,
which is available as a symbol, i.e. something like (using Loki's
typelists):
typedef NullType FOO1;
typedef Loki::TL::Append<FOO1, float>::Result FOO2;
typedef Loki::TL::Append<FOO2, int>::Result FOO3;
typedef Loki::TL::Append<FOO3, char>::Result FOO4;
typedef FOO4 Foo;
I've been trying to think of various ways to achieve this (e.g. using
boost:reprocessor, using __LINE__, etc), but where I keep getting
stuck is the fact that I can't have 'variables' in macros. I need to
somehow use the result from one macro as input into another, to call
macros recursively, or to have a 'global' variable that keeps track of
some 'state'.
Any ideas?
Thanks,
Bill
PS I could, in theory, using __COUNTER__ to 'guess' the name of the
_previous_ result. I haven't pursued this much, because __COUNTER__ is
compiler specific
I'd like to have code that looks like the following :
BEGIN(Foo)
ADD(float);
ADD(int);
ADD(char);
END()
I'd like the above code to somehow append each type into a typelist,
which is available as a symbol, i.e. something like (using Loki's
typelists):
typedef NullType FOO1;
typedef Loki::TL::Append<FOO1, float>::Result FOO2;
typedef Loki::TL::Append<FOO2, int>::Result FOO3;
typedef Loki::TL::Append<FOO3, char>::Result FOO4;
typedef FOO4 Foo;
I've been trying to think of various ways to achieve this (e.g. using
boost:reprocessor, using __LINE__, etc), but where I keep getting
stuck is the fact that I can't have 'variables' in macros. I need to
somehow use the result from one macro as input into another, to call
macros recursively, or to have a 'global' variable that keeps track of
some 'state'.
Any ideas?
Thanks,
Bill
PS I could, in theory, using __COUNTER__ to 'guess' the name of the
_previous_ result. I haven't pursued this much, because __COUNTER__ is
compiler specific