template struct BinaryDigit
{
enum { value = p*2+i };
typedef BinaryDigit O;
typedef BinaryDigit I;
};
struct Bin
{
typedef BinaryDigit<0,0> O;
typedef BinaryDigit<0,1> I;
};
Allowing:
Bin::O::I::I::O::O::value
much more verbose, but no limits (until you hit the size of an unsigned int of course).