The BOOST_PP_SET_FOLD_LEFT_s macro folds (or accumulates) the elements of a set left-to-right.  It reenters BOOST_PP_SET_FOLD_LEFT with maximum efficiency.

Usage

BOOST_PP_SET_FOLD_LEFT_ ## s(op, state, set)

Arguments

s
The next available BOOST_PP_SET_FOLD_LEFT fold step.
op
A ternary operation of the form op(s, state, elem).  This macro is called for each element in set--each time returning a new state.  This operation is expanded by BOOST_PP_SET_FOLD_LEFT with the next available fold step, the current state, and the current element.
state
The initial state of the fold.
set
The set to be folded.

Remarks

For the set, (0)(1)(2), this macro expands to:
op(s, op(s, op(s, state, 0), 1), 2)

See Also

Requirements

Header:  <boost/preprocessor/set/fold_left.hpp>

Sample Code

#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/set/fold_left.hpp>
#include <boost/preprocessor/set/set.hpp>

#define S1 (a)(b)(c)
#define S2 (S1)(S1)(S1)

#define OP(s, state, x) state (BOOST_PP_SET_FOLD_LEFT_ ## s(OP_2, _, x))
#define OP_2(s, state, x) BOOST_PP_CAT(state, x)

BOOST_PP_SET_FOLD_LEFT(OP, BOOST_PP_SET_NIL, S2)
// expands to (_abc)(_abc)(_abc)