
Hi Sorry, I have been away from my computer doing the weekend. I'm looking at your suggested code, and the questions you have raised now. I will answer as soon as possible. Best regards Allan W. Nielsen On Sun, Jan 8, 2012 at 7:32 PM, Larry Evans <cppljevans@suddenlink.net> wrote:
On 01/07/12 17:28, Larry Evans wrote:
On 01/07/12 02:42, Allan Nielsen wrote: [snip]
void example1() { // As you see, the expresions for calculating the offset get quite long, // and are not easy to maintain.
Here's where I don't understand why the calculation are done outside the temple and then passed as args to the template. Why not have a template do the calculations and accumulate the results, somewhat like mpl::fold or the code I posted earlier?
C< CompressedEnum<tagA, 1>,
CompressedEnum<tagB, CompressedEnum<tagA, 1>::offset * CompressedEnum<tagA, 1>::size >,
CompressedEnum<tagC,
CompressedEnum<tagB, CompressedEnum<tagA, 1>::offset * CompressedEnum<tagA, 1>::size >::offset * CompressedEnum<tagB, CompressedEnum<tagA, 1>::offset * CompressedEnum<tagA, 1>::size >::size > > c1;
}
[snip] The attached code produces output:
:eos_t::offset=9 :get_ol(T1)=2 :get_ol(T2)=0 :get_ol(T3)=0 :get<T3>=0 putting: :get<T1>=0 :get<T2>=1 :get<T3>=2
The output before the putting: lines is caused by the obviously erroneous initialization of the buffer (no Enum e's stored in the buffer, only unsigned ints). The output after the putting: lines shows the effect of the put<Tag,Enum>(Enum e).
However, be warned! I'm not sure all the casting within the get_ol and put_ol is portable.
Is this about what you want?
I've looked briefly at Vicente's bit_mask library and it looks more complicated; however, that extra complication is probably because it provides extra capabilities.
HTH.
-Larry
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users