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 ++
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_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 ++
L
(from the right or the end of the list).
)
+For example,
+ ++ #define TEST(D,X,P) BOOST_PP_CAT(P,X) + BOOST_PP_LIST_FOLD_RIGHT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))) ++ +
expands to:
+ ++ _CBA ++
For example,
+ ++ #define TEST(R,P,X) BOOST_PP_CAT(P,X)(); + BOOST_PP_LIST_FOR_EACH(TEST,prefix_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))) ++ +
expands to:
+ ++ prefix_A(); prefix_B(); prefix_C(); ++
For example,
+ ++ #define TEST(R,P,I,X) BOOST_PP_CAT(P,X)(I); + BOOST_PP_LIST_FOR_EACH_I(TEST,prefix_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))) ++ +
expands to:
+ ++ prefix_A(0); prefix_B(1); prefix_C(2); ++
N
-tuple T_OF_L
.<
This macro is useful for generating code to avoid combinatorial explosion.
+For example,
+ ++ #define TEST(R,X) X + BOOST_PP_LIST_FOR_EACH_PRODUCT + ( TEST + , 2 + , ( BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)) + , BOOST_PP_TUPLE_TO_LIST(2,(1,2)) + ) + ) ++ +
expands to:
+ ++ (A,1) (A,2) (B,1) (B,2) (C,1) (C,2) ++
Expands to 0
if X == 0
and 1
if X != 0
.
For example, BOOST_PP_BOOL(3)
expands to 1
.
For example,
+ ++ #define TEST(I,P) P(I); + BOOST_PP_REPEAT(3,TEST,X) ++ +
expands to:
+ ++ X(0); X(1); X(2); ++
2D and 3D repetition are supported with the BOOST_PP_REPEAT_2ND() and diff --git a/doc/reference/stringize.htm b/doc/reference/stringize.htm index e171032..8832034 100644 --- a/doc/reference/stringize.htm +++ b/doc/reference/stringize.htm @@ -29,6 +29,8 @@
Stringizes X
after it is macro expanded.
For example, BOOST_PP_STRINGIZE(BOOST_PP_CAT(a,b))
expands to "ab"
.
The depth of iteration is determined by C(D,X)
.
For example,
+ ++ #define C(D,X) BOOST_PP_LESS_D(D,BOOST_PP_TUPLE_ELEM(2,0,X),BOOST_PP_TUPLE_ELEM(2,1,X)) + #define F(D,X) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,X)),BOOST_PP_TUPLE_ELEM(2,1,X)) + BOOST_PP_WHILE(C,F,(0,3)) ++ +
expands to:
+ ++ (3,3) ++
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 ++
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_FOR() is a generalization of BOOST_PP_REPEAT(). This means that
diff --git a/include/boost/preprocessor/list/fold_left.hpp b/include/boost/preprocessor/list/fold_left.hpp
index 1d4cb69..6c92a7f 100644
--- a/include/boost/preprocessor/list/fold_left.hpp
+++ b/include/boost/preprocessor/list/fold_left.hpp
@@ -33,7 +33,7 @@ list L
(from the left or the start of the list).
#define TEST(D,P,X) BOOST_PP_CAT(P,X) - BOOST_PP_FOLD_LEFT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))) + BOOST_PP_LIST_FOLD_LEFT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
expands to:
diff --git a/include/boost/preprocessor/list/fold_right.hpp b/include/boost/preprocessor/list/fold_right.hpp index 7f137b7..74ae965 100644 --- a/include/boost/preprocessor/list/fold_right.hpp +++ b/include/boost/preprocessor/list/fold_right.hpp @@ -36,6 +36,19 @@ listL
(from the right or the end of the list).
)
+For example,
+ ++ #define TEST(D,X,P) BOOST_PP_CAT(P,X) + BOOST_PP_LIST_FOLD_RIGHT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))) ++ +
expands to:
+ ++ _CBA ++
For example,
+ ++ #define TEST(R,P,X) BOOST_PP_CAT(P,X)(); + BOOST_PP_LIST_FOR_EACH(TEST,prefix_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))) ++ +
expands to:
+ ++ prefix_A(); prefix_B(); prefix_C(); ++
For example,
+ ++ #define TEST(R,P,I,X) BOOST_PP_CAT(P,X)(I); + BOOST_PP_LIST_FOR_EACH_I(TEST,prefix_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))) ++ +
expands to:
+ ++ prefix_A(0); prefix_B(1); prefix_C(2); ++
N
-tuple T_OF_L
.<
This macro is useful for generating code to avoid combinatorial explosion.
+For example,
+ ++ #define TEST(R,X) X + BOOST_PP_LIST_FOR_EACH_PRODUCT + ( TEST + , 2 + , ( BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)) + , BOOST_PP_TUPLE_TO_LIST(2,(1,2)) + ) + ) ++ +
expands to:
+ ++ (A,1) (A,2) (B,1) (B,2) (C,1) (C,2) ++
The depth of iteration is determined by C(D,X)
.
For example,
+ ++ #define C(D,X) BOOST_PP_LESS_D(D,BOOST_PP_TUPLE_ELEM(2,0,X),BOOST_PP_TUPLE_ELEM(2,1,X)) + #define F(D,X) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,X)),BOOST_PP_TUPLE_ELEM(2,1,X)) + BOOST_PP_WHILE(C,F,(0,3)) ++ +
expands to:
+ ++ (3,3) ++