Boost logo

Boost Users :

Subject: Re: [Boost-users] Needs advices on design ( mpl or processor )
From: Larry Evans (cppljevans_at_[hidden])
Date: 2012-01-09 19:19:03


On 01/09/12 12:01, Larry Evans wrote:
> On 01/09/12 03:27, Allan Nielsen wrote:
>> 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
>>
> The attached has output which shows the structure of the type and
> shows that the last Enum passed to template has least offset, which
> you might find counterintuitive. The only solution I can think of
> is to reverse the args.
>
Another solution is to use:

http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/mpl/if_recur.hpp

as in the attached. This version does not use CRTP because
the if_recur template makes it unnecessary.
Output is:

./build/gcc4_7v/boost-svn/ro/trunk/sandbox/rw/variadic_templates/sandbox/compressed_enums/compressed_enums.if_recur.exe

:eos_t::size_bits=9
:get_ol<E1,0>:get_ol(T1)=0
:get_ol<E2,2>:get_ol(T2)=0
:get_ol<E3,5>:get_ol(T3)=0
:get_ol<E3,5>:get<T3>=0
putting:
:get_ol<E1,0>:get<T1>=1
:get_ol<E2,2>:get<T2>=2
:get_ol<E3,5>:get<T3>=3

-regards,
Larry




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