###  | # Boost.Preprocessor ## Reference

Prev Next Macros Headers

# #include <boost/preprocessor/list/fold_left.hpp>

## #define BOOST_PP_LIST_FOLD_LEFT(F,P,L)

Iterates `F(D,P,X)` for each element `X` of the list `L` (from the left or the start of the list).

In other words, expands to:

      F
      ( D
      , ... F(D, F(D,P,BOOST_PP_LIST_AT(L,0)), BOOST_PP_LIST_AT(L,1)) ...
      , BOOST_PP_LIST_AT(L,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(L))
      )

### Note

- Folding, or accumulation, is a very general pattern of computation. Most list operations can be implemented in terms of folding.

### See

- BOOST_PP_LIST_FOLD_RIGHT()

### Uses

- BOOST_PP_WHILE()

### Test

- list_test.cpp

Prev Next Macros Headers

Revised

© Copyright Housemarque Oy 2002

Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.