|
Boost Users : |
Subject: Re: [Boost-users] Max Boost Fusion tuple parameters
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-06-13 08:27:30
On 06/12/13 04:54, Igor R wrote:
>> 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<T1,T2,T3,T4,T5>
>>
>> would be OK, but:
>>
>> tuple<T1,T2,T3,T4,T5,T6>
>>
>> would cause MSV10/11 to issue a compiler error.
>> Is that right?
>
> Yes, right.
>
>
>> Also, I also read somewhere that MSVC had not yet implemented
>> variadic templates:
>
> Variadic templates are implemented in the updated MSVC 11 toolchain
> ("Microsoft Visual C++ Compiler Nov 2012 CTP").
> http://www.microsoft.com/en-us/download/details.aspx?id=35515
>
Thanks for the link.
Now with variadic templates, can a tuple with > 64 elements be
created? IOW, would the following:
template<typename... T> struct tuple;
tuple<T1,T2,...,T64,T65>*pt=0;
compile?
FWIW, I used Christopher's variadic fusion library to compile
a 300 element tuple. It took a while, but it compiled.
Also, timing results showing the compile time vs tuple size
with gcc4.8 are:
TUPLE_SIZE= 10
1.97 0.19 2.14
TUPLE_SIZE= 50
2.45 0.16 2.59
TUPLE_SIZE= 100
3.49 0.32 3.90
TUPLE_SIZE= 200
7.90 0.57 8.85
TUPLE_SIZE= 300
15.93 0.96 17.09
The timing results were produce on ubuntu with:
TIME.cmd=time --format '%U %S %e'
I think this gives:
user-time system-time elapsed-time
It also appears that when TUPLE_SIZE >=100,
compile time goes up linearly.
The code compiled was:
typedef slim::vector
< int_value< 0 >
, int_value< 1 >
, int_value< 2 >
, int_value< 3 >
.
.
.
>
tuple_t;
int run(tuple_t const&a_tuple)
{
int sum=0;
sum+=slim::at_c< 0 >(a_tuple).value;
sum+=slim::at_c< 1 >(a_tuple).value;
sum+=slim::at_c< 2 >(a_tuple).value;
sum+=slim::at_c< 3 >(a_tuple).value;
.
.
.
sum+=slim::at_c< 49 >(a_tuple).value;
return sum;
}
and was generated by the attached python file
with TUPLE_SIZE as the argument.
-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