
11 Feb
2012
11 Feb
'12
4:53 p.m.
All right so you still need the switch regardless in this case if you want to implement a property(i) function.
i.e.
switch(i) { case 0: return metadata<Self, 0>(self).get();
case 1: return metadata>self, 1>(self).get();
... }
Yes, the switch would still be needed to do the property(i), but I think the visitor pattern is the better way to go(especially once we have polymorphic lambdas in C++).
There are template-based techniques to have counters as well, but they're quite tricky and tend to be fragile with subpar compilers.
I'm curios as to what template techniques there are to do this. Please elaborate.