Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-01-16 10:16:29


On Wednesday 16 January 2002 08:37 am, you wrote:
> I'd like to hear suggestions for naming a new repetition primitive to
> be added to the preprocessor library. Currently I've named the
> primitive as BOOST_PP_REPEAT_WHILE(), but I'd like to hear other
> suggestions. The primitive is basically a generalization of
> BOOST_PP_REPEAT().
>
> #define BOOST_PP_REPEAT_WHILE(C,F,I,X) /* ... */
>
> X = State
> C(D,X) = condition to check if repetition should be continued
> F(D,X) = transform from state(n) to state(n+1)
> I(D,X) = instantiate state
> D = repetition depth (for invoking BOOST_PP_REPEAT_WHILE)

This has all the makings of a C++ 'for' loop, so why not call it as such?

#define BOOST_PP_FOR(D,C,F,I) /* ... */

'D' is the initial value of the induction variable, 'C' is the condition, and
'F' is the increment expression. 'I' is the body of the loop, but of course
it needs to be a macro parameter for things to work.

        Doug


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