diff --git a/doc/reference/for.htm b/doc/reference/for.htm index 037a3fa..c585080 100644 --- a/doc/reference/for.htm +++ b/doc/reference/for.htm @@ -38,6 +38,21 @@

The length of the sequence is determined by C(R,X).

+

For example,

+ +
+  #define C(R,X) BOOST_PP_LESS(BOOST_PP_TUPLE_ELEM(2,0,X),BOOST_PP_TUPLE_ELEM(2,1,X))
+  #define F(R,X) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,X)),BOOST_PP_TUPLE_ELEM(2,1,X))
+  #define I(R,X) BOOST_PP_TUPLE_ELEM(2,0,X)
+  BOOST_PP_FOR((0,3),C,F,I)
+
+ +

expands to:

+ +
+  0 1 2
+
+

Legend

-

For example,

- -
-  #define C(R,X) BOOST_PP_LESS(BOOST_PP_TUPLE_ELEM(2,0,X),BOOST_PP_TUPLE_ELEM(2,1,X))
-  #define F(R,X) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,X)),BOOST_PP_TUPLE_ELEM(2,1,X))
-  #define I(R,X) BOOST_PP_TUPLE_ELEM(2,0,X)
-  BOOST_PP_FOR((0,3),C,F,I)
-
- -

expands to:

- -
-  0 1 2
-
-

BOOST_PP_REPEAT() vs BOOST_PP_FOR()

BOOST_PP_FOR() is a generalization of BOOST_PP_REPEAT(). This means that diff --git a/doc/reference/list_fold_left.htm b/doc/reference/list_fold_left.htm index 2b2f1c2..ca987de 100644 --- a/doc/reference/list_fold_left.htm +++ b/doc/reference/list_fold_left.htm @@ -40,6 +40,19 @@ list L (from the left or the start of the list).

) +

For example,

+ +
+  #define TEST(D,P,X) BOOST_PP_CAT(P,X)
+  BOOST_PP_LIST_FOLD_LEFT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
+
+ +

expands to:

+ +
+  _ABC
+
+

Note