Boost logo

Boost Users :

Subject: Re: [Boost-users] Max Boost Fusion tuple parameters
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-06-11 11:11:42


On 06/11/13 09:31, Igor R wrote:
>>> What is the maximum Boost Fusion tuple param count?
>>>
>>> I was thinking of using it for about 200-300 elements.
>>>
>>> Anyone done this?
>>>
>>> I've heard of defines for this, but never actually *knew* of anyone
>>> actually doing it.
>>>
>>> Thanks,
>>> Rodrigo Madera
>>
>> I found some relevant information on this by:
>>
>> 1) going to:
>> http://www.boost.org/doc/libs/1_53_0/libs/fusion/doc/html/index.html
>> 2) then following the _Class template tuple_ link to:
>> http://www.boost.org/doc/libs/1_53_0/libs/fusion/doc/html/fusion/tuple/class_template_tuple.html
>> 3) then following the _vector_ link to:
>> http://www.boost.org/doc/libs/1_53_0/libs/fusion/doc/html/fusion/container/vector.html
>>
>> 4) which said:
>> You may define the preprocessor constant FUSION_MAX_VECTOR_SIZE before
>> including any Fusion header to change the default. Example:
>>
>> #define FUSION_MAX_VECTOR_SIZE 20
>
>
> Template argument number in a template declaration is limited by
> compilers. For example, in MSVC10/11 it's limited to 64. So I doubt
> setting FUSION_MAX_VECTOR_SIZE to 200 would work.
>

Thanks Igor. I had no idea about that :(

In this case, I'd guess the only solution for Rodrigo is to use
Christopher Schmidt's variadic tuples:

http://article.gmane.org/gmane.comp.lib.boost.devel/194322

I remember (a year or more ago) looking at the Christopher's
implementation and, IIRC, it used a combination of the boost
preprocessor library and variadic templates to speed the compilation
times. Again, IIRC, Christoper built up a N*CHUNK size tuple of T
element by creating N structs each containing CHUNK elements of type
T. I think the N structs were recursively inherited; so that struct
tuple_chunked<N> inherited from tuple_chunked<N-1>. Thus, if CHUNK
were 64 (in the case of MSVC`10/11, then creating a tuple of 200 would
just require about 200/64 template instantiations.

The last I heard about Christopher's effort was this post:

http://article.gmane.org/gmane.comp.lib.boost.devel/234501

The code location (I don't know if it's still valid) was give in post:

http://article.gmane.org/gmane.comp.lib.boost.devel/228820

HTH.

-regards,
Larry


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net