|
Boost Users : |
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-24 12:26:00
AMDG
Joel FALCOU wrote:
> Steven Watanabe a écrit :
>
>> I see. You might be able to get away with using nested BOOST_PP_REPEATs
>> You're limited to three levels so be careful.
>>
>
> How exactly can I pass the iteration count of one PP_REPEAT to another ?
>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#define SUM 16
#define INNER_LOOP(z, n, data) template<> test<data, n,
BOOST_PP_SUB(SUM, BOOST_PP_ADD(n, data))>;
#define OUTER_LOOP(z, n, data) BOOST_PP_REPEAT_ ##
z(BOOST_PP_INC(BOOST_PP_SUB(SUM, n)), INNER_LOOP, n)
BOOST_PP_REPEAT(BOOST_PP_INC(SUM), OUTER_LOOP, ~)
In Christ,
Steven Watanabe
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