Boost logo

Boost :

Subject: Re: [boost] [Fusion] port to c++0x
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-09-23 17:30:54


On 09/23/09 14:47, Christopher Schmidt wrote:
> Larry Evans schrieb:
>> Thanks for all the work.
>>
>> However, I was wondering why you couldn't eliminate some of the
>> extensive BOOST_PP magic in:
>>
>> https://svn.boost.org/trac/boost/browser/sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector.hpp
>>
>>
>> by using the "tagged multiple inheritance"(TMI) method shown
>> around here:
>>
>> https://svn.boost.org/trac/boost/browser/sandbox/variadic_templates/libs/mpl/sandbox/tuple_non_recur.package_range_c.cpp#L53
>>
> ...
>>
>> The only other objection might be to limit the number of instantiations
>> because the more template instantiations, the slower the compile
>> time; however, Doug Gregor suggested he wasn't too worried
>> about that at the bottom of:
>>
>> http://groups.google.com/group/comp.std.c++/msg/6449d909fd3d5cdc
>>
>> -regards,
>> Larry
>
> Thank you very much for your feedback.

Your'e very welcome.

> I did consider that specific method. I decided against using it due to
> the enormous amount of template instantiations and the expensive
> type_at.

I'm not sure there would be more template instantiations.
It would really help my understanding if maybe you could explain
( with maybe a few examples and concrete numbers for number of
instantiations), why there would be more instantiations
with the TMI method. I know that would be a lot of work,
but it certainly would make your case a lot stronger.

> The current implementation is 4-unrolled recursive. I am pretty
> certain that it is faster - there are about 4 to 8 times less template
> instantiations.

Yeah, I saw that 4 a lot of places. I think other libraries use some
macro to set such a number. For example, BOOST_MPL_LIMIT_UNROLLING
here:

https://svn.boost.org/trac/boost/browser/trunk/boost/mpl/aux_/iter_fold_if_impl.hpp#L190

Are there plans to add a similar macro to variadic fusion vector?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk