Boost logo

Boost :

Subject: Re: [boost] [MPL][vector] Is there interest in mpl::vector using variadic templates?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2017-03-02 18:42:20


On 03/02/2017 11:54 AM, Larry Evans via Boost wrote:
> On 03/02/2017 11:27 AM, Peter Dimov via Boost wrote:
>> Larry Evans wrote:
>>
>>> One problem with the above cppljevans mpl is there's no at.hpp.
>>> Instead, the non-variadic boost/mpl/at.hpp was used.
>>> The reason no variadic at was created was because, AFAICT, there was
>>> no non-recursive method for picking the I-th element from T... , and,
>>> IIUC, recursive templates cause compile-time slow downs.
>>
>> Have you read
>>
>> http://pdimov.com/cpp2/simple_cxx11_metaprogramming_2.html
>>
>> ?
>
> Nope. Thanks *very much* for the link. I'm impressed (especially
> with the way you actually cited the parts of the standard to guide
> your search for the best method!).
>
>>
>> Search for mp_at.
>>
> Thanks for that tip.
>
> I'm a bit surprised that the mp_map_from_list was fastest.
> I would have thought that large template classes mean slow
> compile times, but I guess not.

This:

   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4235.htm

claims:

   template instantiations use memory that is never freed during the
   compilation process

so, maybe mp_map_from_list should be used with caution. If many
mp_map_from_list instantiations are used, I'm guessing the compiler
might become pressed for memory. Maybe a benchmark showing
compile time vs number of instantiations would show this.
For example, instead of N=800, see what happens when 2
instantiations with N=400 happen, and compare with a similar
test for mp_repeat_c.

-regards,
Larry


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