Boost logo

Boost :

From: John Harris (TT) (john.harris_at_[hidden])
Date: 2002-04-18 11:37:18


I love the BOOST_PP_TUPLE* macros, but the limit of 16 is restrictive.

I wrote a script to generate the code that should be added to tuple/eat.hpp,
tuple/elem.hpp, and tuple/to_list.hpp for an arbitrary limit.

Uh, and here it is:

$start=17; # start at 17, boost 1.27.0 defines up to 16
$end = 100; # you might want something less :-)

print "// extend tuple/eat.hpp\n";
for($j = $start; $j <= $end; ++$j)
{
    print "#define BOOST_PP_TUPLE${j}_EAT(";
    for($i=0;$i<$end;++$i) { printf( "%sP%3.3d", ($i ? "," : ""), $i); }
    print ")\n";
}

print "\n// extend tuple/elem.hpp\n";
for($j = $start; $j <= $end; ++$j)
{
    for($k = 0; $k < $j; ++$k)
    {
        print "#define BOOST_PP_TUPLE${j}_ELEM${k}(";
        for($i=0;$i<$j;++$i) { printf( "%sP%3.3d", ($i ? "," : ""), $i); }
        printf ") P%3.3d\n", $k;
    }
    print "\n";
}

print "\n// extend tuple/to_list.hpp\n";
for($j = $start; $j <= $end; ++$j)
{
    print "#define BOOST_PP_TUPLE${j}_TO_LIST(";
    for($i=0;$i<$j;++$i) { printf( "%sP%3.3d", ($i ? "," : ""), $i); }
    print ") \\\n ";
    for($i=0;$i<$j;++$i) { printf( "(P%3.3d,", $i); }
    print "(_,_,0)";
    for($i=0;$i<$j;++$i) { print ",1)"; }
    print "\n";
}

Regards,

john harris
trading technologies


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