|
Boost : |
From: Itay Maman (itay_maman_at_[hidden])
Date: 2002-06-30 08:15:13
David Abrahams wrote:
> From: "Itay Maman" <itay_maman_at_[hidden]>
>
>>My variant implementation (described at the first post of this thread)
>>can use either Loki::Typelist or mpl::list (determined by a preprocessor
>> symbol). To do that I wrote several adaptors which allow the same
>>code-base to work with these two components. The adaptors (in the
>>mpl::list mode) use the following mpl primitives: next, begin, size,
>>front, and pop_front. I didn't want to use any mpl algorithms, so I
>>coded the sequence looping constructs myself. I believe that these
>>primitives all take O(1) in compilation time,
>
>
> I don't see how size can be done in O(1) on a typelist.
>
Hmm..., my mistake. I should have mentioned this: size<> is only used
*outside* any meta-loop.
>
>>so I cannot see how can I
>>optimize it any further.
>
>
> I think you got it backwards. Those are algorithms, and assembling your own
> loop out of those pieces is probably less-efficient than using a canned
> for_each.
>
I started with algorithms (primarily: iter_fold), and then modified the
code to its current state. Either way, dot-style typelists were faster
by a factor of ~10
-Itay
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk