On 06/11/13 10:11, Larry Evans wrote:
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... 3) then following the _vector_ link to: http://www.boost.org/doc/libs/1_53_0/libs/fusion/doc/html/fusion/container/v...
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:
I probably jumped to the conclusion that "template argument number"
meant "number of template instantiations". Sorry for that mistake.
I guess "template argument number" means the maximum arity of any
template. IOW, if "template argument number" was 5, then any
template taking over 5 arguments would cause the MSVC10/11
compiler to diagnose an error. IOW:
tuple