|
Boost Users : |
Subject: Re: [Boost-users] Needs advices on design ( mpl or processor )
From: Allan Nielsen (a_at_[hidden])
Date: 2012-01-06 13:56:24
> Wouldn't that variable have to be large enough to contain all the enums.
> At first glance this looks like:
>
> Â fusion::vector<Enum_1,Enum_2,...Enum_n>:
The idea is that four enums which each only can contain four values,
can together only represent 256 ( 4^4) values which can be stored in a
char.
This off cause assume that their associated values are defined from 0 to 3.
It also works for numbers which are not powers of 2:
enum A{ a0 = 0, a1 = 1, a2 = 2, a3 = 3, a4 = 4 };
enum B{ b0 = 0, b1 = 1, b2 = 2, b3 = 3, b4 = 4 };
CompressedEnums< unsigned char,
CompressedEnum<unsigned char, 1, A>,
CompressedEnum<unsigned char, 5, B>
> ENUMS;
sizeof(ENUMS) == sizeof(unsigned char);
I do not know boost::fusion very well, but I do not think this use
full for this.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net