Suppose I have something like this:
struct EmptyClass{};
template<typename T1, typename T2 = EmptyClass,
typename T3 = EmptyClass, typename T4 = EmptyClass,
..., typename T20> class PoorMansTuple {
T1 t1;
T2 t2;
...
T20 t20;
};
Now, I may waste up to 19bytes per PoorMansTuple.
Question is:
1) Is there a way to create a class of size 0?
2) Is there a way to conditionally define a varaible? Somethign like:
T1 t1;
if (T2 != EmptyClass) T2 t2; // pseudo code
if (T3 != EmptyClass) T3 t3; // ...
Thanks!
The use of black magic macros is premitted.
I'm using g++ on MacOSX.