looped typedefs and/or class definitions

Some of my code includes the following (abbreviated): typedef Edge<Node0000Type, Node0000Type> Edge00000000Type; typedef Edge<Node0000Type, Node0001Type> Edge00000001Type; typedef Edge<Node0000Type, Node0010Type> Edge00000010Type; typedef Edge<Node0000Type, Node0011Type> Edge00000011Type; //... you can imagine where this is going. Instead of 32 typedefs, I was wondering if it weren't possible to use the compiler to achieve the above. Similarly, let's say I wanted to define a set of empty classes: class AB : public A, B {}; class AC : public A, C {}; class BC : public B, C {}; can I use the compiler to automate this? Thanks for any comments. -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver! spamtraps: madduck.bogus@madduck.net "arguments are extremely vulgar, for everyone in good society holds exactly the same opinion." -- oscar wilde

"martin f krafft" wrote:
Some of my code includes the following (abbreviated): typedef Edge<Node0000Type, Node0000Type> Edge00000000Type; typedef Edge<Node0000Type, Node0001Type> Edge00000001Type; typedef Edge<Node0000Type, Node0010Type> Edge00000010Type; typedef Edge<Node0000Type, Node0011Type> Edge00000011Type; //... you can imagine where this is going.
Instead of 32 typedefs, I was wondering if it weren't possible to use the compiler to achieve the above.
Similarly, let's say I wanted to define a set of empty classes:
class AB : public A, B {}; class AC : public A, C {}; class BC : public B, C {};
can I use the compiler to automate this?
Boost.Preprocessor: http://www.boost.org/libs/preprocessor/doc/index.html Introduction to the library: http://boost-consulting.com/tmpbook/preprocessor.html It takes some effort to get used to using the library but it is worth of the time, IMHO. /Pavel
participants (2)
-
martin f krafft
-
Pavel Vozenilek