mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-15 13:36:33 +02:00
Updated docs
[SVN r12687]
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Includes all arithmetic headers.</P> */
|
||||
/** <p>Includes all arithmetic headers.</p> */
|
||||
|
||||
#include <boost/preprocessor/arithmetic/div.hpp>
|
||||
#include <boost/preprocessor/arithmetic/mod.hpp>
|
||||
|
@ -18,14 +18,15 @@
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/while.hpp>
|
||||
|
||||
/** <P>Expands to the sum of X and Y.</P>
|
||||
/** <p>Expands to the sum of <code>X</code> and <code>Y</code>.</p>
|
||||
|
||||
<P>For example, BOOST_PP_ADD(4,3) expands to 7 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_ADD(4,3)</code> expands to <code>7</code> (a
|
||||
single token).</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_ADD(X,Y) BOOST_PP_ADD_D(0,X,Y)
|
||||
|
||||
@ -40,6 +41,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_ADD().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_ADD().</p> */
|
||||
#define BOOST_PREPROCESSOR_ADD(X,Y) BOOST_PP_ADD(X,Y)
|
||||
#endif
|
||||
|
@ -16,14 +16,15 @@
|
||||
#include <boost/preprocessor/comparison/less_equal.hpp>
|
||||
#include <boost/preprocessor/inc.hpp>
|
||||
|
||||
/** <P>Expands to the quotient of X and Y.</P>
|
||||
/** <p>Expands to the quotient of <code>X</code> and <code>Y</code>.</p>
|
||||
|
||||
<P>For example, BOOST_PP_DIV(4,3) expands to 1 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_DIV(4,3)</code> expands to <code>1</code> (a
|
||||
single token).</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_DIV(X,Y) BOOST_PP_DIV_D(0,X,Y)
|
||||
|
||||
@ -38,6 +39,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_DIV().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_DIV().</p> */
|
||||
#define BOOST_PREPROCESSOR_DIV(X,Y) BOOST_PP_DIV(X,Y)
|
||||
#endif
|
||||
|
@ -15,14 +15,15 @@
|
||||
|
||||
#include <boost/preprocessor/comparison/less_equal.hpp>
|
||||
|
||||
/** <P>Expands to the remainder of X and Y.</P>
|
||||
/** <p>Expands to the remainder of <code>X</code> and <code>Y</code>.</p>
|
||||
|
||||
<P>For example, BOOST_PP_MOD(4,3) expands to 1 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_MOD(4,3)</code> expands to <code>1</code> (a
|
||||
single token).</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_MOD(X,Y) BOOST_PP_MOD_D(0,X,Y)
|
||||
|
||||
@ -32,6 +33,6 @@
|
||||
#define BOOST_PP_MOD_F(D,P) (BOOST_PP_SUB_D(D,BOOST_PP_TUPLE2_ELEM0 P,BOOST_PP_TUPLE2_ELEM1 P),BOOST_PP_TUPLE2_ELEM1 P)
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_MOD().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_MOD().</p> */
|
||||
#define BOOST_PREPROCESSOR_MOD(X,Y) BOOST_PP_MOD(X,Y)
|
||||
#endif
|
||||
|
@ -15,14 +15,15 @@
|
||||
|
||||
#include <boost/preprocessor/arithmetic/add.hpp>
|
||||
|
||||
/** <P>Expands to the product of X and Y.</P>
|
||||
/** <p>Expands to the product of <code>X</code> and <code>Y</code>.</p>
|
||||
|
||||
<P>For example, BOOST_PP_MUL(4,3) expands to 12 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_MUL(4,3)</code> expands to <code>12</code> (a
|
||||
single token).</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_MUL(X,Y) BOOST_PP_MUL_D(0,X,Y)
|
||||
|
||||
@ -37,6 +38,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_MUL().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_MUL().</p> */
|
||||
#define BOOST_PREPROCESSOR_MUL(X,Y) BOOST_PP_MUL(X,Y)
|
||||
#endif
|
||||
|
@ -17,14 +17,15 @@
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/while.hpp>
|
||||
|
||||
/** <P>Expands to the difference of X and Y.</P>
|
||||
/** <p>Expands to the difference of <code>X</code> and <code>Y</code>.</p>
|
||||
|
||||
<P>For example, BOOST_PP_SUB(4,3) expands to 1 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_SUB(4,3)</code> expands to <code>1</code> (a
|
||||
single token).</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_SUB(X,Y) BOOST_PP_SUB_D(0,X,Y)
|
||||
|
||||
@ -39,6 +40,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_SUB(X,Y).</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_SUB(X,Y).</p> */
|
||||
#define BOOST_PREPROCESSOR_SUB(X,Y) BOOST_PP_SUB(X,Y)
|
||||
#endif
|
||||
|
@ -16,9 +16,10 @@
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/if.hpp>
|
||||
|
||||
/** <P>Expands to nothing if C != 0 and to MSG if C == 0.</P> */
|
||||
/** <p>Expands to nothing if <code>C != 0</code> and to <code>MSG</code> if
|
||||
<code>C == 0</code>.</p> */
|
||||
#define BOOST_PP_ASSERT_MSG(C,MSG) BOOST_PP_IF(C,BOOST_PP_EMPTY,MSG BOOST_PP_EMPTY)()
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_ASSERT_MSG().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_ASSERT_MSG().</p> */
|
||||
#define BOOST_PREPROCESSOR_ASSERT_MSG(C,MSG) BOOST_PP_ASSERT_MSG(C,MSG)
|
||||
#endif
|
||||
|
@ -13,50 +13,13 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Delays the catenation of X and Y.</P>
|
||||
/** <p>Concatenates <code>X</code> and <code>Y</code> after they are macro
|
||||
expanded.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
|
||||
<PRE>
|
||||
#define STATIC_ASSERT(EXPR)\
|
||||
enum\
|
||||
{ BOOST_PP_CAT(static_check_,__LINE__) = (EXPR) ? 1 : -1\
|
||||
};\
|
||||
typedef char\
|
||||
BOOST_PP_CAT(static_assert_,__LINE__)\
|
||||
[ BOOST_PP_CAT(static_check_,__LINE__)\
|
||||
]
|
||||
|
||||
// ...
|
||||
|
||||
STATIC_ASSERT(sizeof(int) <= sizeof(long));
|
||||
</PRE>
|
||||
|
||||
<P>expands to:</P>
|
||||
|
||||
<PRE>
|
||||
enum
|
||||
{ static_check_152 = (sizeof(int) <= sizeof(long)) ? 1 : -1
|
||||
};
|
||||
typedef char
|
||||
static_assert_152
|
||||
[ static_check_152
|
||||
];
|
||||
</PRE>
|
||||
|
||||
<P>Using BOOST_PP_CAT() above lets the PP expand the __LINE__. If the above
|
||||
code would use the ## operator directly then __LINE__ would not be expanded and
|
||||
the above would expand to:</P>
|
||||
|
||||
<PRE>
|
||||
enum
|
||||
{ static_check___LINE__ = (sizeof(int) <= sizeof(long)) ? 1 : -1
|
||||
};
|
||||
typedef char
|
||||
static_assert___LINE__
|
||||
[ static_check___LINE__
|
||||
];
|
||||
</PRE>
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/static_assert.c">static_assert.c</a></li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_CAT(X,Y) BOOST_PP_CAT_DELAY(X,Y)
|
||||
|
||||
@ -65,6 +28,6 @@ the above would expand to:</P>
|
||||
#define BOOST_PP_DO_CAT(X,Y) X##Y
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_CAT().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_CAT().</p> */
|
||||
#define BOOST_PREPROCESSOR_CAT(X,Y) BOOST_PP_CAT(X,Y)
|
||||
#endif
|
||||
|
@ -13,15 +13,15 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Expands to a comma. Can be used with BOOST_PP_IF().</P>
|
||||
/** <p>Expands to a comma. Can be used with BOOST_PP_IF().</p>
|
||||
|
||||
<H3>See</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_COMMA_IF()
|
||||
</UL>
|
||||
<h3>See</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_COMMA_IF()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_COMMA() ,
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_COMMA().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_COMMA().</p> */
|
||||
#define BOOST_PREPROCESSOR_COMMA() ,
|
||||
#endif
|
||||
|
@ -17,9 +17,11 @@
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/if.hpp>
|
||||
|
||||
/** <P>Expands to a comma if C != 0 and nothing if C == 0.</P> */
|
||||
/** <p>Expands to a comma if <code>C != 0</code> and nothing if
|
||||
<code>C == 0</code>.</p>
|
||||
*/
|
||||
#define BOOST_PP_COMMA_IF(C) BOOST_PP_IF(C,BOOST_PP_COMMA,BOOST_PP_EMPTY)()
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_COMMA_IF().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_COMMA_IF().</p> */
|
||||
#define BOOST_PREPROCESSOR_COMMA_IF(C) BOOST_PP_COMMA_IF(C)
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Includes all comparison headers.</P> */
|
||||
/** <p>Includes all comparison headers.</p> */
|
||||
|
||||
#include <boost/preprocessor/comparison/equal.hpp>
|
||||
#include <boost/preprocessor/comparison/greater.hpp>
|
||||
|
@ -16,12 +16,13 @@
|
||||
#include <boost/preprocessor/comparison/not_equal.hpp>
|
||||
#include <boost/preprocessor/logical/not.hpp>
|
||||
|
||||
/** <P>Expands to 1 if X==Y and 0 otherwise.</P>
|
||||
/** <p>Expands to <code>1</code> if <code>X == Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_EQUAL(X,Y) BOOST_PP_EQUAL_D(0,X,Y)
|
||||
|
||||
@ -29,6 +30,6 @@
|
||||
#define BOOST_PP_EQUAL_D(D,X,Y) BOOST_PP_NOT(BOOST_PP_NOT_EQUAL_D(D,X,Y))
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_EQUAL().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_EQUAL().</p> */
|
||||
#define BOOST_PREPROCESSOR_EQUAL(X,Y) BOOST_PP_EQUAL(X,Y)
|
||||
#endif
|
||||
|
@ -15,12 +15,13 @@
|
||||
|
||||
#include <boost/preprocessor/comparison/less.hpp>
|
||||
|
||||
/** <P>Expands to 1 if X>Y and 0 otherwise.</P>
|
||||
/** <p>Expands to <code>1</code> if <code>X > Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_GREATER(X,Y) BOOST_PP_GREATER_D(0,X,Y)
|
||||
|
||||
@ -28,6 +29,6 @@
|
||||
#define BOOST_PP_GREATER_D(D,X,Y) BOOST_PP_LESS_D(D,Y,X)
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_GREATER().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_GREATER().</p> */
|
||||
#define BOOST_PREPROCESSOR_GREATER(X,Y) BOOST_PP_GREATER(X,Y)
|
||||
#endif
|
||||
|
@ -15,12 +15,13 @@
|
||||
|
||||
#include <boost/preprocessor/comparison/less_equal.hpp>
|
||||
|
||||
/** <P>Expands to 1 if X>=Y and 0 otherwise.</P>
|
||||
/** <p>Expands to <code>1</code> if <code>X >= Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_GREATER_EQUAL(X,Y) BOOST_PP_GREATER_EQUAL_D(0,X,Y)
|
||||
|
||||
@ -28,6 +29,6 @@
|
||||
#define BOOST_PP_GREATER_EQUAL_D(D,X,Y) BOOST_PP_LESS_EQUAL_D(D,Y,X)
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_GREATER_EQUAL().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_GREATER_EQUAL().</p> */
|
||||
#define BOOST_PREPROCESSOR_GREATER_EQUAL(X,Y) BOOST_PP_GREATER_EQUAL(X,Y)
|
||||
#endif
|
||||
|
@ -17,12 +17,13 @@
|
||||
#include <boost/preprocessor/comparison/not_equal.hpp>
|
||||
#include <boost/preprocessor/logical/and.hpp>
|
||||
|
||||
/** <P>Expands to 1 if X<Y and 0 otherwise.</P>
|
||||
/** <p>Expands to <code>1</code> if <code>X < Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LESS(X,Y) BOOST_PP_LESS_D(0,X,Y)
|
||||
|
||||
@ -30,6 +31,6 @@
|
||||
#define BOOST_PP_LESS_D(D,X,Y) BOOST_PP_AND(BOOST_PP_NOT_EQUAL_D(D,X,Y),BOOST_PP_LESS_EQUAL_D(D,X,Y))
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_LESS().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_LESS().</p> */
|
||||
#define BOOST_PREPROCESSOR_LESS(X,Y) BOOST_PP_LESS(X,Y)
|
||||
#endif
|
||||
|
@ -16,12 +16,13 @@
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/logical/not.hpp>
|
||||
|
||||
/** <P>Expands to 1 if X<=Y and 0 otherwise.</P>
|
||||
/** <p>Expands to <code>1</code> if <code>X <= Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LESS_EQUAL(X,Y) BOOST_PP_LESS_EQUAL_D(0,X,Y)
|
||||
|
||||
@ -29,6 +30,6 @@
|
||||
#define BOOST_PP_LESS_EQUAL_D(D,X,Y) BOOST_PP_NOT(BOOST_PP_SUB_D(D,X,Y))
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_LESS_EQUAL().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_LESS_EQUAL().</p> */
|
||||
#define BOOST_PREPROCESSOR_LESS_EQUAL(X,Y) BOOST_PP_LESS_EQUAL(X,Y)
|
||||
#endif
|
||||
|
@ -17,12 +17,13 @@
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/logical/bool.hpp>
|
||||
|
||||
/** <P>Expands to 1 if X!=Y and 0 otherwise.</P>
|
||||
/** <p>Expands to <code>1</code> if <code>X != Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_NOT_EQUAL(X,Y) BOOST_PP_NOT_EQUAL_D(0,X,Y)
|
||||
|
||||
@ -30,6 +31,6 @@
|
||||
#define BOOST_PP_NOT_EQUAL_D(D,X,Y) BOOST_PP_BOOL(BOOST_PP_ADD_D(D,BOOST_PP_SUB_D(D,X,Y),BOOST_PP_SUB_D(D,Y,X)))
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_NOT_EQUAL().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_NOT_EQUAL().</p> */
|
||||
#define BOOST_PREPROCESSOR_NOT_EQUAL(X,Y) BOOST_PP_NOT_EQUAL(X,Y)
|
||||
#endif
|
||||
|
@ -13,14 +13,15 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Decrements X expanding to a single token.</P>
|
||||
/** <p>Decrements <code>X</code> expanding to a single token.</p>
|
||||
|
||||
<P>For example, BOOST_PP_DEC(3) expands to 2 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_DEC(3)</code> expands to <code>2</code> (a
|
||||
single token).</p>
|
||||
|
||||
<P>BOOST_PP_DEC() uses saturation arithmetic. Decrementing 0 yeilds a 0.</P>
|
||||
<p>BOOST_PP_DEC() uses saturation arithmetic. Decrementing 0 yeilds a 0.</p>
|
||||
|
||||
<P>Only decimal integer literals in the range [0,BOOST_PP_LIMIT_MAG] are
|
||||
supported.</P>
|
||||
<p>Only decimal integer literals in the range [0,BOOST_PP_LIMIT_MAG] are
|
||||
supported.</p>
|
||||
*/
|
||||
#define BOOST_PP_DEC(X) BOOST_PP_DEC_DELAY(X)
|
||||
|
||||
@ -157,6 +158,6 @@ supported.</P>
|
||||
#define BOOST_PP_DEC128 127
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_DEC().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_DEC().</p> */
|
||||
#define BOOST_PREPROCESSOR_DEC(X) BOOST_PP_DEC(X)
|
||||
#endif
|
||||
|
@ -13,60 +13,15 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Expands to nothing. Used with BOOST_PP_IF() and as an unused parameter.</P>
|
||||
/** <p>Expands to nothing. Used with BOOST_PP_IF() and as an unused parameter.</p>
|
||||
|
||||
<P>Example usage as the implementation of BOOST_PP_COMMA_IF(C):</P>
|
||||
|
||||
<PRE>
|
||||
#define BOOST_PP_COMMA_IF(C)\
|
||||
BOOST_PP_IF(C,BOOST_PP_COMMA,BOOST_PP_EMPTY)()
|
||||
</PRE>
|
||||
|
||||
<P>Example usage as an unused macro parameter:</P>
|
||||
|
||||
<PRE>
|
||||
#define BOOST_PP_DEF(CV)\
|
||||
template<class base>\
|
||||
CV() typename implement_subscript_using_begin_subscript<base>::value_type&\
|
||||
implement_subscript_using_begin_subscript<base>::operator[]\
|
||||
( index_type\
|
||||
i\
|
||||
) CV()\
|
||||
{ return base::begin()[i];\
|
||||
}
|
||||
|
||||
BOOST_PP_DEF(BOOST_PP_EMPTY)
|
||||
BOOST_PP_DEF(const BOOST_PP_EMPTY)
|
||||
#undef BOOST_PP_DEF
|
||||
</PRE>
|
||||
|
||||
<P>The above expands to:</P>
|
||||
|
||||
<PRE>
|
||||
template<class base>
|
||||
typename implement_subscript_using_begin_subscript<base>::value_type&
|
||||
implement_subscript_using_begin_subscript<base>::operator[]
|
||||
( index_type
|
||||
i
|
||||
)
|
||||
{ return base::begin()[i];
|
||||
}
|
||||
|
||||
template<class base>
|
||||
const typename implement_subscript_using_begin_subscript<base>::value_type&
|
||||
implement_subscript_using_begin_subscript<base>::operator[]
|
||||
( index_type
|
||||
i
|
||||
) const
|
||||
{ return base::begin()[i];
|
||||
}
|
||||
</PRE>
|
||||
|
||||
<P>In case you wonder, the above code is part of a generalized layer for
|
||||
implementing the subscripting operators of a random access container.</P>
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/subscript_layer.cpp">subscript_layer.cpp</a></li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_EMPTY()
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_EMPTY().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_EMPTY().</p> */
|
||||
#define BOOST_PREPROCESSOR_EMPTY()
|
||||
#endif
|
||||
|
@ -17,18 +17,18 @@
|
||||
#include <boost/preprocessor/repeat.hpp>
|
||||
#include <boost/preprocessor/tuple.hpp>
|
||||
|
||||
/** <P>Generates a comma separated list.</P>
|
||||
/** <p>Generates a comma separated list.</p>
|
||||
|
||||
<P>In other words, expands to the sequence:</P>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<PRE>
|
||||
F(0,P), F(1,P), ..., F(N-1,P)
|
||||
</PRE>
|
||||
<pre>
|
||||
F(0,P), F(1,P), ..., F(BOOST_PP_DEC(N),P)
|
||||
</pre>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_REPEAT()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_ENUM(N,F,P) BOOST_PP_REPEAT(N,BOOST_PP_ENUM_F,(F,P))
|
||||
|
||||
|
@ -16,18 +16,18 @@
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/enum.hpp>
|
||||
|
||||
/** <P>Generates a comma separated list of parameters.</P>
|
||||
/** <p>Generates a comma separated list of parameters.</p>
|
||||
|
||||
<P>In other words, expands to the sequence:</P>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<PRE>
|
||||
P##0, P##1, ..., P##N-1
|
||||
</PRE>
|
||||
<pre>
|
||||
BOOST_PP_CAT(P,0), BOOST_PP_CAT(P,1), ..., BOOST_PP_CAT(P,BOOST_PP_DEC(N))
|
||||
</pre>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_REPEAT()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_ENUM_PARAMS(N,P) BOOST_PP_ENUM(N,BOOST_PP_ENUM_PARAMS_F,P)
|
||||
|
||||
@ -35,6 +35,6 @@
|
||||
#define BOOST_PP_ENUM_PARAMS_F(I,P) BOOST_PP_CAT(P,I)
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_ENUM_PARAMS().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_ENUM_PARAMS().</p> */
|
||||
#define BOOST_PREPROCESSOR_ENUM_PARAMS(N,P) BOOST_PP_ENUM_PARAMS(N,P)
|
||||
#endif
|
||||
|
@ -16,18 +16,18 @@
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/enum.hpp>
|
||||
|
||||
/** <P>Generates a comma separated list of parameters with a default.</P>
|
||||
/** <p>Generates a comma separated list of parameters with a default.</p>
|
||||
|
||||
<P>In other words, expands to the sequence:</P>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<PRE>
|
||||
P##0 = D, P##1 = D, ..., P##N-1 = D
|
||||
</PRE>
|
||||
<pre>
|
||||
BOOST_PP_CAT(P,0) = D, BOOST_PP_CAT(P,1) = D, ..., BOOST_PP_CAT(P,BOOST_PP_DEC(N)) = D
|
||||
</pre>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_REPEAT()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(N,P,D) BOOST_PP_ENUM(N,BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT_F,(P,D))
|
||||
|
||||
@ -39,6 +39,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT().</p> */
|
||||
#define BOOST_PREPROCESSOR_ENUM_PARAMS_WITH_A_DEFAULT(N,P,D) BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(N,P,D)
|
||||
#endif
|
||||
|
@ -16,18 +16,21 @@
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/enum.hpp>
|
||||
|
||||
/** <P>Generates a comma separated list of parameters with defaults.</P>
|
||||
/** <p>Generates a comma separated list of parameters with defaults.</p>
|
||||
|
||||
<P>In other words, expands to the sequence:</P>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<PRE>
|
||||
P##0 = D##0, P##1 = D##1, ..., P##N-1 = D##N-1
|
||||
</PRE>
|
||||
<pre>
|
||||
BOOST_PP_CAT(P,0) = BOOST_PP_CAT(D,0),
|
||||
BOOST_PP_CAT(P,1) = BOOST_PP_CAT(D,1),
|
||||
...,
|
||||
BOOST_PP_CAT(P,BOOST_PP_DEC(N)) = BOOST_PP_CAT(D,BOOST_PP_DEC(N))
|
||||
</pre>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_REPEAT()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS(N,P,D) BOOST_PP_ENUM(N,BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS_F,(P,D))
|
||||
|
||||
@ -39,6 +42,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS().</p> */
|
||||
#define BOOST_PREPROCESSOR_ENUM_PARAMS_WITH_DEFAULTS(N,P,D) BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS(N,P,D)
|
||||
#endif
|
||||
|
@ -17,18 +17,18 @@
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/preprocessor/inc.hpp>
|
||||
|
||||
/** <P>Generates a comma separated shifted list.</P>
|
||||
/** <p>Generates a comma separated shifted list.</p>
|
||||
|
||||
<P>In other words, expands to the sequence:</P>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<PRE>
|
||||
F(1,P), F(2,P), ..., F(N-1,P)
|
||||
</PRE>
|
||||
<pre>
|
||||
F(1,P), F(2,P), ..., F(BOOST_PP_DEC(N),P)
|
||||
</pre>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_REPEAT()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_ENUM_SHIFTED(N,F,P) BOOST_PP_ENUM(BOOST_PP_DEC(N),BOOST_PP_ENUM_SHIFTED_F,(F,P))
|
||||
|
||||
|
@ -16,24 +16,24 @@
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/enum_shifted.hpp>
|
||||
|
||||
/** <P>Generates a comma separated list of shifted actual parameters.</P>
|
||||
/** <p>Generates a comma separated list of shifted actual parameters.</p>
|
||||
|
||||
<P>In other words, expands to the sequence:</P>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<PRE>
|
||||
P##1, P##2, ..., P##N-1
|
||||
</PRE>
|
||||
<pre>
|
||||
BOOST_PP_CAT(P,1), BOOST_PP_CAT(P,2), ..., BOOST_PP_CAT(P,BOOST_PP_DEC(N))
|
||||
</pre>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_REPEAT()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
</ul>
|
||||
|
||||
<H3>Rationale</H3>
|
||||
<UL>
|
||||
<LI>This macro facilitates a typical usage of the library. Shifted parameter
|
||||
lists are common in template metaprograms.
|
||||
</UL>
|
||||
<h3>Rationale</h3>
|
||||
<ul>
|
||||
<li>This macro facilitates a typical usage of the library. Shifted parameter
|
||||
lists are common in template metaprograms.</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_ENUM_SHIFTED_PARAMS(N,P) BOOST_PP_ENUM_SHIFTED(N,BOOST_PP_ENUM_SHIFTED_PARAMS_F,P)
|
||||
|
||||
@ -41,6 +41,6 @@
|
||||
#define BOOST_PP_ENUM_SHIFTED_PARAMS_F(I,P) BOOST_PP_CAT(P,I)
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_ENUM_SHIFTED_PARAMS().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_ENUM_SHIFTED_PARAMS().</p> */
|
||||
#define BOOST_PREPROCESSOR_ENUM_SHIFTED_PARAMS(N,P) BOOST_PP_ENUM_SHIFTED_PARAMS(N,P)
|
||||
#endif
|
||||
|
@ -15,6 +15,6 @@
|
||||
|
||||
#include <boost/preprocessor/identity.hpp>
|
||||
|
||||
/** <P>Essentially macro expands the parameter X twice.</P> */
|
||||
/** <p>Essentially macro expands the parameter <code>X</code> twice.</p> */
|
||||
#define BOOST_PP_EXPAND(X) X
|
||||
#endif
|
||||
|
@ -16,45 +16,45 @@
|
||||
#include <boost/preprocessor/if.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
|
||||
/** <P>Repeats I(R,X) and iterates F(R,X) while C(R,X) is true.</P>
|
||||
/** <p>Repeats <code>I(R,X)</code> and iterates <code>F(R,X)</code> while
|
||||
<code>C(R,X)</code> is true.</p>
|
||||
|
||||
<P>In other words, expands to the sequence:</P>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
I(R,X) I(R,F(R,X)) I(R,F(R,F(R,X))) ... I(R,F(R,F(...F(R,X)...)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>The length of the sequence is determined by C(R,X).</P>
|
||||
<p>The length of the sequence is determined by <code>C(R,X)</code>.</p>
|
||||
|
||||
<H3>Legend</H3>
|
||||
<UL>
|
||||
<LI><B>X</B> is the current state of iteration. The state is usually a tuple.
|
||||
<LI><B>C</B> is the condition for iteration. It must expand to a decimal
|
||||
integer literal.
|
||||
<LI><B>F</B> is the iterated macro. Note that if the state is a tuple, then
|
||||
F(R,X) usually expands to a tuple of the same number of elements.
|
||||
<LI><B>I</B> is the state instantiation macro.
|
||||
<LI><B>R</B> is the recursion depth and should only be used as a parameter to
|
||||
<h3>Legend</h3>
|
||||
<ul>
|
||||
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
||||
<li><b>C</b> is the condition for iteration. It must expand to a decimal
|
||||
integer literal.</li>
|
||||
<li><b>F</b> is the iterated macro. Note that if the state is a tuple, then
|
||||
F(R,X) usually expands to a tuple of the same number of elements.</li>
|
||||
<li><b>I</b> is the state instantiation macro.</li>
|
||||
<li><b>R</b> is the recursion depth and should only be used as a parameter to
|
||||
other macros using BOOST_PP_FOR() or for invoking BOOST_PP_FOR##R()
|
||||
directly. For each macro using BOOST_PP_FOR(), there is a version of the
|
||||
macro, distinguished by the R suffix, that accepts an additional
|
||||
recursion depth as the first parameter. This technique is necessary to
|
||||
avoid recursively expanding the same macro again, which is not permitted
|
||||
by the C++ preprocessor.
|
||||
</UL>
|
||||
by the C++ preprocessor.</li>
|
||||
</ul>
|
||||
|
||||
<H3>BOOST_PP_REPEAT() vs BOOST_PP_FOR()</H3>
|
||||
<h3>BOOST_PP_REPEAT() vs BOOST_PP_FOR()</h3>
|
||||
|
||||
<P>BOOST_PP_FOR() is a generalization of BOOST_PP_REPEAT(). This means that
|
||||
BOOST_PP_REPEAT() can be implemented using BOOST_PP_FOR(). Unfortunately,
|
||||
BOOST_PP_FOR() is slower than BOOST_PP_REPEAT(). In addition,
|
||||
<p>BOOST_PP_FOR() is a generalization of BOOST_PP_REPEAT(). This means that
|
||||
BOOST_PP_REPEAT() can be implemented using BOOST_PP_FOR(). However,
|
||||
BOOST_PP_REPEAT() was introduced earlier, is generally easier to use, and is
|
||||
still quite useful on its own.</P>
|
||||
still quite useful on its own.</p>
|
||||
|
||||
<H3>2D and 3D repetition</H3>
|
||||
<h3>2D and 3D repetition</h3>
|
||||
|
||||
<P>BOOST_PP_FOR() can be used for multidimensional repetition simply by
|
||||
invoking BOOST_PP_FOR##R() directly.</P>
|
||||
<p>BOOST_PP_FOR() can be used for multidimensional repetition simply by
|
||||
invoking BOOST_PP_FOR##R() directly.</p>
|
||||
*/
|
||||
#define BOOST_PP_FOR(X,C,F,I) BOOST_PP_FOR0(X,C,F,I)
|
||||
|
||||
|
@ -15,28 +15,25 @@
|
||||
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
|
||||
/** <P>Expands to X once invoked.</P>
|
||||
/** <p>Expands to <code>X</code> once invoked.</p>
|
||||
|
||||
<P>Designed to be used with BOOST_PP_IF(), when one of the clauses need to be
|
||||
invoked.</P>
|
||||
<p>Designed to be used with BOOST_PP_IF(), when one of the clauses need to be
|
||||
invoked.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
BOOST_PP_IDENTITY(X)<B>()</B>
|
||||
</PRE>
|
||||
<pre>
|
||||
BOOST_PP_IF(1,BOOST_PP_IDENTITY(X),BOOST_PP_EMPTY)<b>()</b>
|
||||
</pre>
|
||||
|
||||
<P>expands to:</P>
|
||||
<p>expands to:</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
X
|
||||
</PRE>
|
||||
|
||||
<P>NOTE: If BOOST_PP_IDENTITY() is not invoked, the expansion will not be
|
||||
usable.</P>
|
||||
</pre>
|
||||
*/
|
||||
#define BOOST_PP_IDENTITY(X) X BOOST_PP_EMPTY
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_IDENTITY().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_IDENTITY().</p> */
|
||||
#define BOOST_PREPROCESSOR_IDENTITY(X) BOOST_PP_IDENTITY(X)
|
||||
#endif
|
||||
|
@ -16,10 +16,11 @@
|
||||
#include <boost/preprocessor/logical/bool.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
|
||||
/** <P>Expands to T if C != 0 and E if C == 0.</P>
|
||||
/** <p>Expands to <code>T</code> if <code>C != 0</code> and <code>E</code> if
|
||||
<code>C == 0</code>.</p>
|
||||
|
||||
<P>BOOST_PP_IF() enables convenient generation of lists using
|
||||
BOOST_PP_REPEAT().</P>
|
||||
<p>BOOST_PP_IF() enables convenient generation of lists using
|
||||
BOOST_PP_REPEAT().</p>
|
||||
*/
|
||||
#define BOOST_PP_IF(C,T,E) BOOST_PP_IF_BOOL(BOOST_PP_BOOL(C))(E,T)
|
||||
|
||||
@ -28,6 +29,6 @@ BOOST_PP_REPEAT().</P>
|
||||
#define BOOST_PP_IF_BOOL_DELAY(C) BOOST_PP_TUPLE2_ELEM##C
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_IF().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_IF().</p> */
|
||||
#define BOOST_PREPROCESSOR_IF(C,T,E) BOOST_PP_IF(C,T,E)
|
||||
#endif
|
||||
|
@ -13,15 +13,16 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Increments X expanding to a single token.</P>
|
||||
/** <p>Increments <code>X</code> expanding to a single token.</p>
|
||||
|
||||
<P>For example, BOOST_PP_INC(3) expands to 4 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_INC(3)</code> expands to <code>4</code> (a
|
||||
single token).</p>
|
||||
|
||||
<P>BOOST_PP_INC() uses saturation arithmetic. Incrementing a
|
||||
BOOST_PP_LIMIT_MAG yields a BOOST_PP_LIMIT_MAG.</P>
|
||||
<p>BOOST_PP_INC() uses saturation arithmetic. Incrementing a
|
||||
BOOST_PP_LIMIT_MAG yields a BOOST_PP_LIMIT_MAG.</p>
|
||||
|
||||
<P>Only decimal integer literals in the range [0,BOOST_PP_LIMIT_MAG] are
|
||||
supported.</P>
|
||||
<p>Only decimal integer literals in the range [0,BOOST_PP_LIMIT_MAG] are
|
||||
supported.</p>
|
||||
*/
|
||||
#define BOOST_PP_INC(X) BOOST_PP_INC_DELAY(X)
|
||||
|
||||
@ -158,6 +159,6 @@ supported.</P>
|
||||
#define BOOST_PP_INC128 128
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_INC().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_INC().</p> */
|
||||
#define BOOST_PREPROCESSOR_INC(X) BOOST_PP_INC(X)
|
||||
#endif
|
||||
|
@ -13,40 +13,41 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Expands to the number of dimensions of repeat supported by the
|
||||
library.</P>
|
||||
/** <p>Expands to the number of dimensions of repeat supported by the
|
||||
library.</p>
|
||||
|
||||
<P>The repeat macros are named BOOST_PP_REPEAT(), BOOST_PP_REPEAT_2ND(),
|
||||
BOOST_PP_REPEAT_3RD(), ...</P>
|
||||
<p>The repeat macros are named BOOST_PP_REPEAT(), BOOST_PP_REPEAT_2ND(),
|
||||
BOOST_PP_REPEAT_3RD(), ...</p>
|
||||
*/
|
||||
#define BOOST_PP_LIMIT_DIM 3
|
||||
|
||||
/** <P>Expands to the maximum straight numeric literal supported by the
|
||||
library.</P>
|
||||
/** <p>Expands to the maximum straight numeric literal supported by the
|
||||
library.</p>
|
||||
|
||||
<P>This is also the limit of the repetition primitives (BOOST_PP_ENUM family
|
||||
and BOOST_PP_REPEAT family).</P>
|
||||
<p>This is also the limit of the repetition primitives (BOOST_PP_ENUM family
|
||||
and BOOST_PP_REPEAT family).</p>
|
||||
|
||||
<P>NOTES:</P>
|
||||
<UL>
|
||||
<LI>Only decimal integer literals in the range [0,BOOST_PP_LIMIT_MAG]
|
||||
are supported.
|
||||
<LI>All arithmetic operations (ADD,SUB,MUL,DIV) use saturation arithmetic.
|
||||
<LI>The maximum repetition count supported by the library may not be reached
|
||||
due to compiler limitations.
|
||||
</UL>
|
||||
<h3>Note</h3>
|
||||
<ul>
|
||||
<li>Only decimal integer literals in the range [0, BOOST_PP_LIMIT_MAG]
|
||||
are supported.</li>
|
||||
<li>All arithmetic operations (BOOST_PP_ADD(), BOOST_PP_SUB(),
|
||||
BOOST_PP_MUL(), BOOST_PP_DIV()) use saturation arithmetic.</li>
|
||||
<li>The maximum repetition count supported by the library may not be reached
|
||||
due to compiler limitations.</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIMIT_MAG 128
|
||||
|
||||
/** <P>Expands to the maximum tuple length supported by the library.</P> */
|
||||
/** <p>Expands to the maximum tuple length supported by the library.</p> */
|
||||
#define BOOST_PP_LIMIT_TUPLE 16
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_LIMIT_DIM.</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_LIMIT_DIM.</p> */
|
||||
#define BOOST_PREPROCESSOR_LIMIT_DIM BOOST_PP_LIMIT_DIM
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_LIMIT_MAG.</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_LIMIT_MAG.</p> */
|
||||
#define BOOST_PREPROCESSOR_LIMIT_MAG BOOST_PP_LIMIT_MAG
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_LIMIT_TUPLE.</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_LIMIT_TUPLE.</p> */
|
||||
#define BOOST_PREPROCESSOR_LIMIT_TUPLE BOOST_PP_LIMIT_TUPLE
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Includes all list headers.</P> */
|
||||
/** <p>Includes all list headers.</p> */
|
||||
|
||||
#include <boost/preprocessor/list/append.hpp>
|
||||
#include <boost/preprocessor/list/at.hpp>
|
||||
|
@ -13,69 +13,71 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>This header defines the fundamental list operations.</P>
|
||||
/** <p>This header defines the fundamental list operations.</p>
|
||||
|
||||
<H3>Note</H3>
|
||||
<UL>
|
||||
<LI>The internal representation of lists is hidden. Although there aren't
|
||||
<h3>Note</h3>
|
||||
<ul>
|
||||
<li>The internal representation of lists is hidden. Although there aren't
|
||||
compelling reasons to change the representation, you should avoid
|
||||
writing code that depends on the internal representation details.</P>
|
||||
</UL>
|
||||
writing code that depends on the internal representation details.</li>
|
||||
</ul>
|
||||
*/
|
||||
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/logical/not.hpp>
|
||||
|
||||
/** <P>List constructor.</P>
|
||||
/** <p>List constructor.</p>
|
||||
|
||||
<P>Lists are build using list constructors BOOST_PP_LIST_NIL and
|
||||
BOOST_PP_LIST_CONS(). For example,</P>
|
||||
<p>Lists are build using list constructors BOOST_PP_LIST_NIL and
|
||||
BOOST_PP_LIST_CONS(). For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_CONS(1,
|
||||
BOOST_PP_LIST_CONS(2,
|
||||
BOOST_PP_LIST_CONS(3,
|
||||
BOOST_PP_LIST_CONS(4,
|
||||
BOOST_PP_LIST_CONS(5,
|
||||
BOOST_PP_LIST_NIL)))))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>Short lists can also be build from tuples:</P>
|
||||
<p>Short lists can also be build from tuples:</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(5,(1,2,3,4,5))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>Both of the above lists contain 5 elements: 1, 2, 3, 4 and 5.</P>
|
||||
<p>Both of the above lists contain 5 elements: 1, 2, 3, 4 and 5.</p>
|
||||
|
||||
<p>Longer lists can be built with the help of BOOST_PP_LIST_APPEND().</p>
|
||||
*/
|
||||
#define BOOST_PP_LIST_CONS(H,T) (H,T,1)
|
||||
|
||||
/** <P>List nil constructor.</P> */
|
||||
/** <p>List nil constructor.</p> */
|
||||
#define BOOST_PP_LIST_NIL (_,_,0)
|
||||
|
||||
/** <P>Expands to 1 if the list is not nil and 0 otherwise.</P> */
|
||||
/** <p>Expands to 1 if the list is not nil and 0 otherwise.</p> */
|
||||
#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406
|
||||
# define BOOST_PP_LIST_IS_CONS(L) BOOST_PP_TUPLE_ELEM(3,2,L)
|
||||
#else
|
||||
# define BOOST_PP_LIST_IS_CONS(L) BOOST_PP_TUPLE3_ELEM2 L
|
||||
#endif
|
||||
|
||||
/** <P>Expands to 1 if the list is nil and 0 otherwise.</P> */
|
||||
/** <p>Expands to 1 if the list is nil and 0 otherwise.</p> */
|
||||
#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406
|
||||
# define BOOST_PP_LIST_IS_NIL(L) BOOST_PP_NOT(BOOST_PP_TUPLE_ELEM(3,2,L))
|
||||
#else
|
||||
# define BOOST_PP_LIST_IS_NIL(L) BOOST_PP_NOT(BOOST_PP_TUPLE3_ELEM2 L)
|
||||
#endif
|
||||
|
||||
/** <P>Expands to the first element of the list. The list must not be nil.</P>
|
||||
/** <p>Expands to the first element of the list. The list must not be nil.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_FIRST(BOOST_PP_TUPLE_TO_LIST(5,(1,2,3,4,5)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to 1.</P>
|
||||
<p>expands to 1.</p>
|
||||
*/
|
||||
#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406
|
||||
# define BOOST_PP_LIST_FIRST(L) BOOST_PP_TUPLE_ELEM(3,0,L)
|
||||
@ -83,15 +85,21 @@ BOOST_PP_LIST_CONS(). For example,</P>
|
||||
# define BOOST_PP_LIST_FIRST(L) BOOST_PP_TUPLE3_ELEM0 L
|
||||
#endif
|
||||
|
||||
/** <P>Expands to a list of all but the first element of the list. The list must not be nil.</P>
|
||||
/** <p>Expands to a list of all but the first element of the list.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>The list must not be nil.</p>
|
||||
|
||||
<PRE>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_REST(BOOST_PP_TUPLE_TO_LIST(5,(1,2,3,4,5)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to a list containing 2, 3, 4 and 5.</P>
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(4,(2,3,4,5))
|
||||
</pre>
|
||||
*/
|
||||
#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406
|
||||
# define BOOST_PP_LIST_REST(L) BOOST_PP_TUPLE_ELEM(3,1,L)
|
||||
|
@ -15,23 +15,27 @@
|
||||
|
||||
#include <boost/preprocessor/list/fold_right.hpp>
|
||||
|
||||
/** <P>Catenates two lists together.</P>
|
||||
/** <p>Catenates two lists together.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_APPEND
|
||||
( BOOST_PP_TUPLE_TO_LIST(2,(1,2))
|
||||
, BOOST_PP_TUPLE_TO_LIST(2,(3,4))
|
||||
)
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>produces a list containing 1, 2, 3 and 4.</P>
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(4,(1,2,3,4))
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOLD_RIGHT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_APPEND(L,P) BOOST_PP_LIST_APPEND_D(0,L,P)
|
||||
|
||||
|
@ -15,20 +15,21 @@
|
||||
|
||||
#include <boost/preprocessor/list/rest_n.hpp>
|
||||
|
||||
/** <P>Expands to the I:th element of the list L. The first element is at index 0.</P>
|
||||
/** <p>Expands to the <code>I</code>:th element of the list <code>L</code>. The
|
||||
first element is at index <code>0</code>.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)),1)
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to B.</P>
|
||||
<p>expands to <code>B</code>.</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_AT(L,I) BOOST_PP_LIST_AT_D(0,L,I)
|
||||
|
||||
|
@ -16,20 +16,24 @@
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/list/fold_left.hpp>
|
||||
|
||||
/** <P>Catenates all elements of the list.</P>
|
||||
/** <p>Catenates all elements of the list.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_CAT(BOOST_PP_TUPLE_TO_LIST(3,(1,2,3)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to 123.</P>
|
||||
<p>expands to:</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<pre>
|
||||
123
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOLD_LEFT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_CAT(L) BOOST_PP_LIST_CAT_D(0,L)
|
||||
|
||||
|
@ -16,24 +16,24 @@
|
||||
#include <boost/preprocessor/comma_if.hpp>
|
||||
#include <boost/preprocessor/list/for_each.hpp>
|
||||
|
||||
/** <P>Converts the list to a comma separated list.</P>
|
||||
/** <p>Converts the list to a comma separated list.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_ENUM(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to:</P>
|
||||
<p>expands to:</p>
|
||||
|
||||
<PRE>
|
||||
A, B, C
|
||||
</PRE>
|
||||
<pre>
|
||||
A,B,C
|
||||
</pre>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_FOR()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOR_EACH()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_ENUM(L) BOOST_PP_LIST_ENUM_R(0,L)
|
||||
|
||||
|
@ -15,20 +15,25 @@
|
||||
|
||||
#include <boost/preprocessor/list/fold_right.hpp>
|
||||
|
||||
/** <P>Expands to a list containing all the elements X of the list for which F(D,P,X) is true.</P>
|
||||
/** <p>Expands to a list containing all the elements <code>X</code> of the list
|
||||
for which <code>F(D,P,X)</code> is true.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_FILTER(BOOST_PP_NOT_EQUAL_D,2,BOOST_PP_TUPLE_TO_LIST(3,(1,2,3)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to a list containing 1 and 3.</P>
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(1,3))
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOLD_RIGHT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_FILTER(F,P,L) BOOST_PP_LIST_FILTER_D(0,F,P,L)
|
||||
|
||||
|
@ -17,20 +17,30 @@
|
||||
#include <boost/preprocessor/list/adt.hpp>
|
||||
#include <boost/preprocessor/while.hpp>
|
||||
|
||||
/** <P>Expands to a list of the first N elements of the list.</P>
|
||||
/** <p>Expands to a list of the first <code>N</code> elements of the list
|
||||
<code>L</code>.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_FIRST_N(2,BOOST_PP_TUPLE_TO_LIST(4,(+,-,*,/)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to a list containing + and -.</P>
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(+,-))
|
||||
</pre>
|
||||
|
||||
<h3>See</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_REST_N()</li>
|
||||
</ul>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOLD_LEFT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_FIRST_N(N,L) BOOST_PP_LIST_FIRST_N_D(0,N,L)
|
||||
|
||||
|
@ -16,39 +16,34 @@
|
||||
#include <boost/preprocessor/list/adt.hpp>
|
||||
#include <boost/preprocessor/while.hpp>
|
||||
|
||||
/** <P>Iterates F(D,P,X) for each element X of the list L (from the left or the start of the list).</P>
|
||||
/** <p>Iterates <code>F(D,P,X)</code> for each element <code>X</code> of the
|
||||
list <code>L</code> (from the left or the start of the list).</p>
|
||||
|
||||
<P>In other words,</P>
|
||||
<p>In other words, expands to:</p>
|
||||
|
||||
<PRE>
|
||||
BOOST_PP_LIST_FOLD_LEFT(F,P,L)
|
||||
</PRE>
|
||||
|
||||
<P>expands to:</P>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
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))
|
||||
)
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<H3>Note</H3>
|
||||
<UL>
|
||||
<LI>Folding, or accumulation, is a very general pattern of computation.
|
||||
Most list operations can be implemented in terms of folding.
|
||||
</UL>
|
||||
<h3>Note</h3>
|
||||
<ul>
|
||||
<li>Folding, or accumulation, is a very general pattern of computation.
|
||||
Most list operations can be implemented in terms of folding.</li>
|
||||
</ul>
|
||||
|
||||
<H3>See</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_LIST_FOLD_RIGHT()
|
||||
</UL>
|
||||
<h3>See</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOLD_RIGHT()</li>
|
||||
</ul>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_FOLD_LEFT(F,P,L) BOOST_PP_LIST_FOLD_LEFT_D(0,F,P,L)
|
||||
|
||||
|
@ -15,17 +15,12 @@
|
||||
|
||||
#include <boost/preprocessor/list/reverse.hpp>
|
||||
|
||||
/** <P>Iterates F(D,X,P) for each element X of the list L (from the right or the end of the list).</P>
|
||||
/** <p>Iterates <code>F(D,X,P)</code> for each element <code>X</code> of the
|
||||
list <code>L</code> (from the right or the end of the list).</p>
|
||||
|
||||
<P>In other words,</P>
|
||||
<p>In other words, expands to:</p>
|
||||
|
||||
<PRE>
|
||||
BOOST_PP_LIST_FOLD_RIGHT(F,L,P)
|
||||
</PRE>
|
||||
|
||||
<P>expands to:</P>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
F
|
||||
( D
|
||||
, BOOST_PP_LIST_AT(L,0)
|
||||
@ -39,17 +34,12 @@
|
||||
)
|
||||
) ...
|
||||
)
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<H3>See</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_LIST_FOLD_LEFT()
|
||||
</UL>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOLD_LEFT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_FOLD_RIGHT(F,L,P) BOOST_PP_LIST_FOLD_RIGHT_D(0,F,L,P)
|
||||
|
||||
|
@ -16,26 +16,27 @@
|
||||
#include <boost/preprocessor/list/adt.hpp>
|
||||
#include <boost/preprocessor/for.hpp>
|
||||
|
||||
/** <P>Repeats F(R,P,BOOST_PP_LIST_AT(L,I)) for each I = [0,BOOST_PP_LIST_SIZE(L)[.</P>
|
||||
/** <p>Repeats <code>F(R,P,BOOST_PP_LIST_AT(L,I))</code> for each I = [0,
|
||||
BOOST_PP_LIST_SIZE(L)[.</p>
|
||||
|
||||
<P>In other words, expands to the sequence:</P>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
F(R,P,BOOST_PP_LIST_AT(L,0))
|
||||
F(R,P,BOOST_PP_LIST_AT(L,1))
|
||||
...
|
||||
F(R,P,BOOST_PP_LIST_AT(L,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(L))))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<H3>Example</H3>
|
||||
<UL>
|
||||
<LI><a href="../../example/catch_builtin.cpp">catch_builtin.cpp</a>
|
||||
</UL>
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/catch_builtin.cpp">catch_builtin.cpp</a></li>
|
||||
</ul>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_FOR()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_FOR()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_FOR_EACH(F,P,L) BOOST_PP_LIST_FOR_EACH_R(0,F,P,L)
|
||||
|
||||
|
@ -16,29 +16,31 @@
|
||||
#include <boost/preprocessor/list/adt.hpp>
|
||||
#include <boost/preprocessor/for.hpp>
|
||||
|
||||
/** <H3>THIS IS NOT YET FULLY DOCUMENTED - DO NOT USE!</H3>
|
||||
/** <h3>THIS IS NOT YET FULLY DOCUMENTED - DO NOT USE!</h3>
|
||||
|
||||
<P>Repeats F(R,P,X) for each element X of the cartesian product of the lists LL.</P>
|
||||
<p>Repeats <code>F(R,P,X)</code> for each element <code>X</code> of the
|
||||
cartesian product of the lists <code>LL</code>.</p>
|
||||
|
||||
<P>This macro is useful for generating code to avoid combinatorial explosion.</P>
|
||||
<p>This macro is useful for generating code to avoid combinatorial
|
||||
explosion.</p>
|
||||
|
||||
<H3>Legend</H3>
|
||||
<UL>
|
||||
<LI><B>LL</B> is a list of lists.
|
||||
<LI><B>X</B> is a list of the elements of an element of the cartesian product of
|
||||
the lists LL.
|
||||
</UL>
|
||||
<h3>Legend</h3>
|
||||
<ul>
|
||||
<li><b>LL</b> is a list of lists.</li>
|
||||
<li><b>X</b> is a list of the elements of an element of the cartesian product
|
||||
of the lists LL.</li>
|
||||
</ul>
|
||||
|
||||
<H3>Example</H3>
|
||||
<UL>
|
||||
<LI><a href="../../example/is_integral.cpp">is_integral.cpp</a>
|
||||
<LI><a href="../../example/array_arithmetic.c">array_arithmetic.c</a>
|
||||
</UL>
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/is_integral.cpp">is_integral.cpp</a></li>
|
||||
<li><a href="../../example/array_arithmetic.c">array_arithmetic.c</a></li>
|
||||
</ul>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_FOR()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_FOR()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_FOR_EACH_PRODUCT(F,P,LL) BOOST_PP_LIST_FOR_EACH_PRODUCT_R(0,F,P,LL)
|
||||
|
||||
|
@ -17,20 +17,30 @@
|
||||
#include <boost/preprocessor/list/adt.hpp>
|
||||
#include <boost/preprocessor/while.hpp>
|
||||
|
||||
/** <P>Expands to a list of all but the first N elements of the list.</P>
|
||||
/** <p>Expands to a list of all but the first <code>N</code> elements of the
|
||||
list <code>L</code>.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_REST_N(2,BOOST_PP_TUPLE_TO_LIST(4,(+,-,*,/)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to a list containing * and /.</P>
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(*,/))
|
||||
</pre>
|
||||
|
||||
<h3>See</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FIRST_N()</li>
|
||||
</ul>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_REST_N(N,L) BOOST_PP_LIST_REST_N_D(0,N,L)
|
||||
|
||||
|
@ -15,20 +15,24 @@
|
||||
|
||||
#include <boost/preprocessor/list/fold_left.hpp>
|
||||
|
||||
/** <P>List reversal.</P>
|
||||
/** <p>List reversal.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_REVERSE(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to a list containing C, B and A.</P>
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(3,(C,B,A))
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOLD_LEFT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_REVERSE(L) BOOST_PP_LIST_REVERSE_D(0,L)
|
||||
|
||||
|
@ -16,20 +16,20 @@
|
||||
#include <boost/preprocessor/list/fold_left.hpp>
|
||||
#include <boost/preprocessor/inc.hpp>
|
||||
|
||||
/** <P>Expands to the number of elements in the list.</P>
|
||||
/** <p>Expands to the number of elements in the list.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to 3.</P>
|
||||
<p>expands to <code>3</code>.</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOLD_LEFT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_SIZE(L) BOOST_PP_LIST_SIZE_D(0,L)
|
||||
|
||||
|
@ -16,26 +16,26 @@
|
||||
#include <boost/preprocessor/comma_if.hpp>
|
||||
#include <boost/preprocessor/list/enum.hpp>
|
||||
|
||||
/** <P>Converts the list to a tuple.</P>
|
||||
/** <p>Converts the list to a tuple.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_TO_TUPLE(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to (A,B,C).</P>
|
||||
<p>expands to <code>(A,B,C)</code>.</p>
|
||||
|
||||
<H3>Note</H3>
|
||||
<UL>
|
||||
<LI>The supported size of the list being converted to a tuple is limited by
|
||||
BOOST_PP_LIMIT_MAG rather than BOOST_PP_LIMIT_TUPLE.</P>
|
||||
</UL>
|
||||
<h3>Note</h3>
|
||||
<ul>
|
||||
<li>The supported size of the list being converted to a tuple is limited by
|
||||
BOOST_PP_LIMIT_MAG rather than BOOST_PP_LIMIT_TUPLE.</li>
|
||||
</ul>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_FOR()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOR_EACH()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_TO_TUPLE(L) BOOST_PP_LIST_TO_TUPLE_R(0,L)
|
||||
|
||||
|
@ -15,30 +15,35 @@
|
||||
|
||||
#include <boost/preprocessor/list/fold_right.hpp>
|
||||
|
||||
/** <P>Applies the macro F(D,P,X) to each element X of the list producing a new list.</P>
|
||||
/** <p>Applies the macro <code>F(D,P,X)</code> to each element <code>X</code>
|
||||
of the list producing a new list.</p>
|
||||
|
||||
<P>In other words, BOOST_PP_LIST_TRANSFORM(F,P,L) expands to same as:</P>
|
||||
<p>In other words, expands to:</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_CONS(F(D,P,BOOST_PP_LIST_AT(L,0)),
|
||||
BOOST_PP_LIST_CONS(F(D,P,BOOST_PP_LIST_AT(L,1)),
|
||||
...
|
||||
BOOST_PP_LIST_CONS(F(D,P,BOOST_PP_LIST_AT(L,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(L)))),
|
||||
BOOST_PP_LIST_NIL) ... ))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D,2,BOOST_PP_TUPLE_TO_LIST(2,(1,2)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to a list containing 3 and 4.</P>
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(3,4))
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIST_FOLD_RIGHT()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_LIST_TRANSFORM(F,P,L) BOOST_PP_LIST_TRANSFORM_D(0,F,P,L)
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Includes all logical headers.</P> */
|
||||
/** <p>Includes all logical headers.</p> */
|
||||
|
||||
#include <boost/preprocessor/logical/or.hpp>
|
||||
#include <boost/preprocessor/logical/xor.hpp>
|
||||
|
@ -15,12 +15,12 @@
|
||||
|
||||
#include <boost/preprocessor/logical/not.hpp>
|
||||
|
||||
/** <P>Expands to the logical AND of the operands.</P>
|
||||
/** <p>Expands to the logical AND of the operands.</p>
|
||||
|
||||
<P>For example, BOOST_PP_AND(0,5) expands to 0 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_AND(0,5)</code> expands to <code>0</code> (a single token).</p>
|
||||
*/
|
||||
#define BOOST_PP_AND(X,Y) BOOST_PP_NOR(BOOST_PP_NOT(X),BOOST_PP_NOT(Y))
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_AND().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_AND().</p> */
|
||||
#define BOOST_PREPROCESSOR_AND(X,Y) BOOST_PP_AND(X,Y)
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Expands to 0 if X == 0 and 1 if X != 0.</P> */
|
||||
/** <p>Expands to <code>0</code> if <code>X == 0</code> and <code>1</code> if <code>X != 0</code>.</p> */
|
||||
#define BOOST_PP_BOOL(X) BOOST_PP_BOOL_DELAY(X)
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
@ -152,6 +152,6 @@
|
||||
#define BOOST_PP_BOOL128 1
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_BOOL().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_BOOL().</p> */
|
||||
#define BOOST_PREPROCESSOR_BOOL(X) BOOST_PP_BOOL(X)
|
||||
#endif
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
#include <boost/preprocessor/logical/bool.hpp>
|
||||
|
||||
/** <P>Expands to the logical NEITHER OR of the operands.</P>
|
||||
/** <p>Expands to the logical NEITHER OR of the operands.</p>
|
||||
|
||||
<P>For example, BOOST_PP_NOR(0,5) expands to 0 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_NOR(0,5)</code> expands to <code>0</code> (a single token).</p>
|
||||
*/
|
||||
#define BOOST_PP_NOR(X,Y) BOOST_PP_NOR_BOOL(BOOST_PP_BOOL(X),BOOST_PP_BOOL(Y))
|
||||
|
||||
@ -30,6 +30,6 @@
|
||||
#define BOOST_PP_NOR_BOOL11 0
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_NOR().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_NOR().</p> */
|
||||
#define BOOST_PREPROCESSOR_NOR(X,Y) BOOST_PP_NOR(X,Y)
|
||||
#endif
|
||||
|
@ -15,12 +15,12 @@
|
||||
|
||||
#include <boost/preprocessor/logical/nor.hpp>
|
||||
|
||||
/** <P>Expands to the logical NOT of the operand.</P>
|
||||
/** <p>Expands to the logical NOT of the operand.</p>
|
||||
|
||||
<P>For example, BOOST_PP_NOT(0) expands to 1 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_NOT(0)</code> expands to <code>1</code> (a single token).</p>
|
||||
*/
|
||||
#define BOOST_PP_NOT(X) BOOST_PP_NOR(X,X)
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_NOT().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_NOT().</p> */
|
||||
#define BOOST_PREPROCESSOR_NOT(X) BOOST_PP_NOT(X)
|
||||
#endif
|
||||
|
@ -15,12 +15,12 @@
|
||||
|
||||
#include <boost/preprocessor/logical/not.hpp>
|
||||
|
||||
/** <P>Expands to the logical OR of the operands.</P>
|
||||
/** <p>Expands to the logical OR of the operands.</p>
|
||||
|
||||
<P>For example, BOOST_PP_OR(0,2) expands to 1 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_OR(0,2)</code> expands to <code>1</code> (a single token).</p>
|
||||
*/
|
||||
#define BOOST_PP_OR(X,Y) BOOST_PP_NOT(BOOST_PP_NOR(X,Y))
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_OR().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_OR().</p> */
|
||||
#define BOOST_PREPROCESSOR_OR(X,Y) BOOST_PP_OR(X,Y)
|
||||
#endif
|
||||
|
@ -15,12 +15,12 @@
|
||||
|
||||
#include <boost/preprocessor/logical/and.hpp>
|
||||
|
||||
/** <P>Expands to the logical EXCLUSIVE OR of the operands.</P>
|
||||
/** <p>Expands to the logical EXCLUSIVE OR of the operands.</p>
|
||||
|
||||
<P>For example, BOOST_PP_XOR(1,2) expands to 0 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_XOR(1,2)</code> expands to <code>0</code> (a single token).</p>
|
||||
*/
|
||||
#define BOOST_PP_XOR(X,Y) BOOST_PP_NOR(BOOST_PP_NOR(X,Y),BOOST_PP_AND(X,Y))
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_XOR().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_XOR().</p> */
|
||||
#define BOOST_PREPROCESSOR_XOR(X,Y) BOOST_PP_XOR(X,Y)
|
||||
#endif
|
||||
|
@ -16,14 +16,15 @@
|
||||
#include <boost/preprocessor/comparison/less_equal.hpp>
|
||||
#include <boost/preprocessor/if.hpp>
|
||||
|
||||
/** <P>Expands to the maximum of X and Y.</P>
|
||||
/** <p>Expands to the maximum of <code>X</code> and <code>Y</code>.</p>
|
||||
|
||||
<P>For example, BOOST_PP_MAX(5,7) expands to 7 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_MAX(5,7)</code> expands to <code>7</code> (a
|
||||
single token).</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_MAX(X,Y) BOOST_PP_MAX_D(0,X,Y)
|
||||
|
||||
@ -31,6 +32,6 @@
|
||||
#define BOOST_PP_MAX_D(D,X,Y) BOOST_PP_IF(BOOST_PP_LESS_EQUAL_D(D,X,Y),Y,X)
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_MAX().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_MAX().</p> */
|
||||
#define BOOST_PREPROCESSOR_MAX(X,Y) BOOST_PP_MAX(X,Y)
|
||||
#endif
|
||||
|
@ -16,14 +16,15 @@
|
||||
#include <boost/preprocessor/comparison/less_equal.hpp>
|
||||
#include <boost/preprocessor/if.hpp>
|
||||
|
||||
/** <P>Expands to the minimum of X and Y.</P>
|
||||
/** <p>Expands to the minimum of <code>X</code> and <code>Y</code>.</p>
|
||||
|
||||
<P>For example, BOOST_PP_MIN(5,7) expands to 5 (a single token).</P>
|
||||
<p>For example, <code>BOOST_PP_MIN(5,7)</code> expands to <code>5</code> (a
|
||||
single token).</p>
|
||||
|
||||
<H3>Uses</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_WHILE()
|
||||
</UL>
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_MIN(X,Y) BOOST_PP_MIN_D(0,X,Y)
|
||||
|
||||
@ -31,6 +32,6 @@
|
||||
#define BOOST_PP_MIN_D(D,X,Y) BOOST_PP_IF(BOOST_PP_LESS_EQUAL_D(D,Y,X),Y,X)
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_MIN().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_MIN().</p> */
|
||||
#define BOOST_PREPROCESSOR_MIN(X,Y) BOOST_PP_MIN(X,Y)
|
||||
#endif
|
||||
|
@ -13,29 +13,29 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Repeats the macro M(I,P) for I = [0,N-1[.</P>
|
||||
/** <p>Repeats the macro <code>M(I,P)</code> for I = [0,N-1[.</p>
|
||||
|
||||
<P>In other words, expands to the sequence:</P>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<PRE>
|
||||
M(0,P) M(1,P) ... M(N-1,P)
|
||||
</PRE>
|
||||
<pre>
|
||||
M(0,P) M(1,P) ... M(BOOST_PP_DEC(N),P)
|
||||
</pre>
|
||||
|
||||
<H3>2D and 3D repetition</H3>
|
||||
<h3>2D and 3D repetition</h3>
|
||||
|
||||
<P>2D and 3D repetition are supported with the BOOST_PP_REPEAT_2ND() and
|
||||
BOOST_PP_REPEAT_3RD() macros.</P>
|
||||
<p>2D and 3D repetition are supported with the BOOST_PP_REPEAT_2ND() and
|
||||
BOOST_PP_REPEAT_3RD() macros.</p>
|
||||
|
||||
<H3>Example</H3>
|
||||
<UL>
|
||||
<LI><a href="../../example/repeat_2d.c">repeat_2d.c</a>
|
||||
</UL>
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/repeat_2d.c">repeat_2d.c</a></li>
|
||||
</ul>
|
||||
|
||||
<H3>See</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_FOR()
|
||||
<LI>BOOST_PP_LIMIT_MAG
|
||||
</UL>
|
||||
<h3>See</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_FOR()</li>
|
||||
<li>BOOST_PP_LIMIT_MAG</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_REPEAT(N,M,P) BOOST_PP_REPEAT_DELAY(N,M,P)
|
||||
|
||||
@ -172,6 +172,6 @@ BOOST_PP_REPEAT_3RD() macros.</P>
|
||||
#define BOOST_PP_REPEAT128(M,P) BOOST_PP_REPEAT127(M,P) M(127,P)
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_REPEAT().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_REPEAT().</p> */
|
||||
#define BOOST_PREPROCESSOR_REPEAT(N,M,P) BOOST_PP_REPEAT(N,M,P)
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Same as BOOST_PP_REPEAT(), but implemented independently.</P> */
|
||||
/** <p>Same as BOOST_PP_REPEAT(), but implemented independently.</p> */
|
||||
#define BOOST_PP_REPEAT_2ND(N,M,P) BOOST_PP_REPEAT_2ND_DELAY(N,M,P)
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
@ -149,6 +149,6 @@
|
||||
#define BOOST_PP_REPEAT_2ND128(M,P) BOOST_PP_REPEAT_2ND127(M,P) M(127,P)
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_REPEAT_2ND().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_REPEAT_2ND().</p> */
|
||||
#define BOOST_PREPROCESSOR_REPEAT_2ND(N,M,P) BOOST_PP_REPEAT_2ND(N,M,P)
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Same as BOOST_PP_REPEAT(), but implemented independently.</P> */
|
||||
/** <p>Same as BOOST_PP_REPEAT(), but implemented independently.</p> */
|
||||
#define BOOST_PP_REPEAT_3RD(N,M,P) BOOST_PP_REPEAT_3RD_DELAY(N,M,P)
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
@ -149,6 +149,6 @@
|
||||
#define BOOST_PP_REPEAT_3RD128(M,P) BOOST_PP_REPEAT_3RD127(M,P) M(127,P)
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_REPEAT_3RD().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_REPEAT_3RD().</p> */
|
||||
#define BOOST_PREPROCESSOR_REPEAT_3RD(N,M,P) BOOST_PP_REPEAT_3RD(N,M,P)
|
||||
#endif
|
||||
|
@ -13,32 +13,12 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Delays the stringization of X.</P>
|
||||
/** <p>Stringizes <code>X</code> after it is macro expanded.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
|
||||
<PRE>
|
||||
#define NOTE(STR)\
|
||||
message(__FILE__ "(" BOOST_PP_STRINGIZE(__LINE__) ") : " STR)
|
||||
|
||||
// ...
|
||||
|
||||
#pragma NOTE("TBD!")
|
||||
</PRE>
|
||||
|
||||
<P>expands to:</P>
|
||||
|
||||
<PRE>
|
||||
#pragma message("examples.cpp" "(" "20" ") : " "TBD!")
|
||||
</PRE>
|
||||
|
||||
<P>The use of BOOST_PP_STRINGIZE() above lets the PP expand the __LINE__
|
||||
before stringizing it. If # would be used directly, the code would
|
||||
expand to:</P>
|
||||
|
||||
<PRE>
|
||||
#pragma message("examples.cpp" "(" "__LINE__" ") : " "TBD!")
|
||||
</PRE>
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/note.c">note.c</a></li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_STRINGIZE(X) BOOST_PP_STRINGIZE_DELAY(X)
|
||||
|
||||
@ -47,6 +27,6 @@ expand to:</P>
|
||||
#define BOOST_PP_DO_STRINGIZE(X) #X
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_STRINGIZE().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_STRINGIZE().</p> */
|
||||
#define BOOST_PREPROCESSOR_STRINGIZE(E) BOOST_PP_STRINGIZE(E)
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Includes all tuple headers.</P> */
|
||||
/** <p>Includes all tuple headers.</p> */
|
||||
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
|
@ -13,18 +13,18 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Expands to a macro that eats a tuple of the specified length.</P>
|
||||
/** <p>Expands to a macro that eats a tuple of the specified length.</p>
|
||||
|
||||
<P>BOOST_PP_TUPLE_EAT() is designed to be used with BOOST_PP_IF() like
|
||||
BOOST_PP_EMPTY().</P>
|
||||
<p>BOOST_PP_TUPLE_EAT() is designed to be used with BOOST_PP_IF() like
|
||||
BOOST_PP_EMPTY().</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_IF(0,BOOST_PP_ENUM_PARAMS,BOOST_PP_TUPLE_EAT(2))(10,P)
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to nothing.</P>
|
||||
<p>expands to nothing.</p>
|
||||
*/
|
||||
#define BOOST_PP_TUPLE_EAT(N) BOOST_PP_TUPLE_EAT_DELAY(N)
|
||||
|
||||
|
@ -13,30 +13,30 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Expands to the I:th element of an N-tuple.</P>
|
||||
/** <p>Expands to the <code>I</code>:th element of an <code>N</code>-tuple.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_ELEM(2,1,(A,B))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to B.</P>
|
||||
<p>expands to <code>B</code>.</p>
|
||||
|
||||
<P>Tuples can be used for representing structured data.</P>
|
||||
<p>Tuples can be used for representing structured data.</p>
|
||||
|
||||
<P>Examples of tuples:</P>
|
||||
<p>Examples of tuples:</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
2-tuple: (A, B)
|
||||
3-tuple: (1, 2, 3)
|
||||
4-tuple: (A B C, D, EF, 34)
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<H3>See</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_LIMIT_TUPLE
|
||||
</UL>
|
||||
<h3>See</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIMIT_TUPLE</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_TUPLE_ELEM(N,I,T) BOOST_PP_TUPLE_ELEM_DELAY(N,I,T)
|
||||
|
||||
@ -212,6 +212,6 @@
|
||||
#define BOOST_PP_TUPLE16_ELEM15(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) P
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_TUPLE_ELEM().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_TUPLE_ELEM().</p> */
|
||||
#define BOOST_PREPROCESSOR_TUPLE_ELEM(N,I,T) BOOST_PP_TUPLE_ELEM(N,I,T)
|
||||
#endif
|
||||
|
@ -15,27 +15,27 @@
|
||||
|
||||
#include <boost/preprocessor/list/adt.hpp>
|
||||
|
||||
/** <P>Converts a tuple to a list.</P>
|
||||
/** <p>Converts a tuple to a list.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
<p>For example,</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>expands to the same as</P>
|
||||
<p>expands to the same as</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
BOOST_PP_LIST_CONS(A,
|
||||
BOOST_PP_LIST_CONS(B,
|
||||
BOOST_PP_LIST_CONS(C,
|
||||
BOOST_PP_LIST_NIL)))
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<H3>See</H3>
|
||||
<UL>
|
||||
<LI>BOOST_PP_LIMIT_TUPLE
|
||||
</UL>
|
||||
<h3>See</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_LIMIT_TUPLE</li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_TUPLE_TO_LIST(N,T) BOOST_PP_TUPLE_TO_LIST_DELAY(N,T)
|
||||
|
||||
|
@ -16,90 +16,48 @@
|
||||
#include <boost/preprocessor/if.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
|
||||
/** <P>Iterates F(D,X) while C(D,X) is true.</P>
|
||||
/** <p>Iterates <code>F(D,X)</code> while <code>C(D,X)</code> is true.</p>
|
||||
|
||||
<P>In other words, expands to:</P>
|
||||
<p>In other words, expands to:</p>
|
||||
|
||||
<PRE>
|
||||
<pre>
|
||||
F(D, ... F(D, F(D,X) ) ... )
|
||||
</PRE>
|
||||
</pre>
|
||||
|
||||
<P>The depth of iteration is determined by C(D,X).</P>
|
||||
<p>The depth of iteration is determined by <code>C(D,X)</code>.</p>
|
||||
|
||||
<H3>Legend</H3>
|
||||
<UL>
|
||||
<LI><B>X</B> is the current state of iteration. The state is usually a tuple.
|
||||
<LI><B>C</B> is the condition for iteration. It must expand to a decimal
|
||||
integer literal.
|
||||
<LI><B>F</B> is the iterated macro. Note that if the state is a tuple, then
|
||||
F(D,X) usually expands to a tuple of the same number of elements.
|
||||
<LI><B>D</B> is the recursion depth and should only be used as a parameter
|
||||
<h3>Legend</h3>
|
||||
<ul>
|
||||
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
||||
<li><b>C</b> is the condition for iteration. It must expand to a decimal
|
||||
integer literal.</li>
|
||||
<li><b>F</b> is the iterated macro. Note that if the state is a tuple, then
|
||||
F(D,X) usually expands to a tuple of the same number of elements.</li>
|
||||
<li><b>D</b> is the recursion depth and should only be used as a parameter
|
||||
to other macros using BOOST_PP_WHILE(). Such macros include
|
||||
BOOST_PP_ADD() and other arithmetic operations. For each macro using
|
||||
BOOST_PP_WHILE(), there is a version of the macro, distinguished by the
|
||||
D suffix (e.g. BOOST_PP_ADD_D()), that accepts an additional recursion
|
||||
depth as the first parameter. This technique is necessary to avoid
|
||||
recursively expanding the same macro again, which is not permitted by the
|
||||
C++ preprocessor.
|
||||
</UL>
|
||||
C++ preprocessor.</li>
|
||||
</ul>
|
||||
|
||||
<P>NOTE: The value of the D parameter may exceed BOOST_PP_LIMIT_MAG.</P>
|
||||
<h3>Note</h3>
|
||||
<ul>
|
||||
<li>The value of the D parameter may exceed BOOST_PP_LIMIT_MAG.</li>
|
||||
<li>Using BOOST_PP_WHILE() is a bit tricky. This is due to the C++
|
||||
preprocessor limitations. It is recommended to take a look at the
|
||||
implementations of the various PREPROCESSOR library primitives such as
|
||||
BOOST_PP_ADD() for additional examples.</li>
|
||||
</ul>
|
||||
|
||||
<H3>Caveat</H3>
|
||||
|
||||
<P>Using BOOST_PP_WHILE() is a bit tricky. This is due to the C++ preprocessor
|
||||
limitations. It is recommended to take a look at the implementations of the
|
||||
various PREPROCESSOR library primitives such as BOOST_PP_ADD() for additional
|
||||
examples.</P>
|
||||
|
||||
<H3>Example</H3>
|
||||
<UL>
|
||||
<LI><a href="../../example/count_down.c">count_down.c</a>
|
||||
</UL>
|
||||
|
||||
<P>For a more complex example, let's take a look at an implementation of
|
||||
BOOST_PP_MUL().</P>
|
||||
|
||||
<PRE>
|
||||
#define BOOST_PP_MUL(X,Y) BOOST_PP_MUL_D(0,X,Y)
|
||||
// Since the macro is implemented using WHILE, the actual implementation
|
||||
// takes a depth as a parameter so that it can be called inside a WHILE.
|
||||
// The above easy-to-use version simply uses 0 as the depth and can not be
|
||||
// called inside a WHILE.
|
||||
|
||||
#define BOOST_PP_MUL_D(D,X,Y)\
|
||||
BOOST_PP_TUPLE_ELEM(3,0,BOOST_PP_WHILE##D(BOOST_PP_MUL_C,BOOST_PP_MUL_F,(0,X,Y)))
|
||||
// ^^^ ^^^ ^^ ^^ ^^^^^^^
|
||||
// #1 #2 #3 #3 #1
|
||||
//
|
||||
// #1) The state is a 3-tuple. After the iteration is finished, the first
|
||||
// element of the tuple is the result.
|
||||
//
|
||||
// #2) The WHILE primitive is "invoked" directly. BOOST_PP_WHILE(D,...)
|
||||
// can't be used because it would not be expanded by the C++ preprocessor.
|
||||
//
|
||||
// #3) ???_C is the condition and ???_F is the iteration macro.
|
||||
|
||||
#define BOOST_PP_MUL_C(D,P)\
|
||||
BOOST_PP_TUPLE_ELEM(3,2,P)
|
||||
// Iteration is finished when the counter reaches 0.
|
||||
|
||||
#define BOOST_PP_MUL_F(D,P)\
|
||||
( BOOST_PP_ADD_D(D,BOOST_PP_TUPLE_ELEM(3,0,P),BOOST_PP_TUPLE_ELEM(3,1,P))\
|
||||
, BOOST_PP_TUPLE_ELEM(3,1,P)\
|
||||
, BOOST_PP_DEC(BOOST_PP_TUPLE_ELEM(3,2,P))\
|
||||
)
|
||||
// ( The result is increased by the multiplier.
|
||||
// , The multiplier is retained without change.
|
||||
// , The counter is decreased.
|
||||
// )
|
||||
</PRE>
|
||||
|
||||
<H3>Implementation rationale</H3>
|
||||
<UL>
|
||||
<LI>The maximum iteration depth is greater than 2*BOOST_PP_LIMIT_MAG to make
|
||||
it possible to compute N*N functions.
|
||||
</UL>
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/count_down.c">count_down.c</a></li>
|
||||
<li><a href="../../example/linear_fib.c">linear_fib.c</a></li>
|
||||
<li><a href="../../example/delay.c">delay.c</a></li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_WHILE(C,F,X) BOOST_PP_WHILE_C(C(1,X),0,X)(C,F,F(1,X))
|
||||
|
||||
|
Reference in New Issue
Block a user