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 17:05:39


On 03/01/2017 05:07 PM, Larry Evans via Boost wrote:
> On 03/01/2017 12:56 PM, Antony Polukhin via Boost wrote:
>> 2017-02-21 13:52 GMT+03:00 Михаил Максимов via Boost
>> <boost_at_[hidden]>:
>>> Dear community,
>>>
>>> I've recently started contributing to boost::variant. To speed up
>>> variant's
>>> compilation I'm implementing mpl::vector on variadic templates. For now
>>> status of new vector implementation is:
>> <...>
>>> made me wonder, is there interest in variadic templates
>>> implementation? Are
>>> there limitations for it's usefulness, which I did not see?
>>
>> I'm very interested in patching MPL to be able to use variadic templates.
>>
> There was a variadic template mpl try from 7 years ago:
>
> https://github.com/cppljevans/variadic_templates/tree/master/boost/mpl
>
> Maybe it could give you some ideas. OTOH, maybe it's *too* old :(
>
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.

Since then, I've stumbled across other methods as shown in the attached
(where, type_at is used instead of at).

In addition there have been language proposals to do essentially the
same:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0535r0.html#parameter-pack-slicing

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

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0327r1.pdf

I don't know of any compiler's that implement those "tuple slicing"
operations; however, if someone does know of some, I'd like
to see their use as an alternative to the existing mpl::at.

Mike, if you find such an tuple-slicing compiler, maybe in your
variadic mpl implementation you could provide a flag which uses
that or one of the methods in the type_at.hpp attachment.
Then, you could profile them to demonstrate which is best :)

-regards,
Larry




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