Boost logo

Boost :

Subject: Re: [boost] Increasing BOOST_PP_VARIADICS_SIZE
From: Damien Buhl (damien.buhl_at_[hidden])
Date: 2018-08-20 19:36:42


On 19/08/2018 22:24, Edward Diener via Boost wrote:
> On 8/19/2018 7:22 AM, Damien Buhl via Boost wrote:
>> Dear Edward,
>>
>> In comparison to BOOST_PP_SEQ, BOOST_PP_VARIADICS is limited to 64
>> elements while BOOST_PP_SEQ is limited 255.
>>
>> Is there a reason for the choice of 64 or could I patch
>> BOOST_PP_VARIADICS to go as BOOST_PP_SEQ to a limit of 255 ?
>>
>> Or asked differently do you think there  are in newer
>> compilers/standards a way to have an unbounded BOOST_PP_VARIADICS
>> implementation nowadays ?
>
> BOOST_PP_TUPLE also has a 64 element limit.
>
> I do not think there is a way to do an unbounded size, but if you have
> code to replace the BOOST_PP_VARIADIC_SIZE macro feel free to suggest
> it or create a PR.
>
> There have been some other requests about increasing the limits of PP
> constructs as well as the numeric calculations whose limit is 256.
> These can always be manually done, but to what purpose, especially as
> the greater the limit the slower the preprocessor will run ? In your
> case is there really any practical point of having more than 64
> possible variadic parameters ?
>
> If there were techniques to have unbounded sizes for various limits PP
> would be glad to adopt them if they did not cause the preprocessor to
> slow down a great deal. But I do not know of such techniques.

Actually I was wondering in oder to improve BOOST_FUSION_ADAPT_STRUCT.
That uses BOOST_PP_SEQ and BOOST_PP_VARIADICS alternatively for the
member list.

Because we have the possibility to add elements as variadics or as
sequence and it changes the limit, which isn't obvious for the end user.

For example the following code
https://github.com/nxxm/gh/blob/master/gh/repos.hxx#L172 compiles with
sequence signature but not the variadic one (because there are more than
63 members).

There is this stackoverflow answer which seems to have a technique to
make SEQ operations unlimited:
https://stackoverflow.com/a/48326119/271781 but for VARIADICS I don't
know yet. I'll try to play with it and come back.

Thanks for the fast reply.


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