lib cleanup

[SVN r15689]
This commit is contained in:
Paul Mensonides
2002-10-03 22:04:13 +00:00
parent 7856c3b759
commit ae584c68b2
126 changed files with 565 additions and 7981 deletions

View File

@ -1,43 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
<title>Boost.Preprocessor - Acknowledgements</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Acknowledgements</h2>
</td>
</tr>
</table>
<hr>
<p>The original idea of passing two extra parameters to REPEAT, which makes it
possible to create preprocessor code on top of it, was due to Aleksey Gurtovoy.
The invokeable IDENTITY macro was also invented by him. He also suggested the
name for the library. Many thanks to Aleksey for his insights!</p>
<p>Thanks to everyone who participated in the review: David Abrahams, Beman Dawes,
Ronald Garcia, Douglas Gregor, Aleksey Gurtovoy, Jeremy Siek, and Daryle Walker.</p>
<p>Thanks to Chris Little and Mat Marcus for providing help with MWCW.</p>
<p>The original automatic recursion technique, which makes many of the library
primitives easier to use, was invented by Paul Mensonides.</p>
<p>The PREPROCESSOR library has been developed by Vesa Karvonen. </p>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body>
</html>

View File

@ -1,48 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
<title>Boost.Preprocessor - Bibliography</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Bibliography</h2>
</td>
</tr>
</table>
<hr>
<table>
<tr><td><b>[Stroustrup]</b></td><td><a name="[Stroustrup]">Stroustrup: <i>The Design and Evolution of C++</i>, ISBN 0201543303</a></td></tr>
<tr><td><b>[Czarnecki]</b></td><td><a name="[Czarnecki]">Czarnecki, Eisenecker: <i>Generative Programming</i>, ISBN 0201309777</a></td></tr>
<tr><td><b>[Barton]</b></td><td><a name="[Barton]">Barton, Nackman: <i>Scientific and Engineering C++</i>, ISBN 0201533936</a></td></tr>
<tr><td><b>[McConnell]</b></td><td><a name="[McConnell]">McConnell: <i>Code Complete</i>, ISBN 1556154844</a></td></tr>
<tr><td><b>[Std]</b></td><td><a name="[Std]">ISO/IEC 14882:1998 <i>Programming languages - C++</i></a></td></tr>
<tr><td><b>[Thompson]</b></td><td><a name="[Thompson]">Thompson: <i>Haskell: The Craft of Functional Programming</i>, ISBN 0201342758</a></td></tr>
<tr><td><b>[Okasaki]</b></td><td><a name="[Okasaki]">Okasaki: <i>Purely Functional Data Structures</i>, ISBN 0521663504</a></td></tr>
<tr><td><b>[Cousineau]</b></td><td><a name="[Cousineau]">Cousineau, Mauny: <i>The Functional Approach to Programming</i>, ISBN 0521576814</a></td></tr>
<tr><td><b>[Abelson]</b></td><td><a name="[Abelson]">Abelson, Sussman, Sussman: <i>Structure and Interpretation of Computer Programs</i>, ISBN 0262011530</a></td></tr>
</table>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body>
</html>

View File

@ -1,91 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
<title>Boost.Preprocessor - Bibliography</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Examples</h2>
</td>
</tr>
</table>
<hr>
<table>
<tr><td><a href="../example/array_arithmetic.c">array_arithmetic.c</a></td><td>Implements over 2200 functions for 1-dimensional arithmetic
array manipulation in C. The idea is to use preprocessor data structures,
lists and tuples, for storing metainformation to be used for generating
the actual C code.</td></tr>
<tr>
<td><a href="../example/catch_builtin.cpp">catch_builtin.cpp</a></td>
<td>Demonstrates the usage of lists and BOOST_PP_LIST_FOR_EACH().</td>
</tr>
<tr>
<td><a href="../example/count_down.c">count_down.c</a></td>
<td> Trivial example of using BOOST_PP_WHILE() that simply counts
down from N to 0 ultimately expanding to a 0.</td>
</tr>
<tr>
<td><a href="../example/delay.c">delay.c</a></td>
<td>Implements a macro whose expansion takes exponential amount
of time.</td>
</tr>
<tr>
<td><a href="../example/duffs_device.c">duffs_device.c</a></td>
<td>Uses the preprocessor library to implement a generalized
macro for implementing a Duff's Device.</td>
</tr>
<tr>
<td><a href="../example/is_integral.cpp">is_integral.cpp</a></td>
<td>Demonstrates the usage of preprocessor lists for generating
C++ code.</td>
</tr>
<tr>
<td><a href="../example/linear_fib.c">linear_fib.c</a></td>
<td>Shows how BOOST_PP_WHILE() can be used for implementing macros.</td>
</tr>
<tr>
<td><a href="../example/note.c">note.c</a></td>
<td>Shows how BOOST_PP_STRINGIZE() can be used to allow macro
expansion before stringization.</td>
</tr>
<tr>
<td><a href="../example/repeat_2d.c">repeat_2d.c</a></td>
<td>Implements a generalized macro for 2D repetition using the
simple repetition primitives of the preprocessor library.</td>
</tr>
<tr>
<td><a href="../example/static_assert.c">static_assert.c</a></td>
<td>Shows how BOOST_PP_CAT() can be used to allow macro expansion
before token concatenation.</td>
</tr>
<tr>
<td><a href="../example/subscript_layer.cpp">subscript_layer.cpp</a></td>
<td>Shows how BOOST_PP_EMPTY can be used as an unused or empty
parameter.</td>
</tr>
</table>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body>
</html>

View File

@ -0,0 +1,197 @@
# /* Copyright (C) 2002
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Permission to copy, use, modify, sell and distribute this software is
# * granted provided this copyright notice appears in all copies. This
# * software is provided "as is" without express or implied warranty, and
# * with no claim as to its suitability for any purpose.
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# /* This example implements over 2200 functions for 1-dimensional arithmetic
# * array manipulation in C. The idea is to use preprocessor data structures,
# * lists, and tuples for storing metainformation to be used for generating
# * the actual C code.
# *
# * Who needs templates anyway? :)
# *
# * Compile with any C compiler with a standards conforming preprocessor.
# */
#
# include <boost/preprocessor/comparison/less.hpp>
# include <boost/preprocessor/control/if.hpp>
# include <boost/preprocessor/list/at.hpp>
# include <boost/preprocessor/list/cat.hpp>
# include <boost/preprocessor/list/for_each_product.hpp>
# include <boost/preprocessor/logical/or.hpp>
# include <boost/preprocessor/tuple/to_list.hpp>
# include <boost/preprocessor/tuple/eat.hpp>
#
# /* Information about C operators */
#
# /* Accessors for the operator datatype. */
# define OP_SYMBOL(O) BOOST_PP_TUPLE_ELEM(5, 0, O)
# define OP_NAME(O) BOOST_PP_TUPLE_ELEM(5, 1, O)
# define OP_IS_FLOATING(O) BOOST_PP_TUPLE_ELEM(5, 2, O)
# define OP_IS_LOGICAL(O) BOOST_PP_TUPLE_ELEM(5, 3, O)
# define OP_IS_SHIFT(O) BOOST_PP_TUPLE_ELEM(5, 4, O)
#
# /* List of applicative unary operators. */
# define APPLICATIVE_UNARY_OPS \
BOOST_PP_TUPLE_TO_LIST( \
3, \
( \
( ! , logical_not, 1, 1, 0), \
( ~ , bitwise_not, 0, 0, 0), \
( - , neg, 1, 0, 0) \
) \
) \
/**/
#
# /* List of applicative binary operators. */
# define APPLICATIVE_BINARY_OPS \
BOOST_PP_TUPLE_TO_LIST( \
18, \
( \
( * , mul ,1 ,0 ,0), \
( / , div ,1 ,0 ,0), \
( % , mod ,0 ,0 ,0), \
( + , add ,1 ,0 ,0), \
( - , sub ,1 ,0 ,0), \
( << , shift_left ,0 ,0 ,1), \
( >> , shift_right ,0 ,0 ,1), \
( < , less ,1 ,1 ,0), \
( <= , less_equal ,1 ,1 ,0), \
( >= , greater_equal ,1 ,1 ,0), \
( > , greater ,1 ,1 ,0), \
( == , equal ,1 ,1 ,0), \
( != , not_equal ,1 ,1 ,0), \
( & , bitwise_and ,0 ,0 ,0), \
( | , bitwise_or ,0 ,0 ,0), \
( ^ , bitwise_xor ,0 ,0 ,0), \
( && , logical_and ,1 ,1 ,0), \
( || , logical_or ,1 ,1 ,0) \
) \
) \
/**/
#
# /* Information about C built-in types. */
#
# /* Accessors for the type datatype. */
# define TYPE_NAME(T) BOOST_PP_TUPLE_ELEM(4, 0, T)
# define TYPE_ABBREVIATION(T) BOOST_PP_TUPLE_ELEM(4, 1, T)
# define TYPE_IS_FLOATING(T) BOOST_PP_TUPLE_ELEM(4, 2, T)
# define TYPE_RANK(T) BOOST_PP_TUPLE_ELEM(4, 3, T)
#
# /* List of C built-in types. */
# define BUILTIN_TYPES \
BOOST_PP_TUPLE_TO_LIST( \
12, \
( \
( signed char ,sc, 0, 1), \
( char ,ch, 0, 1), \
( unsigned char ,uc, 0, 1), \
( short ,ss, 0, 2), \
( unsigned short ,us, 0, 2), \
TYPE_INT, \
( unsigned ,ui, 0, 4), \
( long ,sl, 0, 5), \
( unsigned long ,ul, 0, 6), \
( float ,fl, 1, 7), \
( double ,db, 1, 8), \
( long double ,ld, 1, 9) \
) \
) \
/**/
#
# /* Type int is needed in some type computations. */
# define TYPE_INT (int, si, 0, 3)
#
# /* Type computation macros. */
# define TYPE_OF_INTEGER_PROMOTION(T) \
BOOST_PP_IF( \
BOOST_PP_LESS(TYPE_RANK(T), TYPE_RANK(TYPE_INT)), \
TYPE_INT, T \
) \
/**/
# define TYPE_OF_USUAL_ARITHMETIC_CONVERSION(L, R) \
TYPE_OF_INTEGER_PROMOTION( \
BOOST_PP_IF( \
BOOST_PP_LESS(TYPE_RANK(L), TYPE_RANK(R)), \
R, L \
) \
) \
/**/
# define TYPE_OF_UNARY_OP(O, T) \
BOOST_PP_IF( \
OP_IS_LOGICAL(O), \
TYPE_INT, TYPE_OF_INTEGER_PROMOTION(T) \
) \
/**/
# define TYPE_OF_BINARY_OP(O, L, R) \
BOOST_PP_IF( \
OP_IS_LOGICAL(O), TYPE_INT, \
BOOST_PP_IF( \
OP_IS_SHIFT(O), \
TYPE_OF_INTEGER_PROMOTION(L), \
TYPE_OF_USUAL_ARITHMETIC_CONVERSION(L,R) \
) \
) \
/**/
# define IS_VALID_UNARY_OP_AND_TYPE_COMBINATION(O, T) \
BOOST_PP_IF( \
TYPE_IS_FLOATING(T), \
OP_IS_FLOATING(O), 1 \
) \
/**/
# define IS_VALID_BINARY_OP_AND_TYPE_COMBINATION(O, L, R) \
BOOST_PP_IF( \
BOOST_PP_OR(TYPE_IS_FLOATING(L), TYPE_IS_FLOATING(R)), \
OP_IS_FLOATING(O), 1 \
) \
/**/
#
# /* Generates code for all unary operators and integral types. */
# define UNARY_ARRAY_OP(_, OT) \
BOOST_PP_IF( \
IS_VALID_UNARY_OP_AND_TYPE_COMBINATION OT, \
UNARY_ARRAY_OP_CODE, BOOST_PP_TUPLE_EAT(2) \
) OT \
/**/
# define UNARY_ARRAY_OP_CODE(O, T) \
void BOOST_PP_LIST_CAT(BOOST_PP_TUPLE_TO_LIST(4, (array_, OP_NAME(O), _, TYPE_ABBREVIATION(T)))) \
(const TYPE_NAME(T)* in, TYPE_NAME(TYPE_OF_UNARY_OP(O, T))* out, unsigned n) { \
do { \
*out++ = OP_SYMBOL(O) *in++; \
} while (--n); \
} \
/**/
BOOST_PP_LIST_FOR_EACH_PRODUCT(UNARY_ARRAY_OP, 2, (APPLICATIVE_UNARY_OPS, BUILTIN_TYPES))
# /* Generates code for all binary operators and integral type pairs. */
# define BINARY_ARRAY_OP(_, OLR) \
BOOST_PP_IF( \
IS_VALID_BINARY_OP_AND_TYPE_COMBINATION OLR, \
BINARY_ARRAY_OP_CODE, BOOST_PP_TUPLE_EAT(3) \
) OLR \
/**/
# define BINARY_ARRAY_OP_CODE(O, L, R) \
void BOOST_PP_LIST_CAT( \
BOOST_PP_TUPLE_TO_LIST( \
6, (array_, OP_NAME(O), _, TYPE_ABBREVIATION(L), _, TYPE_ABBREVIATION(R)) \
) \
)(const TYPE_NAME(L)* lhs_in, const TYPE_NAME(R)* rhs_in, TYPE_NAME(TYPE_OF_BINARY_OP(O, L, R))* out, unsigned n) { \
do { \
*out++ = *lhs_in OP_SYMBOL(O) *rhs_in; \
++lhs_in; \
++rhs_in; \
} while (--n); \
} \
/**/
BOOST_PP_LIST_FOR_EACH_PRODUCT(BINARY_ARRAY_OP, 3, (APPLICATIVE_BINARY_OPS, BUILTIN_TYPES, BUILTIN_TYPES))

View File

@ -0,0 +1,52 @@
# /* Copyright (C) 2002
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Permission to copy, use, modify, sell and distribute this software is
# * granted provided this copyright notice appears in all copies. This
# * software is provided "as is" without express or implied warranty, and
# * with no claim as to its suitability for any purpose.
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# /* This example demonstrates the usage of lists and BOOST_PP_LIST_FOR_EACH(). */
#
# include <iostream>
# include <typeinfo>
#
# include <boost/preprocessor/list/for_each.hpp>
# include <boost/preprocessor/tuple/to_list.hpp>
#
# /* List of built-in types. (Strictly speaking wchar_t should be on the list.) */
#
# define BUILTIN_TYPES \
BOOST_PP_TUPLE_TO_LIST( \
13, \
( \
bool, \
char, signed char, unsigned char, \
unsigned short, short, \
int, unsigned, \
long, unsigned long, \
float, \
double, long double \
) \
) \
/**/
#
# define CATCH(R, _, T) \
catch (T t) { \
std::cerr << "Caught an " << typeid(t).name() << " = " << t; \
} \
/**/
int main() {
try {
throw 10;
}
BOOST_PP_LIST_FOR_EACH(CATCH, _, BUILTIN_TYPES)
return 0;
}

96
doc/examples/delay.c Normal file
View File

@ -0,0 +1,96 @@
# /* Copyright (C) 2002
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Permission to copy, use, modify, sell and distribute this software is
# * granted provided this copyright notice appears in all copies. This
# * software is provided "as is" without express or implied warranty, and
# * with no claim as to its suitability for any purpose.
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# /* The time complexity of DELAY(N) is O(2^N).
# *
# * Handy when recompiles are too fast to take a coffee break. :)
# *
# * Template metaprogramming can be used for implementing similar
# * delays. Unfortunately template instantiation consumes memory,
# * therefore compilers usually fail to fully compile long template
# * based delays, because they run out of memory.
# *
# * On many compilers (e.g. g++, MSVC++), this macro takes only a
# * small amount of memory to preprocess. On some compilers (e.g.
# * MWCW), however, this macro seems to consume huge amounts of
# * memory.
# */
#
# include <boost/preprocessor/arithmetic/dec.hpp>
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/control/while.hpp>
# include <boost/preprocessor/facilities/empty.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
#
# ifndef DELAY_MAX
# define DELAY_MAX 14
# endif
#
# define DELAY(N) BOOST_PP_TUPLE_ELEM(2, 0, (BOOST_PP_EMPTY, BOOST_PP_WHILE(DELAY_C, BOOST_PP_CAT(DELAY_F, N), BOOST_PP_DEC(N))))()
#
# define DELAY_C(D, N) N
#
# define DELAY_F0(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F1(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F2(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F3(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F4(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F5(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F6(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F7(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F8(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F9(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F10(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F11(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F12(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F13(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F14(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F15(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F16(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F17(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F18(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F19(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F20(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F21(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F22(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F23(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F24(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F25(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F26(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F27(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F28(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F29(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F30(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F31(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F32(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F33(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F34(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F35(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F36(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F37(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F38(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F39(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F40(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F41(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F42(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F43(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F44(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F45(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F46(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F47(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F48(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F49(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
# define DELAY_F50(D, N) BOOST_PP_IF(1, BOOST_PP_DEC(N), BOOST_PP_WHILE_ ## D(DELAY_C, DELAY_F ## N, BOOST_PP_DEC(N)))
DELAY(DELAY_MAX)

View File

@ -0,0 +1,62 @@
# /* Copyright (C) 2002
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Permission to copy, use, modify, sell and distribute this software is
# * granted provided this copyright notice appears in all copies. This
# * software is provided "as is" without express or implied warranty, and
# * with no claim as to its suitability for any purpose.
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# /* This example uses the preprocessor library to implement a generalized
# * macro for implementing Duff's Device.
# *
# * This example was inspired by an original generalized macro for
# * for implementing Duff's Device written by Joerg Walter.
# */
#
# include <assert.h>
#
# include <boost/preprocessor/repetition/repeat.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
#
# /* Expands to a Duff's Device. */
# define DUFFS_DEVICE(UNROLLING_FACTOR, COUNTER_TYPE, N, STATEMENT) \
do { \
COUNTER_TYPE duffs_device_initial_cnt = (N); \
if (duffs_device_initial_cnt > 0) { \
COUNTER_TYPE duffs_device_running_cnt = (duffs_device_initial_cnt + (UNROLLING_FACTOR - 1)) / UNROLLING_FACTOR; \
switch (duffs_device_initial_cnt % UNROLLING_FACTOR) { \
do { \
BOOST_PP_REPEAT(UNROLLING_FACTOR, DUFFS_DEVICE_C, (UNROLLING_FACTOR, { STATEMENT })) \
} while (--duffs_device_running_cnt); \
} \
} \
} while (0) \
/**/
#
# define DUFFS_DEVICE_C(Z, I, UNROLLING_FACTOR_STATEMENT) \
case (I ? BOOST_PP_TUPLE_ELEM(2, 0, UNROLLING_FACTOR_STATEMENT) - I : 0): \
BOOST_PP_TUPLE_ELEM(2, 1, UNROLLING_FACTOR_STATEMENT); \
/**/
#
# ifndef UNROLLING_FACTOR
# define UNROLLING_FACTOR 16
# endif
#
# ifndef N
# define N 1000
# endif
int main(void) {
int i = 0;
DUFFS_DEVICE(UNROLLING_FACTOR, int, 0, ++i;);
assert(i == 0);
DUFFS_DEVICE(UNROLLING_FACTOR, int, N, ++i;);
assert(i == N);
return 0;
}

View File

@ -0,0 +1,50 @@
# /* Copyright (C) 2002
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Permission to copy, use, modify, sell and distribute this software is
# * granted provided this copyright notice appears in all copies. This
# * software is provided "as is" without express or implied warranty, and
# * with no claim as to its suitability for any purpose.
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# /* This example demonstrates the usage of preprocessor lists for generating C++ code. */
#
# include <boost/preprocessor/facilities/empty.hpp>
# include <boost/preprocessor/list/at.hpp>
# include <boost/preprocessor/list/for_each_product.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
# include <boost/preprocessor/tuple/to_list.hpp>
#
# /* List of integral types. (Strictly speaking, wchar_t should be on the list.) */
# define INTEGRAL_TYPES \
BOOST_PP_TUPLE_TO_LIST( \
9, (char, signed char, unsigned char, short, unsigned short, int, unsigned, long, unsigned long) \
) \
/**/
#
# /* List of invokeable cv-qualifiers */
# define CV_QUALIFIERS \
BOOST_PP_TUPLE_TO_LIST( \
4, (BOOST_PP_EMPTY, const BOOST_PP_EMPTY, volatile BOOST_PP_EMPTY, const volatile BOOST_PP_EMPTY) \
) \
/**/
#
# /* Template for testing whether a type is an integral type. */
template<class T> struct is_integral {
enum { value = false };
};
# /* Macro for defining a specialization of is_integral<> template. */
# define IS_INTEGRAL_SPECIALIZATION(R, L) \
template<> struct is_integral<BOOST_PP_TUPLE_ELEM(2, 0, L)() BOOST_PP_TUPLE_ELEM(2, 1, L)> { \
enum { value = true }; \
}; \
/**/
BOOST_PP_LIST_FOR_EACH_PRODUCT(IS_INTEGRAL_SPECIALIZATION, 2, (CV_QUALIFIERS, INTEGRAL_TYPES))

92
doc/examples/linear_fib.c Normal file
View File

@ -0,0 +1,92 @@
# /* Copyright (C) 2002
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Permission to copy, use, modify, sell and distribute this software is
# * granted provided this copyright notice appears in all copies. This
# * software is provided "as is" without express or implied warranty, and
# * with no claim as to its suitability for any purpose.
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# /* This example shows how BOOST_PP_WHILE() can be used for implementing macros. */
#
# include <stdio.h>
#
# include <boost/preprocessor/arithmetic/add.hpp>
# include <boost/preprocessor/arithmetic/sub.hpp>
# include <boost/preprocessor/comparison/less_equal.hpp>
# include <boost/preprocessor/control/while.hpp>
# include <boost/preprocessor/list/adt.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
#
# /* First consider the following C implementation of Fibonacci. */
typedef struct linear_fib_state {
int a0, a1, n;
} linear_fib_state;
static int linear_fib_c(linear_fib_state p) {
return p.n;
}
static linear_fib_state linear_fib_f(linear_fib_state p) {
linear_fib_state r = { p.a1, p.a0 + p.a1, p.n - 1 };
return r;
}
static int linear_fib(int n) {
linear_fib_state p = { 0, 1, n };
while (linear_fib_c(p)) {
p = linear_fib_f(p);
}
return p.a0;
}
# /* Then consider the following preprocessor implementation of Fibonacci. */
#
# define LINEAR_FIB(n) LINEAR_FIB_D(1, n)
# /* Since the macro is implemented using BOOST_PP_WHILE, the actual
# * implementation takes a depth as a parameters so that it can be called
# * inside a BOOST_PP_WHILE. The above easy-to-use version simply uses 1
# * as the depth and cannot be called inside a BOOST_PP_WHILE.
# */
#
# define LINEAR_FIB_D(d, n) \
BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE_ ## d(LINEAR_FIB_C, LINEAR_FIB_F, (0, 1, n)))
# /* ^^^^ ^^^^^ ^^ ^^ ^^^^^^^
# * #1 #2 #3 #3 #4
# *
# * 1) The state is a 3-element 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 preprocessor.
# *
# * 3) ???_C is the condition and ???_F is the iteration macro.
# */
#
# define LINEAR_FIB_C(d, p) \
/* p.n */ BOOST_PP_TUPLE_ELEM(3, 2, p) \
/**/
#
# define LINEAR_FIB_F(d, p) \
( \
/* p.a1 */ BOOST_PP_TUPLE_ELEM(3, 1, p), \
/* p.a0 + p.a1 */ BOOST_PP_ADD_D(d, BOOST_PP_TUPLE_ELEM(3, 0, p), BOOST_PP_TUPLE_ELEM(3, 1, p)), \
/* ^^ ^ \
* BOOST_PP_ADD() uses BOOST_PP_WHILE(). Therefore we \
* pass the recursion depth explicitly to BOOST_PP_ADD_D(). \
*/ \
/* p.n - 1 */ BOOST_PP_DEC(BOOST_PP_TUPLE_ELEM(3, 2, p)) \
) \
/**/
int main() {
printf("linear_fib(10) = %d\n", linear_fib(10));
printf("LINEAR_FIB(10) = %d\n", LINEAR_FIB(10));
return 0;
}

16
doc/examples/out.cpp Normal file
View File

@ -0,0 +1,16 @@
extern "C" {
void _assert(const char*, const char*, unsigned);
}
int main(void) {
int i = 0;
do { int duffs_device_initial_cnt = (0); if (duffs_device_initial_cnt > 0) { int duffs_device_running_cnt = (duffs_device_initial_cnt + (16 - 1)) / 16; switch (duffs_device_initial_cnt % 16) { do { case (0 ? 16 - 0 : 0): { ++i; }; case (1 ? 16 - 1 : 0): { ++i; }; case (2 ? 16 - 2 : 0): { ++i; }; case (3 ? 16 - 3 : 0): { ++i; }; case (4 ? 16 - 4 : 0): { ++i; }; case (5 ? 16 - 5 : 0): { ++i; }; case (6 ? 16 - 6 : 0): { ++i; }; case (7 ? 16 - 7 : 0): { ++i; }; case (8 ? 16 - 8 : 0): { ++i; }; case (9 ? 16 - 9 : 0): { ++i; }; case (10 ? 16 - 10 : 0): { ++i; }; case (11 ? 16 - 11 : 0): { ++i; }; case (12 ? 16 - 12 : 0): { ++i; }; case (13 ? 16 - 13 : 0): { ++i; }; case (14 ? 16 - 14 : 0): { ++i; }; case (15 ? 16 - 15 : 0): { ++i; }; } while (--duffs_device_running_cnt); } } } while (0);
(void)( (i == 0) || (_assert("i == 0", "duffs_device.c", 58), 0) );
do { int duffs_device_initial_cnt = (1000); if (duffs_device_initial_cnt > 0) { int duffs_device_running_cnt = (duffs_device_initial_cnt + (16 - 1)) / 16; switch (duffs_device_initial_cnt % 16) { do { case (0 ? 16 - 0 : 0): { ++i; }; case (1 ? 16 - 1 : 0): { ++i; }; case (2 ? 16 - 2 : 0): { ++i; }; case (3 ? 16 - 3 : 0): { ++i; }; case (4 ? 16 - 4 : 0): { ++i; }; case (5 ? 16 - 5 : 0): { ++i; }; case (6 ? 16 - 6 : 0): { ++i; }; case (7 ? 16 - 7 : 0): { ++i; }; case (8 ? 16 - 8 : 0): { ++i; }; case (9 ? 16 - 9 : 0): { ++i; }; case (10 ? 16 - 10 : 0): { ++i; }; case (11 ? 16 - 11 : 0): { ++i; }; case (12 ? 16 - 12 : 0): { ++i; }; case (13 ? 16 - 13 : 0): { ++i; }; case (14 ? 16 - 14 : 0): { ++i; }; case (15 ? 16 - 15 : 0): { ++i; }; } while (--duffs_device_running_cnt); } } } while (0);
(void)( (i == 1000) || (_assert("i == N", "duffs_device.c", 60), 0) );
return 0;
}

View File

@ -1,326 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
<title>Boost.Preprocessor - Tutorial examples preprocessed</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Tutorial examples preprocessed</h2>
</td>
</tr>
</table>
<hr>
<p>The following code snippets were produced by actually preprocessing the code
snippets of the tutorial. After preprocessing the code was reformatted manually.</p>
<hr>
<p><strong><a name="Local Macro"></a><a href="tutorial.htm#Local Macro">EXAMPLE</a>:</strong>
Use a Local Macro to avoid small scale repetition</p>
<pre>template&lt;class T, int n&gt;
vec&lt;T,n&gt;&
operator +=
( vec&lt;T,n&gt;&
lhs
, const vec&lt;T,n&gt;&
rhs
)
{ for (int i=0; i&lt;n; ++i)
lhs(i) += rhs(i);
return lhs;
}
template&lt;class T, int n&gt;
vec&lt;T,n&gt;&
operator -=
( vec&lt;T,n&gt;&
lhs
, const vec&lt;T,n&gt;&
rhs
)
{ for (int i=0; i&lt;n; ++i)
lhs(i) -= rhs(i);
return lhs;
}
template&lt;class T, int n&gt;
vec&lt;T,n&gt;&
operator *=
( vec&lt;T,n&gt;&
lhs
, const vec&lt;T,n&gt;&
rhs
)
{ for (int i=0; i&lt;n; ++i)
lhs(i) *= rhs(i);
return lhs;
}
template&lt;class T, int n&gt;
vec&lt;T,n&gt;&
operator /=
( vec&lt;T,n&gt;&
lhs
, const vec&lt;T,n&gt;&
rhs
)
{ for (int i=0; i&lt;n; ++i)
lhs(i) /= rhs(i);
return lhs;
}
</pre>
<hr>
<p><strong><a name="UNUSED"></a><a href="tutorial.htm#UNUSED">EXAMPLE</a>:</strong>
Use BOOST_PP_EMPTY() as an unused parameter in Local Macro instantiations</p>
<pre>template&lt;class base&gt;
typename implement_subscript_using_begin_subscript&lt;base&gt;::value_type&
implement_subscript_using_begin_subscript&lt;base&gt;::operator[]
( index_type
i
)
{ return base::begin()[i];
}
template&lt;class base&gt;
const typename implement_subscript_using_begin_subscript&lt;base&gt;::value_type&
implement_subscript_using_begin_subscript&lt;base&gt;::operator[]
( index_type
i
) const
{ return base::begin()[i];
}
</pre>
<hr>
<p><b><a name="CAT"></a><a href="tutorial.htm#CAT">EXAMPLE:</a></b> Use BOOST_PP_CAT instead of ## when necessary</p>
<pre>enum
{ static_check_152 = (sizeof(int) &lt;= sizeof(long)) ? 1 : -1
};
typedef char
static_assert_152
[ static_check_152
];
</pre>
<hr>
<p><b><a name="STRINGIZE"></a><a href="tutorial.htm#STRINGIZE">EXAMPLE:</a></b> Use BOOST_PP_STRINGIZE instead of # whenever necessary</p>
<pre>#pragma message("examples.cpp" "(" "20" ") : " "TBD!")</pre>
<hr>
<p><strong><a name="ENUM_PARAMS"></a><a href="tutorial.htm#ENUM_PARAMS">EXAMPLE</a>:</strong>
Use:</p>
<ul>
<li> BOOST_PP_ENUM_PARAMS,</li>
<li> BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT,</li>
<li> BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS,</li>
<li> BOOST_PP_ENUM_SHIFTED_PARAMS, or</li>
<li>BOOST_PP_REPEAT, and</li>
<li> BOOST_PP_COMMA_IF</li>
</ul>
<p>to avoid O(N) repetition on lists in general</p>
<pre>struct make_type_list_end;
template
&lt; class T0=make_type_list_end
, class T1=make_type_list_end
, class T2=make_type_list_end
, class T3=make_type_list_end
, class T4=make_type_list_end
, class T5=make_type_list_end
, class T6=make_type_list_end
, class T7=make_type_list_end
&gt;
struct make_type_list
{
private:
enum
{ end = is_same&lt;T0,make_type_list_end&gt;::value
};
public:
typedef typename
type_if
&lt; end
, type_cons_empty
, type_cons
&lt; T0
, typename
type_inner_if
&lt; end
, type_identity&lt;end&gt;
, make_type_list
&lt; T1
, T2
, T3
, T4
, T5
, T6
, T7
&gt;
&gt;::type
&gt;
&gt;::type type;
};
</pre>
<hr>
<p><strong><a name="Token Look-Up"></a><a href="tutorial.htm#Token Look-Up">EXAMPLE</a>:</strong>
Use BOOST_PP_REPEAT and a Token Look-Up Function to eliminate categorical
repetition</p>
<pre>catch (bool t)
{ report_typeid(t);
report_value(t);
}
catch (char t)
{ report_typeid(t);
report_value(t);
}
catch (signed char t)
{ report_typeid(t);
report_value(t);
}
catch (unsigned char t)
{ report_typeid(t);
report_value(t);
}
catch (short t)
{ report_typeid(t);
report_value(t);
}
catch (unsigned short t)
{ report_typeid(t);
report_value(t);
}
catch (int t)
{ report_typeid(t);
report_value(t);
}
catch (unsigned int t)
{ report_typeid(t);
report_value(t);
}
catch (long t)
{ report_typeid(t);
report_value(t);
}
catch (unsigned long t)
{ report_typeid(t);
report_value(t);
}
catch (float t)
{ report_typeid(t);
report_value(t);
}
catch (double t)
{ report_typeid(t);
report_value(t);
}
catch (long double t)
{ report_typeid(t);
report_value(t);
}
</pre>
<hr>
<p><strong><a name="2ND_REPEAT"></a><a href="tutorial.htm#2ND_REPEAT">EXAMPLE</a>:</strong>
Use BOOST_PP_REPEAT_2ND to avoid O(N*N) repetition</p>
<pre>vec()
{
}
vec(T a0)
{ (*this)[0] = a0;
}
vec(T a0, T a1)
{ (*this)[0] = a0;
(*this)[1] = a1;
}
vec(T a0, T a1, T a2)
{ (*this)[0] = a0;
(*this)[1] = a1;
(*this)[2] = a2;
}
vec(T a0, T a1, T a2, T a3)
{ (*this)[0] = a0;
(*this)[1] = a1;
(*this)[2] = a2;
(*this)[3] = a3;
}
vec(T a0, T a1, T a2, T a3, T a4)
{ (*this)[0] = a0;
(*this)[1] = a1;
(*this)[2] = a2;
(*this)[3] = a3;
(*this)[4] = a4;
}
vec(T a0, T a1, T a2, T a3, T a4, T a5)
{ (*this)[0] = a0;
(*this)[1] = a1;
(*this)[2] = a2;
(*this)[3] = a3;
(*this)[4] = a4;
(*this)[5] = a5;
}
vec(T a0, T a1, T a2, T a3, T a4, T a5, T a6)
{ (*this)[0] = a0;
(*this)[1] = a1;
(*this)[2] = a2;
(*this)[3] = a3;
(*this)[4] = a4;
(*this)[5] = a5;
(*this)[6] = a6;
}
vec(T a0, T a1, T a2, T a3, T a4, T a5, T a6, T a7)
{ (*this)[0] = a0;
(*this)[1] = a1;
(*this)[2] = a2;
(*this)[3] = a3;
(*this)[4] = a4;
(*this)[5] = a5;
(*this)[6] = a6;
(*this)[7] = a7;
}
</pre>
<p>
<hr>
<p><a name="IF"></a><a href="tutorial.htm#IF"><b>EXAMPLE:</b></a>
Use BOOST_PP_IF to implement special case for the first element</p>
<pre>false == false;
true == true;
</pre>
<p>
<hr>
<p><a name="Arithmetic"></a><a href="tutorial.htm#Arithmetic"><B>EXAMPLE:</B></a> Use arithmetic, logical and comparison operations when necessary</p>
<pre>S, E0, E1
E0, S, E1
E0, E1, S
BAD PARAMS FOR SPECIAL_NUMBERED_LIST! E0, E1, E2, S</pre>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body>
</html>

View File

@ -1,48 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
<title>Boost.Preprocessor - Index</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Index</h2>
</td>
</tr>
</table>
<hr>
<h2>Contents</h2>
<dl class="index">
<dt><a href="tutorial.htm">Tutorial</a></dt>
<dt><a href="examples.htm">Examples</a></dt>
<dt><a href="reference/index.htm">Reference</a></dt>
<dt><a href="known_problems_with_cpp.htm">Widely known problems with the C preprocessor</a></dt>
<dt><a href="keywords.txt">Keywords for syntax highlighting</a></dt>
<dt><a href="problems_with_compilers.htm">Known problems with specific compilers</a></dt>
<dt><a href="bibliography.htm">Bibliography</a></dt>
<dt><a href="acknowledgements.htm">Acknowledgements</a></dt>
</dl>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body>
</html>

View File

@ -1,99 +0,0 @@
BOOST_PP_ADD
BOOST_PP_ADD_D
BOOST_PP_AND
BOOST_PP_ASSERT_MSG
BOOST_PP_BOOL
BOOST_PP_CAT
BOOST_PP_COMMA
BOOST_PP_COMMA_IF
BOOST_PP_DEC
BOOST_PP_DIV
BOOST_PP_DIV_D
BOOST_PP_EMPTY
BOOST_PP_ENUM
BOOST_PP_ENUM_PARAMS
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT
BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS
BOOST_PP_ENUM_SHIFTED
BOOST_PP_ENUM_SHIFTED_PARAMS
BOOST_PP_EQUAL
BOOST_PP_EQUAL_D
BOOST_PP_EXPAND
BOOST_PP_EXPR_IF
BOOST_PP_FOR
BOOST_PP_GREATER
BOOST_PP_GREATER_D
BOOST_PP_GREATER_EQUAL
BOOST_PP_GREATER_EQUAL_D
BOOST_PP_IDENTITY
BOOST_PP_IF
BOOST_PP_INC
BOOST_PP_LESS
BOOST_PP_LESS_D
BOOST_PP_LESS_EQUAL
BOOST_PP_LESS_EQUAL_D
BOOST_PP_LIMIT_DIM
BOOST_PP_LIMIT_MAG
BOOST_PP_LIMIT_TUPLE
BOOST_PP_LIST_APPEND
BOOST_PP_LIST_APPEND_D
BOOST_PP_LIST_AT
BOOST_PP_LIST_AT_D
BOOST_PP_LIST_CAT
BOOST_PP_LIST_CAT_D
BOOST_PP_LIST_CONS
BOOST_PP_LIST_ENUM
BOOST_PP_LIST_ENUM_R
BOOST_PP_LIST_FILTER
BOOST_PP_LIST_FILTER_D
BOOST_PP_LIST_FIRST
BOOST_PP_LIST_FIRST_N
BOOST_PP_LIST_FIRST_N_D
BOOST_PP_LIST_FOLD_LEFT
BOOST_PP_LIST_FOLD_LEFT_D
BOOST_PP_LIST_FOLD_RIGHT
BOOST_PP_LIST_FOLD_RIGHT_D
BOOST_PP_LIST_FOR_EACH
BOOST_PP_LIST_FOR_EACH_I
BOOST_PP_LIST_FOR_EACH_I_R
BOOST_PP_LIST_FOR_EACH_R
BOOST_PP_LIST_FOR_EACH_PRODUCT
BOOST_PP_LIST_FOR_EACH_PRODUCT_R
BOOST_PP_LIST_IS_CONS
BOOST_PP_LIST_IS_NIL
BOOST_PP_LIST_NIL
BOOST_PP_LIST_REST
BOOST_PP_LIST_REST_N
BOOST_PP_LIST_REST_N_D
BOOST_PP_LIST_REVERSE
BOOST_PP_LIST_REVERSE_D
BOOST_PP_LIST_SIZE
BOOST_PP_LIST_SIZE_D
BOOST_PP_LIST_TO_TUPLE
BOOST_PP_LIST_TO_TUPLE_R
BOOST_PP_LIST_TRANSFORM
BOOST_PP_LIST_TRANSFORM_D
BOOST_PP_MAX
BOOST_PP_MAX_D
BOOST_PP_MIN
BOOST_PP_MIN_D
BOOST_PP_MOD
BOOST_PP_MOD_D
BOOST_PP_MUL
BOOST_PP_MUL_D
BOOST_PP_NOR
BOOST_PP_NOT
BOOST_PP_NOT_EQUAL
BOOST_PP_NOT_EQUAL_D
BOOST_PP_OR
BOOST_PP_REPEAT
BOOST_PP_REPEAT_FROM_TO
BOOST_PP_STRINGIZE
BOOST_PP_SUB
BOOST_PP_SUB_D
BOOST_PP_TUPLE_EAT
BOOST_PP_TUPLE_ELEM
BOOST_PP_TUPLE_REVERSE
BOOST_PP_TUPLE_TO_LIST
BOOST_PP_WHILE
BOOST_PP_XOR

View File

@ -1,125 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
<title>Boost.Preprocessor - Widely known problems with the C preprocessor</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Widely known problems with the C preprocessor</h2>
</td>
</tr>
</table>
<hr>
<p>Preprocessor metaprogramming is subject to heated discussions. Part of this is caused by
bad experiences with dangerous techniques, such as defining inline functions using macros. As a rule
of thumb, if you can find a clean and
manageable way to do something without using the preprocessor, then
you should do it that way.</p>
<p>Let's survey some of the widely known problems with the preprocessor in a problem/solution
format.</p>
<HR>
<p><B>PROBLEM:</B>&nbsp;Preprocessor does not
respect scope, therefore macros can accidentally and sometimes silently replace
code.</p>
<p><B>SOLUTION A:</B> Use all caps identifiers
for macros and only macros. This practically eliminates the possibility that a
macro might replace other kind of code accidentally.</p>
<p><B>SOLUTION B:</B> Use the Local Macro
idiom:</p>
<pre>#define MACRO ...
// Use MACRO
#undef MACRO
</pre>
<p>This makes sure that a macro can not accidentally
replace code outside of the scope of the local macro.</p>
<P>A problem with this solution is&nbsp;that the #undef can not be automated and may be
forgotten. Experienced programmers generally write the #undef either immediately
before (in time) or immediately after writing the macro definition.</P>
<P><B>SOLUTION C:</B> Use the Unique Macro Prefix idiom:</P>
<pre>#define UMP_MACRO
// Use UMP_MACRO
</pre>
<P>This makes accidental substitution and collisions highly
unlikely. Problems with this solution:</P>
<UL>
<LI>
There can still be naming collisions inside a large project.
<LI>
Macros still pollute the global namespace. </LI></UL>
<P><EM><B>By combining all solutions, whenever
possible, the scope problem can be largely avoided.</B></EM></P>
<HR>
<P><B>PROBLEM:</B> &nbsp;Preprocessor code is difficult to read.
It requires understanding the basic process of how
the&nbsp;preprocessor recursively expands macros, finding the macro definition and mentally
substituting the parameters of the macro. </P>
<P><B>SOLUTION:</B> Any kind of programming requires basic understanding
of how the code is executed. Any parameterization technique, including simple
functions and templates requires finding the definition and mentally substituting
parameters. </P>
<P>However, it is good to know a few techniques:</P>
<UL>
<LI>
By using as many Local Macros as reasonable, the bulk of the searching
process can be eliminated.
<LI>
Code browsers and text search tools make it easier to find the
definitions.
<LI>
The compiler can be used for generating the preprocessed source code in
order to look for bugs.
<LI>
Before turning something into a&nbsp;preprocessor metaprogram, first
implement a small scale version of it without preprocessor. Then work
bottom-&gt;up replacing hand written constructs by using preprocessor. This
way you can test the code incrementally. Experienced programmers often skip
many stages, but if something proves too complex to write directly, it is
always possible to fall back to incremental methods.
<LI>
If you insert a special symbol into the preprocessor code in places where
there should be a line break, you can make code readable after preprocessing
simply by using a search and replace tool. </LI></UL>
<P><B><EM> An especially important thing to remember is to limit the use of&nbsp;preprocessor
to the structured, well understood and safe methods. Structure helps to understand
complex systems <A href="bibliography.htm#[McConnell]">[McConnell]</A>.</EM></B></P>
<HR>
<P><B>PROBLEM:</B> "I'd
like to see Cpp abolished." - Bjarne Stroustrup in&nbsp;<A href="bibliography.htm#[Stroustrup]">[Stroustrup]</A></P>
<P><B>SOLUTION:</B>&nbsp;The C preprocessor&nbsp;will be here for a
long time.</P>
<P><EM><B>In practice, preprocessor metaprogramming is far simpler and more portable
than template metaprogramming <A href="bibliography.htm#[Czarnecki]">[Czarnecki]</A>.</B></EM></P>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body>
</html>

View File

@ -1,138 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
<title>Boost.Preprocessor - Known problems with specific compilers</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Known problems with specific compilers</h2>
</td>
</tr>
</table>
<hr>
<p> Some compilers have buggy or limited preprocessors. This page explains known
problems with specific compilers.</p>
<hr>
<h2>Contents</h2>
<ul>
<li><a href="#Metrowerks Codewarrior 7.0">Metrowerks Codewarrior 7.0</a></li>
<li><a href="#Comeau C/C++ 4.2.45.2">Comeau C/C++ 4.2.45.2 for Windows</a></li>
</ul>
<HR>
<h3><a name="Metrowerks Codewarrior 7.0">Metrowerks Codewarrior 7.0</a></h3>
<p>Metrowerks Codewarrior 7.0 has a bug in preprocessor (to be more
concrete, in function-like macro replacement mechanism) that restricts usage
of the library to only very simple cases, at least if you don't write code that
specifically address this issue; for example, the above NUMBERED_EXPRESSION
example doesn't compile on CW 7.0. Below is a simple test case that reproduces
the bug:</p>
<pre>#define IDENTITY_MACRO(x) IDENTITY_MACRO_BODY(x)
#define IDENTITY_MACRO_BODY(x) x
#define COMMA_TOKEN() ,
int a IDENTITY_MACRO(COMMA_TOKEN)() b; // this works
int c IDENTITY_MACRO(IDENTITY_MACRO(COMMA_TOKEN))() d; // this doesn't
</pre>
<p>Basically, what's happening here is that function-like COMMA_TOKEN macro gets
expanded _inside_ of the nested IDENTITY_MACRO call - even although it's NOT
followed by a '(' as the next preprocessing token - which is a clearly an incorrect
behavior (see 16.3 [cpp.replace] para 9 for the detailed description of the
function-like macro replacement process). I've submitted a bug report, but they
haven't confirmed it yet.</p>
<p>So, this is not a problem of the library, but probably something that needs
to be mentioned in the documentation, may be with some examples of how to workaround
the issue. Just to show one possible way around the problem, here is a NUMBERED_EXPRESSION
macro that does work on MWCW:</p>
<pre>#define NUMBERED_EXPRESSION(n, x) \
BOOST_PP_CAT(BOOST_, \
BOOST_PP_IF( \
n \
, PREPROCESSOR_IDENTITY(x##n) \
, PREPROCESSOR_EMPTY \
))() \
/**/
</pre>
<p align="right"><i>Reported by Aleksey Gurtovoy</i></p>
<h3><a name="Comeau C/C++ 4.2.45.2">Comeau C/C++ 4.2.45.2 for Windows</a></h3>
<p>It appears that their algorithm of macro call invocation is quite far
from ideal, because for the following code fragment (which is a part of
<a href="../test/preprocessor_test.cpp">preprocessor_test.cpp</a>), the
linear increasing of IS_FUNCTION_HELPER_TEST_MAX value leads to not even
quadratic, but something like exponential increasing of compilation time!
(see the timing data below). This behavior may or may not be problematic
for you, depending on how intense is your usage of the library.
<pre>#ifndef IS_FUNCTION_HELPER_TEST_MAX
#define IS_FUNCTION_HELPER_TEST_MAX 40
#endif
typedef char yes_type;
#define IS_FUNCTION_HELPER(I,A)\
template\
&ltBOOST_PP_ENUM_PARAMS(BOOST_PP_INC(I),class P)&gt;\
yes_type is_function_helper(\
P0 (*)(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(I),P)));
BOOST_PP_REPEAT_2ND(BOOST_PP_INC(IS_FUNCTION_HELPER_TEST_MAX),IS_FUNCTION_HELPER,A)
#undef IS_FUNCTION_HELPER
</pre>
<h4>Timing data:</h4>
<table border="1">
<tr align="center">
<th>&nbsp;</th>
<th>Comeau C/C++ 4.2.45.2</th>
<th>Microsoft Visual C++ 6.0 SP5</th>
</tr>
<tr align="center">
<td>10 parameters</td>
<td><font color="red">&lt; 1 sec</font></td>
<td>&lt; 1 sec</td>
</tr>
<tr align="center">
<td>20 parameters</td>
<td><font color="red">~ 2 sec</font></td>
<td>&lt; 1 sec</td>
</tr>
<tr align="center">
<td>30 parameters</td>
<td><font color="red">~ 15 sec</font></td>
<td>&lt; 1 sec</td>
</tr>
<tr align="center">
<td>40 parameters</td>
<td><font color="red">~ 50 sec</font></td>
<td>&lt; 1 sec</td>
</tr>
</table>
<p align="right"><i>Reported by Aleksey Gurtovoy</i></p>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body>
</html>

View File

@ -1,41 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/arithmetic.hpp">boost/preprocessor/arithmetic.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="while.htm">Prev</a> <a href="arithmetic_add.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Includes all arithmetic headers.</p>
<hr>
<a href="while.htm">Prev</a> <a href="arithmetic_add.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/arithmetic/add.hpp">boost/preprocessor/arithmetic/add.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="arithmetic.htm">Prev</a> <a href="arithmetic_div.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_ADD">#define BOOST_PP_ADD</a>(X,Y)</h3>
<p>Expands to the sum of <code>X</code> and <code>Y</code>.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="arithmetic_add.htm#BOOST_PP_ADD">BOOST_PP_ADD</a>(4,3)</code> expands to <code>7</code> (a
single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_ADD_D">#define BOOST_PP_ADD_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="arithmetic.htm">Prev</a> <a href="arithmetic_div.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/arithmetic/div.hpp">boost/preprocessor/arithmetic/div.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="arithmetic_add.htm">Prev</a> <a href="arithmetic_mod.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_DIV">#define BOOST_PP_DIV</a>(X,Y)</h3>
<p>Expands to the quotient of <code>X</code> and <code>Y</code>.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="arithmetic_div.htm#BOOST_PP_DIV">BOOST_PP_DIV</a>(4,3)</code> expands to <code>1</code> (a
single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_DIV_D">#define BOOST_PP_DIV_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="arithmetic_add.htm">Prev</a> <a href="arithmetic_mod.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/arithmetic/mod.hpp">boost/preprocessor/arithmetic/mod.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="arithmetic_div.htm">Prev</a> <a href="arithmetic_mul.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_MOD">#define BOOST_PP_MOD</a>(X,Y)</h3>
<p>Expands to the remainder of <code>X</code> and <code>Y</code>.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="arithmetic_mod.htm#BOOST_PP_MOD">BOOST_PP_MOD</a>(4,3)</code> expands to <code>1</code> (a
single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_MOD_D">#define BOOST_PP_MOD_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="arithmetic_div.htm">Prev</a> <a href="arithmetic_mul.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/arithmetic/mul.hpp">boost/preprocessor/arithmetic/mul.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="arithmetic_mod.htm">Prev</a> <a href="arithmetic_sub.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_MUL">#define BOOST_PP_MUL</a>(X,Y)</h3>
<p>Expands to the product of <code>X</code> and <code>Y</code>.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="arithmetic_mul.htm#BOOST_PP_MUL">BOOST_PP_MUL</a>(4,3)</code> expands to <code>12</code> (a
single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_MUL_D">#define BOOST_PP_MUL_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="arithmetic_mod.htm">Prev</a> <a href="arithmetic_sub.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/arithmetic/sub.hpp">boost/preprocessor/arithmetic/sub.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="arithmetic_mul.htm">Prev</a> <a href="assert_msg.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_SUB">#define BOOST_PP_SUB</a>(X,Y)</h3>
<p>Expands to the difference of <code>X</code> and <code>Y</code>.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="arithmetic_sub.htm#BOOST_PP_SUB">BOOST_PP_SUB</a>(4,3)</code> expands to <code>1</code> (a
single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_SUB_D">#define BOOST_PP_SUB_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="arithmetic_mul.htm">Prev</a> <a href="assert_msg.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,49 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/assert_msg.hpp">boost/preprocessor/assert_msg.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="arithmetic_sub.htm">Prev</a> <a href="cat.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_ASSERT_MSG">#define BOOST_PP_ASSERT_MSG</a>(COND,MSG)</h3>
<p>Expands to nothing if <code>COND != 0</code> and to <code>MSG</code> if
<code>COND == 0</code>.</p>
<p><code>COND</code> must expand to an integer literal in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="assert_msg.htm#BOOST_PP_ASSERT_MSG">BOOST_PP_ASSERT_MSG</a>(1,A BUG!)</code> expands to <code>A BUG!</code>.</p>
<hr>
<a href="arithmetic_sub.htm">Prev</a> <a href="cat.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,57 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/cat.hpp">boost/preprocessor/cat.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="assert_msg.htm">Prev</a> <a href="comma.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_CAT">#define BOOST_PP_CAT</a>(X,Y)</h3>
<p>Concatenates <code>X</code> and <code>Y</code> after they are macro
expanded.</p>
<p>For example, <code><a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(A,<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(_,B))</code> expands to <code>A_B</code>.</p>
<h3>Example</h3>
<ul>
<li><a href="../../example/static_assert.c">static_assert.c</a></li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/preprocessor_test.cpp">preprocessor_test.cpp</a></li>
</ul>
<hr>
<a href="assert_msg.htm">Prev</a> <a href="comma.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,60 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/comma.hpp">boost/preprocessor/comma.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="cat.htm">Prev</a> <a href="comma_if.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_COMMA">#define BOOST_PP_COMMA</a>()</h3>
<p>Expands to a comma.</p>
<p>Commas need special handling in preprocessor code, because commas are used
for separating macro parameters.</p>
<p>For example,</p>
<pre>
<a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>(1,<a href="comma.htm#BOOST_PP_COMMA">BOOST_PP_COMMA</a>,<a href="empty.htm#BOOST_PP_EMPTY">BOOST_PP_EMPTY</a>)()
</pre>
<p>expands to a comma.</p>
<h3>See</h3>
<ul>
<li><a href="comma_if.htm#BOOST_PP_COMMA_IF">BOOST_PP_COMMA_IF</a>()</li>
</ul>
<hr>
<a href="cat.htm">Prev</a> <a href="comma_if.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,49 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/comma_if.hpp">boost/preprocessor/comma_if.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="comma.htm">Prev</a> <a href="comparison.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_COMMA_IF">#define BOOST_PP_COMMA_IF</a>(COND)</h3>
<p>Expands to a comma if <code>COND != 0</code> and nothing if
<code>COND == 0</code>.</p>
<p><code>COND</code> must expand to an integer literal in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="comma_if.htm#BOOST_PP_COMMA_IF">BOOST_PP_COMMA_IF</a>(0)</code> expands to nothing.</p>
<hr>
<a href="comma.htm">Prev</a> <a href="comparison.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,41 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/comparison.hpp">boost/preprocessor/comparison.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="comma_if.htm">Prev</a> <a href="comparison_equal.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Includes all comparison headers.</p>
<hr>
<a href="comma_if.htm">Prev</a> <a href="comparison_equal.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/comparison/equal.hpp">boost/preprocessor/comparison/equal.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="comparison.htm">Prev</a> <a href="comparison_greater.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_EQUAL">#define BOOST_PP_EQUAL</a>(X,Y)</h3>
<p>Expands to <code>1</code> if <code>X == Y</code> and <code>0</code>
otherwise.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="comparison_equal.htm#BOOST_PP_EQUAL">BOOST_PP_EQUAL</a>(4,4)</code> expands to <code>1</code>.</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_EQUAL_D">#define BOOST_PP_EQUAL_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="comparison.htm">Prev</a> <a href="comparison_greater.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/comparison/greater.hpp">boost/preprocessor/comparison/greater.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="comparison_equal.htm">Prev</a> <a href="comparison_greater_equal.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_GREATER">#define BOOST_PP_GREATER</a>(X,Y)</h3>
<p>Expands to <code>1</code> if <code>X &gt; Y</code> and <code>0</code>
otherwise.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="comparison_greater.htm#BOOST_PP_GREATER">BOOST_PP_GREATER</a>(4,3)</code> expands to <code>1</code>.</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_GREATER_D">#define BOOST_PP_GREATER_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="comparison_equal.htm">Prev</a> <a href="comparison_greater_equal.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/comparison/greater_equal.hpp">boost/preprocessor/comparison/greater_equal.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="comparison_greater.htm">Prev</a> <a href="comparison_less.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_GREATER_EQUAL">#define BOOST_PP_GREATER_EQUAL</a>(X,Y)</h3>
<p>Expands to <code>1</code> if <code>X &gt;= Y</code> and <code>0</code>
otherwise.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="comparison_greater_equal.htm#BOOST_PP_GREATER_EQUAL">BOOST_PP_GREATER_EQUAL</a>(1,3)</code> expands to <code>0</code>.</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_GREATER_EQUAL_D">#define BOOST_PP_GREATER_EQUAL_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="comparison_greater.htm">Prev</a> <a href="comparison_less.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/comparison/less.hpp">boost/preprocessor/comparison/less.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="comparison_greater_equal.htm">Prev</a> <a href="comparison_less_equal.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LESS">#define BOOST_PP_LESS</a>(X,Y)</h3>
<p>Expands to <code>1</code> if <code>X &lt; Y</code> and <code>0</code>
otherwise.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="comparison_less.htm#BOOST_PP_LESS">BOOST_PP_LESS</a>(2,6)</code> expands to <code>1</code>.</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LESS_D">#define BOOST_PP_LESS_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="comparison_greater_equal.htm">Prev</a> <a href="comparison_less_equal.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/comparison/less_equal.hpp">boost/preprocessor/comparison/less_equal.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="comparison_less.htm">Prev</a> <a href="comparison_not_equal.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LESS_EQUAL">#define BOOST_PP_LESS_EQUAL</a>(X,Y)</h3>
<p>Expands to <code>1</code> if <code>X &lt;= Y</code> and <code>0</code>
otherwise.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="comparison_less_equal.htm#BOOST_PP_LESS_EQUAL">BOOST_PP_LESS_EQUAL</a>(7,5)</code> expands to <code>0</code>.</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LESS_EQUAL_D">#define BOOST_PP_LESS_EQUAL_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="comparison_less.htm">Prev</a> <a href="comparison_not_equal.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/comparison/not_equal.hpp">boost/preprocessor/comparison/not_equal.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="comparison_less_equal.htm">Prev</a> <a href="dec.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_NOT_EQUAL">#define BOOST_PP_NOT_EQUAL</a>(X,Y)</h3>
<p>Expands to <code>1</code> if <code>X != Y</code> and <code>0</code>
otherwise.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="comparison_not_equal.htm#BOOST_PP_NOT_EQUAL">BOOST_PP_NOT_EQUAL</a>(4,4)</code> expands to <code>0</code>.</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_NOT_EQUAL_D">#define BOOST_PP_NOT_EQUAL_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="comparison_less_equal.htm">Prev</a> <a href="dec.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,52 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/dec.hpp">boost/preprocessor/dec.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="comparison_not_equal.htm">Prev</a> <a href="empty.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_DEC">#define BOOST_PP_DEC</a>(X)</h3>
<p>Decrements <code>X</code> expanding to a single token.</p>
<p>For example, <code><a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(3)</code> expands to <code>2</code> (a
single token).</p>
<p><a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>() uses saturation arithmetic. Decrementing 0 yeilds a 0.</p>
<p>Only decimal integer literals in the range [0,<a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>] are
supported.</p>
<hr>
<a href="comparison_not_equal.htm">Prev</a> <a href="empty.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,62 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/empty.hpp">boost/preprocessor/empty.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="dec.htm">Prev</a> <a href="enum.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_EMPTY">#define BOOST_PP_EMPTY</a>()</h3>
<p>Expands to nothing.</p>
<p>For example,</p>
<pre>
<a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>(0,<a href="comma.htm#BOOST_PP_COMMA">BOOST_PP_COMMA</a>,<a href="empty.htm#BOOST_PP_EMPTY">BOOST_PP_EMPTY</a>)()
</pre>
<p>expands to nothing.</p>
<h3>Example</h3>
<ul>
<li><a href="../../example/subscript_layer.cpp">subscript_layer.cpp</a></li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/preprocessor_test.cpp">preprocessor_test.cpp</a></li>
</ul>
<hr>
<a href="dec.htm">Prev</a> <a href="enum.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,81 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/enum.hpp">boost/preprocessor/enum.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="empty.htm">Prev</a> <a href="enum_params.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_ENUM">#define BOOST_PP_ENUM</a>(COUNT,MACRO,DATA)</h3>
<p>Generates a comma separated list.</p>
<p>In other words, expands to the sequence:</p>
<pre>
MACRO(0,DATA), MACRO(1,DATA), ..., MACRO(<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(COUNT),DATA)
</pre>
<p>For example,</p>
<pre>
#define TYPED_PARAM(INDEX,DATA)\
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,DATA),INDEX) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,DATA),INDEX)
<a href="enum.htm#BOOST_PP_ENUM">BOOST_PP_ENUM</a>(3,TYPED_PARAM,(X,x))
</pre>
<p>expands to:</p>
<pre>
X0 x0, X1 x1, X2 x2
</pre>
<h3>2D and 3D repetition</h3>
<p><a href="enum.htm#BOOST_PP_ENUM">BOOST_PP_ENUM</a>() implements automatic recursion. 2D and 3D repetition
are directly supported.</p>
<h3>See</h3>
<ul>
<li><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>()</li>
<li><a href="limits.htm#BOOST_PP_LIMIT_DIM">BOOST_PP_LIMIT_DIM</a></li>
<li><a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a></li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/repeat_test.cpp">repeat_test.cpp</a></li>
</ul>
<hr>
<a href="empty.htm">Prev</a> <a href="enum_params.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,72 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/enum_params.hpp">boost/preprocessor/enum_params.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="enum.htm">Prev</a> <a href="enum_params_with_a_default.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_ENUM_PARAMS">#define BOOST_PP_ENUM_PARAMS</a>(COUNT,PARAM)</h3>
<p>Generates a comma separated list of parameters.</p>
<p>In other words, expands to the sequence:</p>
<pre>
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,0), <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,1), ..., <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(COUNT))
</pre>
<p>For example,</p>
<pre>
<a href="enum_params.htm#BOOST_PP_ENUM_PARAMS">BOOST_PP_ENUM_PARAMS</a>(3,x)
</pre>
<p>expands to:</p>
<pre>
x0, x1, x2
</pre>
<h3>Uses</h3>
<ul>
<li><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>()</li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/repeat_test.cpp">repeat_test.cpp</a></li>
</ul>
<hr>
<a href="enum.htm">Prev</a> <a href="enum_params_with_a_default.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,75 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/enum_params_with_a_default.hpp">boost/preprocessor/enum_params_with_a_default.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="enum_params.htm">Prev</a> <a href="enum_params_with_defaults.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT">#define BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT</a>(COUNT,PARAM,DEFAULT)</h3>
<p>Generates a comma separated list of parameters with a default.</p>
<p>In other words, expands to the sequence:</p>
<pre>
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,0) = DEFAULT,
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,1) = DEFAULT,
...,
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(COUNT)) = DEFAULT
</pre>
<p>For example,</p>
<pre>
<a href="enum_params_with_a_default.htm#BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT">BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT</a>(3,x,y)
</pre>
<p>expands to:</p>
<pre>
x0 = y, x1 = y, x2 = y
</pre>
<h3>Uses</h3>
<ul>
<li><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>()</li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/repeat_test.cpp">repeat_test.cpp</a></li>
</ul>
<hr>
<a href="enum_params.htm">Prev</a> <a href="enum_params_with_defaults.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,75 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/enum_params_with_defaults.hpp">boost/preprocessor/enum_params_with_defaults.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="enum_params_with_a_default.htm">Prev</a> <a href="enum_shifted.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS">#define BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS</a>(COUNT,PARAM,DEFAULT)</h3>
<p>Generates a comma separated list of parameters with defaults.</p>
<p>In other words, expands to the sequence:</p>
<pre>
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,0) = <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(DEFAULT,0),
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,1) = <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(DEFAULT,1),
...,
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(COUNT)) = <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(DEFAULT,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(COUNT))
</pre>
<p>For example,</p>
<pre>
<a href="enum_params_with_defaults.htm#BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS">BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS</a>(3,x,y)
</pre>
<p>expands to:</p>
<pre>
x0 = y0, x1 = y1, x2 = y2
</pre>
<h3>Uses</h3>
<ul>
<li><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>()</li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/repeat_test.cpp">repeat_test.cpp</a></li>
</ul>
<hr>
<a href="enum_params_with_a_default.htm">Prev</a> <a href="enum_shifted.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,69 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/enum_shifted.hpp">boost/preprocessor/enum_shifted.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="enum_params_with_defaults.htm">Prev</a> <a href="enum_shifted_params.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_ENUM_SHIFTED">#define BOOST_PP_ENUM_SHIFTED</a>(COUNT,MACRO,DATA)</h3>
<p>Generates a comma separated shifted list.</p>
<p>In other words, expands to the sequence:</p>
<pre>
MACRO(1,DATA), MACRO(2,DATA), ..., MACRO(<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(COUNT),DATA)
</pre>
<p>For example,</p>
<pre>
#define TYPED_PARAM(INDEX,DATA)\
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,DATA),INDEX) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,DATA),INDEX)
<a href="enum_shifted.htm#BOOST_PP_ENUM_SHIFTED">BOOST_PP_ENUM_SHIFTED</a>(3,TYPED_PARAM,(X,x))
</pre>
<p>expands to:</p>
<pre>
X1 x1, X2 x2
</pre>
<h3>Uses</h3>
<ul>
<li><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>()</li>
</ul>
<hr>
<a href="enum_params_with_defaults.htm">Prev</a> <a href="enum_shifted_params.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,77 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/enum_shifted_params.hpp">boost/preprocessor/enum_shifted_params.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="enum_shifted.htm">Prev</a> <a href="expand.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_ENUM_SHIFTED_PARAMS">#define BOOST_PP_ENUM_SHIFTED_PARAMS</a>(COUNT,PARAM)</h3>
<p>Generates a comma separated list of shifted actual parameters.</p>
<p>In other words, expands to the sequence:</p>
<pre>
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,1), <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,2), ..., <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(PARAM,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(COUNT))
</pre>
<p>For example,</p>
<pre>
<a href="enum_shifted_params.htm#BOOST_PP_ENUM_SHIFTED_PARAMS">BOOST_PP_ENUM_SHIFTED_PARAMS</a>(3,x)
</pre>
<p>expands to:</p>
<pre>
x1, x2
</pre>
<h3>Uses</h3>
<ul>
<li><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>()</li>
</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>
<h3>Test</h3>
<ul>
<li><a href="../../test/repeat_2nd_test.cpp">repeat_2nd_test.cpp</a></li>
</ul>
<hr>
<a href="enum_shifted.htm">Prev</a> <a href="expand.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,43 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/expand.hpp">boost/preprocessor/expand.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="enum_shifted_params.htm">Prev</a> <a href="expr_if.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_EXPAND">#define BOOST_PP_EXPAND</a>(X)</h3>
<p>Essentially macro expands the parameter <code>X</code> twice.</p>
<hr>
<a href="enum_shifted_params.htm">Prev</a> <a href="expr_if.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,53 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/expr_if.hpp">boost/preprocessor/expr_if.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="expand.htm">Prev</a> <a href="for.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_EXPR_IF">#define BOOST_PP_EXPR_IF</a>(COND,EXPR)</h3>
<p>Expands to <code>EXPR</code> if <code>COND != 0</code> and to nothing if <code>COND == 0</code>.</p>
<p><code>COND</code> must expand to an integer literal in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="expr_if.htm#BOOST_PP_EXPR_IF">BOOST_PP_EXPR_IF</a>(1,^)</code> expands to <code>^</code>.</p>
<h3>See</h3>
<ul>
<li><a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>()</li>
</ul>
<hr>
<a href="expand.htm">Prev</a> <a href="for.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,114 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/for.hpp">boost/preprocessor/for.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="expr_if.htm">Prev</a> <a href="identity.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_FOR">#define BOOST_PP_FOR</a>(STATE,PRED,OP,MACRO)</h3>
<p>Repeats <code>MACRO(R,STATE)</code> and iterates <code>OP(R,STATE)</code> while
<code>PRED(R,STATE)</code> is true.</p>
<p>In other words, expands to the sequence:</p>
<pre>
MACRO(R,STATE)
MACRO(R,OP(R,STATE))
MACRO(R,OP(R,OP(R,STATE)))
...
MACRO(R,OP(R,OP(...OP(R,STATE)...)))
</pre>
<p>The length of the sequence is determined by <code>PRED(R,STATE)</code>.</p>
<p>For example,</p>
<pre>
#define PRED(R,STATE) <a href="comparison_less.htm#BOOST_PP_LESS">BOOST_PP_LESS</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,STATE),<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,STATE))
#define OP(R,STATE) (<a href="inc.htm#BOOST_PP_INC">BOOST_PP_INC</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,STATE)),<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,STATE))
#define MACRO(R,STATE) <a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,STATE)
<a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>((0,3),PRED,OP,MACRO)
</pre>
<p>expands to:</p>
<pre>
0 1 2
</pre>
<h3>Legend</h3>
<ul>
<li><b>STATE</b> is the current state of iteration. The state is usually a tuple.</li>
<li><b>PRED</b> is the condition for iteration. It must expand to a decimal
integer literal.</li>
<li><b>OP</b> is the iterated macro. Note that if the state is a tuple, then
OP(R,STATE) usually expands to a tuple of the same number of elements.</li>
<li><b>MACRO</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 <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() or for invoking <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>##R()
directly. For each macro using <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>(), e.g. <a href="list_for_each.htm#BOOST_PP_LIST_FOR_EACH">BOOST_PP_LIST_FOR_EACH</a>(),
there is a version of the macro, e.g. <a href="list_for_each.htm#BOOST_PP_LIST_FOR_EACH_R">BOOST_PP_LIST_FOR_EACH_R</a>(), 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.</li>
</ul>
<h3><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>() vs <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>()</h3>
<p><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() is a generalization of <a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>(). This means that
<a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>() can be implemented using <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>(). However,
<a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>() was introduced earlier, is generally easier to use, and is
still quite useful on its own.</p>
<h3>2D and 3D repetition</h3>
<p><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() can be used for multidimensional repetition simply by
invoking <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>##R() directly.</p>
<h3>Automatic recursion?</h3>
<p><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() currently does not implement automatic recursion. The reason
for this is that it would lead to very poor performance. The automatic recursion
technique takes O(N) steps just to find out that the Nth recursion should be used.
This would dramatically effect the time complexity of macros using automatic
recursion.</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/for_test.cpp">for_test.cpp</a></li>
</ul>
<hr>
<a href="expr_if.htm">Prev</a> <a href="identity.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,64 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/identity.hpp">boost/preprocessor/identity.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="for.htm">Prev</a> <a href="if.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_IDENTITY">#define BOOST_PP_IDENTITY</a>(X)</h3>
<p>Expands to <code>X</code> once invoked.</p>
<p>Designed to be used with <a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>(), when one of the clauses need to be
invoked.</p>
<p>For example,</p>
<pre>
<a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>(1,<a href="identity.htm#BOOST_PP_IDENTITY">BOOST_PP_IDENTITY</a>(X),<a href="empty.htm#BOOST_PP_EMPTY">BOOST_PP_EMPTY</a>)<b>()</b>
</pre>
<p>expands to:</p>
<pre>
X
</pre>
<h3>Test</h3>
<ul>
<li><a href="../../test/preprocessor_test.cpp">preprocessor_test.cpp</a></li>
</ul>
<hr>
<a href="for.htm">Prev</a> <a href="if.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/if.hpp">boost/preprocessor/if.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="identity.htm">Prev</a> <a href="inc.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_IF">#define BOOST_PP_IF</a>(COND,THEN,ELSE)</h3>
<p>Expands to <code>THEN</code> if <code>COND != 0</code> and <code>ELSE</code> if
<code>COND == 0</code>.</p>
<p><code>COND</code> must expand to an integer literal in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>(0,1,2)</code> expands to <code>2</code>.</p>
<h3>See</h3>
<ul>
<li><a href="expr_if.htm#BOOST_PP_EXPR_IF">BOOST_PP_EXPR_IF</a>()</li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/preprocessor_test.cpp">preprocessor_test.cpp</a></li>
</ul>
<hr>
<a href="identity.htm">Prev</a> <a href="inc.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,53 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/inc.hpp">boost/preprocessor/inc.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="if.htm">Prev</a> <a href="limits.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_INC">#define BOOST_PP_INC</a>(X)</h3>
<p>Increments <code>X</code> expanding to a single token.</p>
<p>For example, <code><a href="inc.htm#BOOST_PP_INC">BOOST_PP_INC</a>(3)</code> expands to <code>4</code> (a
single token).</p>
<p><a href="inc.htm#BOOST_PP_INC">BOOST_PP_INC</a>() uses saturation arithmetic. Incrementing a
<a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a> yields a <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>.</p>
<p>Only decimal integer literals in the range [0,<a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>] are
supported.</p>
<hr>
<a href="if.htm">Prev</a> <a href="limits.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,225 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Reference</h2>
</td>
</tr>
</table>
<hr>
<h2><a name="Macros">Macros</a> (<a href="#Headers">Headers</a>)</h2>
<dl>
<dt><a href="arithmetic_add.htm#BOOST_PP_ADD">BOOST_PP_ADD</a></dt>
<dt><a href="arithmetic_add.htm#BOOST_PP_ADD_D">BOOST_PP_ADD_D</a></dt>
<dt><a href="logical_and.htm#BOOST_PP_AND">BOOST_PP_AND</a></dt>
<dt><a href="assert_msg.htm#BOOST_PP_ASSERT_MSG">BOOST_PP_ASSERT_MSG</a></dt>
<dt><a href="logical_bool.htm#BOOST_PP_BOOL">BOOST_PP_BOOL</a></dt>
<dt><a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a></dt>
<dt><a href="comma.htm#BOOST_PP_COMMA">BOOST_PP_COMMA</a></dt>
<dt><a href="comma_if.htm#BOOST_PP_COMMA_IF">BOOST_PP_COMMA_IF</a></dt>
<dt><a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a></dt>
<dt><a href="arithmetic_div.htm#BOOST_PP_DIV">BOOST_PP_DIV</a></dt>
<dt><a href="arithmetic_div.htm#BOOST_PP_DIV_D">BOOST_PP_DIV_D</a></dt>
<dt><a href="empty.htm#BOOST_PP_EMPTY">BOOST_PP_EMPTY</a></dt>
<dt><a href="enum.htm#BOOST_PP_ENUM">BOOST_PP_ENUM</a></dt>
<dt><a href="enum_params.htm#BOOST_PP_ENUM_PARAMS">BOOST_PP_ENUM_PARAMS</a></dt>
<dt><a href="enum_params_with_a_default.htm#BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT">BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT</a></dt>
<dt><a href="enum_params_with_defaults.htm#BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS">BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS</a></dt>
<dt><a href="enum_shifted.htm#BOOST_PP_ENUM_SHIFTED">BOOST_PP_ENUM_SHIFTED</a></dt>
<dt><a href="enum_shifted_params.htm#BOOST_PP_ENUM_SHIFTED_PARAMS">BOOST_PP_ENUM_SHIFTED_PARAMS</a></dt>
<dt><a href="comparison_equal.htm#BOOST_PP_EQUAL">BOOST_PP_EQUAL</a></dt>
<dt><a href="comparison_equal.htm#BOOST_PP_EQUAL_D">BOOST_PP_EQUAL_D</a></dt>
<dt><a href="expand.htm#BOOST_PP_EXPAND">BOOST_PP_EXPAND</a></dt>
<dt><a href="expr_if.htm#BOOST_PP_EXPR_IF">BOOST_PP_EXPR_IF</a></dt>
<dt><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a></dt>
<dt><a href="comparison_greater.htm#BOOST_PP_GREATER">BOOST_PP_GREATER</a></dt>
<dt><a href="comparison_greater.htm#BOOST_PP_GREATER_D">BOOST_PP_GREATER_D</a></dt>
<dt><a href="comparison_greater_equal.htm#BOOST_PP_GREATER_EQUAL">BOOST_PP_GREATER_EQUAL</a></dt>
<dt><a href="comparison_greater_equal.htm#BOOST_PP_GREATER_EQUAL_D">BOOST_PP_GREATER_EQUAL_D</a></dt>
<dt><a href="identity.htm#BOOST_PP_IDENTITY">BOOST_PP_IDENTITY</a></dt>
<dt><a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a></dt>
<dt><a href="inc.htm#BOOST_PP_INC">BOOST_PP_INC</a></dt>
<dt><a href="comparison_less.htm#BOOST_PP_LESS">BOOST_PP_LESS</a></dt>
<dt><a href="comparison_less.htm#BOOST_PP_LESS_D">BOOST_PP_LESS_D</a></dt>
<dt><a href="comparison_less_equal.htm#BOOST_PP_LESS_EQUAL">BOOST_PP_LESS_EQUAL</a></dt>
<dt><a href="comparison_less_equal.htm#BOOST_PP_LESS_EQUAL_D">BOOST_PP_LESS_EQUAL_D</a></dt>
<dt><a href="limits.htm#BOOST_PP_LIMIT_DIM">BOOST_PP_LIMIT_DIM</a></dt>
<dt><a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a></dt>
<dt><a href="limits.htm#BOOST_PP_LIMIT_TUPLE">BOOST_PP_LIMIT_TUPLE</a></dt>
<dt><a href="list_append.htm#BOOST_PP_LIST_APPEND">BOOST_PP_LIST_APPEND</a></dt>
<dt><a href="list_append.htm#BOOST_PP_LIST_APPEND_D">BOOST_PP_LIST_APPEND_D</a></dt>
<dt><a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a></dt>
<dt><a href="list_at.htm#BOOST_PP_LIST_AT_D">BOOST_PP_LIST_AT_D</a></dt>
<dt><a href="list_cat.htm#BOOST_PP_LIST_CAT">BOOST_PP_LIST_CAT</a></dt>
<dt><a href="list_cat.htm#BOOST_PP_LIST_CAT_D">BOOST_PP_LIST_CAT_D</a></dt>
<dt><a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a></dt>
<dt><a href="list_enum.htm#BOOST_PP_LIST_ENUM">BOOST_PP_LIST_ENUM</a></dt>
<dt><a href="list_enum.htm#BOOST_PP_LIST_ENUM_R">BOOST_PP_LIST_ENUM_R</a></dt>
<dt><a href="list_filter.htm#BOOST_PP_LIST_FILTER">BOOST_PP_LIST_FILTER</a></dt>
<dt><a href="list_filter.htm#BOOST_PP_LIST_FILTER_D">BOOST_PP_LIST_FILTER_D</a></dt>
<dt><a href="list_adt.htm#BOOST_PP_LIST_FIRST">BOOST_PP_LIST_FIRST</a></dt>
<dt><a href="list_first_n.htm#BOOST_PP_LIST_FIRST_N">BOOST_PP_LIST_FIRST_N</a></dt>
<dt><a href="list_first_n.htm#BOOST_PP_LIST_FIRST_N_D">BOOST_PP_LIST_FIRST_N_D</a></dt>
<dt><a href="list_fold_left.htm#BOOST_PP_LIST_FOLD_LEFT">BOOST_PP_LIST_FOLD_LEFT</a></dt>
<dt><a href="list_fold_left.htm#BOOST_PP_LIST_FOLD_LEFT_2ND">BOOST_PP_LIST_FOLD_LEFT_2ND</a></dt>
<dt><a href="list_fold_left.htm#BOOST_PP_LIST_FOLD_LEFT_2ND_D">BOOST_PP_LIST_FOLD_LEFT_2ND_D</a></dt>
<dt><a href="list_fold_left.htm#BOOST_PP_LIST_FOLD_LEFT_D">BOOST_PP_LIST_FOLD_LEFT_D</a></dt>
<dt><a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT">BOOST_PP_LIST_FOLD_RIGHT</a></dt>
<dt><a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT_2ND">BOOST_PP_LIST_FOLD_RIGHT_2ND</a></dt>
<dt><a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT_2ND_D">BOOST_PP_LIST_FOLD_RIGHT_2ND_D</a></dt>
<dt><a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT_D">BOOST_PP_LIST_FOLD_RIGHT_D</a></dt>
<dt><a href="list_for_each.htm#BOOST_PP_LIST_FOR_EACH">BOOST_PP_LIST_FOR_EACH</a></dt>
<dt><a href="list_for_each_i.htm#BOOST_PP_LIST_FOR_EACH_I">BOOST_PP_LIST_FOR_EACH_I</a></dt>
<dt><a href="list_for_each_i.htm#BOOST_PP_LIST_FOR_EACH_I_R">BOOST_PP_LIST_FOR_EACH_I_R</a></dt>
<dt><a href="list_for_each_product.htm#BOOST_PP_LIST_FOR_EACH_PRODUCT">BOOST_PP_LIST_FOR_EACH_PRODUCT</a></dt>
<dt><a href="list_for_each_product.htm#BOOST_PP_LIST_FOR_EACH_PRODUCT_R">BOOST_PP_LIST_FOR_EACH_PRODUCT_R</a></dt>
<dt><a href="list_for_each.htm#BOOST_PP_LIST_FOR_EACH_R">BOOST_PP_LIST_FOR_EACH_R</a></dt>
<dt><a href="list_adt.htm#BOOST_PP_LIST_IS_CONS">BOOST_PP_LIST_IS_CONS</a></dt>
<dt><a href="list_adt.htm#BOOST_PP_LIST_IS_NIL">BOOST_PP_LIST_IS_NIL</a></dt>
<dt><a href="list_adt.htm#BOOST_PP_LIST_NIL">BOOST_PP_LIST_NIL</a></dt>
<dt><a href="list_adt.htm#BOOST_PP_LIST_REST">BOOST_PP_LIST_REST</a></dt>
<dt><a href="list_rest_n.htm#BOOST_PP_LIST_REST_N">BOOST_PP_LIST_REST_N</a></dt>
<dt><a href="list_rest_n.htm#BOOST_PP_LIST_REST_N_D">BOOST_PP_LIST_REST_N_D</a></dt>
<dt><a href="list_reverse.htm#BOOST_PP_LIST_REVERSE">BOOST_PP_LIST_REVERSE</a></dt>
<dt><a href="list_reverse.htm#BOOST_PP_LIST_REVERSE_D">BOOST_PP_LIST_REVERSE_D</a></dt>
<dt><a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a></dt>
<dt><a href="list_size.htm#BOOST_PP_LIST_SIZE_D">BOOST_PP_LIST_SIZE_D</a></dt>
<dt><a href="list_to_tuple.htm#BOOST_PP_LIST_TO_TUPLE">BOOST_PP_LIST_TO_TUPLE</a></dt>
<dt><a href="list_to_tuple.htm#BOOST_PP_LIST_TO_TUPLE_R">BOOST_PP_LIST_TO_TUPLE_R</a></dt>
<dt><a href="list_transform.htm#BOOST_PP_LIST_TRANSFORM">BOOST_PP_LIST_TRANSFORM</a></dt>
<dt><a href="list_transform.htm#BOOST_PP_LIST_TRANSFORM_D">BOOST_PP_LIST_TRANSFORM_D</a></dt>
<dt><a href="max.htm#BOOST_PP_MAX">BOOST_PP_MAX</a></dt>
<dt><a href="max.htm#BOOST_PP_MAX_D">BOOST_PP_MAX_D</a></dt>
<dt><a href="min.htm#BOOST_PP_MIN">BOOST_PP_MIN</a></dt>
<dt><a href="min.htm#BOOST_PP_MIN_D">BOOST_PP_MIN_D</a></dt>
<dt><a href="arithmetic_mod.htm#BOOST_PP_MOD">BOOST_PP_MOD</a></dt>
<dt><a href="arithmetic_mod.htm#BOOST_PP_MOD_D">BOOST_PP_MOD_D</a></dt>
<dt><a href="arithmetic_mul.htm#BOOST_PP_MUL">BOOST_PP_MUL</a></dt>
<dt><a href="arithmetic_mul.htm#BOOST_PP_MUL_D">BOOST_PP_MUL_D</a></dt>
<dt><a href="logical_nor.htm#BOOST_PP_NOR">BOOST_PP_NOR</a></dt>
<dt><a href="logical_not.htm#BOOST_PP_NOT">BOOST_PP_NOT</a></dt>
<dt><a href="comparison_not_equal.htm#BOOST_PP_NOT_EQUAL">BOOST_PP_NOT_EQUAL</a></dt>
<dt><a href="comparison_not_equal.htm#BOOST_PP_NOT_EQUAL_D">BOOST_PP_NOT_EQUAL_D</a></dt>
<dt><a href="logical_or.htm#BOOST_PP_OR">BOOST_PP_OR</a></dt>
<dt><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a></dt>
<dt><a href="repeat.htm#BOOST_PP_REPEAT_2ND">BOOST_PP_REPEAT_2ND</a></dt>
<dt><a href="repeat.htm#BOOST_PP_REPEAT_3RD">BOOST_PP_REPEAT_3RD</a></dt>
<dt><a href="repeat_from_to.htm#BOOST_PP_REPEAT_FROM_TO">BOOST_PP_REPEAT_FROM_TO</a></dt>
<dt><a href="repeat_from_to.htm#BOOST_PP_REPEAT_FROM_TO_2ND">BOOST_PP_REPEAT_FROM_TO_2ND</a></dt>
<dt><a href="repeat_from_to.htm#BOOST_PP_REPEAT_FROM_TO_3RD">BOOST_PP_REPEAT_FROM_TO_3RD</a></dt>
<dt><a href="stringize.htm#BOOST_PP_STRINGIZE">BOOST_PP_STRINGIZE</a></dt>
<dt><a href="arithmetic_sub.htm#BOOST_PP_SUB">BOOST_PP_SUB</a></dt>
<dt><a href="arithmetic_sub.htm#BOOST_PP_SUB_D">BOOST_PP_SUB_D</a></dt>
<dt><a href="tuple_eat.htm#BOOST_PP_TUPLE_EAT">BOOST_PP_TUPLE_EAT</a></dt>
<dt><a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a></dt>
<dt><a href="tuple_reverse.htm#BOOST_PP_TUPLE_REVERSE">BOOST_PP_TUPLE_REVERSE</a></dt>
<dt><a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a></dt>
<dt><a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a></dt>
<dt><a href="logical_xor.htm#BOOST_PP_XOR">BOOST_PP_XOR</a></dt>
</dl>
<hr>
<h2><a name="Headers">Headers</a> (<a href="#Macros">Macros</a>)</h2>
<dl>
<dt>#include &lt;<a href="arithmetic.htm">boost/preprocessor/arithmetic.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="arithmetic_add.htm">boost/preprocessor/arithmetic/add.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="arithmetic_div.htm">boost/preprocessor/arithmetic/div.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="arithmetic_mod.htm">boost/preprocessor/arithmetic/mod.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="arithmetic_mul.htm">boost/preprocessor/arithmetic/mul.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="arithmetic_sub.htm">boost/preprocessor/arithmetic/sub.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="assert_msg.htm">boost/preprocessor/assert_msg.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="cat.htm">boost/preprocessor/cat.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="comma.htm">boost/preprocessor/comma.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="comma_if.htm">boost/preprocessor/comma_if.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="comparison.htm">boost/preprocessor/comparison.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="comparison_equal.htm">boost/preprocessor/comparison/equal.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="comparison_greater.htm">boost/preprocessor/comparison/greater.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="comparison_greater_equal.htm">boost/preprocessor/comparison/greater_equal.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="comparison_less.htm">boost/preprocessor/comparison/less.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="comparison_less_equal.htm">boost/preprocessor/comparison/less_equal.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="comparison_not_equal.htm">boost/preprocessor/comparison/not_equal.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="dec.htm">boost/preprocessor/dec.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="empty.htm">boost/preprocessor/empty.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="enum.htm">boost/preprocessor/enum.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="enum_params.htm">boost/preprocessor/enum_params.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="enum_params_with_a_default.htm">boost/preprocessor/enum_params_with_a_default.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="enum_params_with_defaults.htm">boost/preprocessor/enum_params_with_defaults.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="enum_shifted.htm">boost/preprocessor/enum_shifted.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="enum_shifted_params.htm">boost/preprocessor/enum_shifted_params.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="expand.htm">boost/preprocessor/expand.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="expr_if.htm">boost/preprocessor/expr_if.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="for.htm">boost/preprocessor/for.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="identity.htm">boost/preprocessor/identity.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="if.htm">boost/preprocessor/if.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="inc.htm">boost/preprocessor/inc.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="limits.htm">boost/preprocessor/limits.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list.htm">boost/preprocessor/list.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_adt.htm">boost/preprocessor/list/adt.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_append.htm">boost/preprocessor/list/append.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_at.htm">boost/preprocessor/list/at.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_cat.htm">boost/preprocessor/list/cat.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_enum.htm">boost/preprocessor/list/enum.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_filter.htm">boost/preprocessor/list/filter.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_first_n.htm">boost/preprocessor/list/first_n.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_fold_left.htm">boost/preprocessor/list/fold_left.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_fold_left_2nd.htm">boost/preprocessor/list/fold_left_2nd.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_fold_right.htm">boost/preprocessor/list/fold_right.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_fold_right_2nd.htm">boost/preprocessor/list/fold_right_2nd.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_for_each.htm">boost/preprocessor/list/for_each.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_for_each_i.htm">boost/preprocessor/list/for_each_i.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_for_each_product.htm">boost/preprocessor/list/for_each_product.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_rest_n.htm">boost/preprocessor/list/rest_n.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_reverse.htm">boost/preprocessor/list/reverse.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_size.htm">boost/preprocessor/list/size.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_to_tuple.htm">boost/preprocessor/list/to_tuple.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="list_transform.htm">boost/preprocessor/list/transform.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="logical.htm">boost/preprocessor/logical.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="logical_and.htm">boost/preprocessor/logical/and.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="logical_bool.htm">boost/preprocessor/logical/bool.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="logical_nor.htm">boost/preprocessor/logical/nor.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="logical_not.htm">boost/preprocessor/logical/not.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="logical_or.htm">boost/preprocessor/logical/or.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="logical_xor.htm">boost/preprocessor/logical/xor.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="max.htm">boost/preprocessor/max.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="min.htm">boost/preprocessor/min.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="repeat.htm">boost/preprocessor/repeat.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="repeat_2nd.htm">boost/preprocessor/repeat_2nd.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="repeat_3rd.htm">boost/preprocessor/repeat_3rd.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="repeat_from_to.htm">boost/preprocessor/repeat_from_to.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="repeat_from_to_2nd.htm">boost/preprocessor/repeat_from_to_2nd.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="repeat_from_to_3rd.htm">boost/preprocessor/repeat_from_to_3rd.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="stringize.htm">boost/preprocessor/stringize.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="tuple.htm">boost/preprocessor/tuple.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="tuple_eat.htm">boost/preprocessor/tuple/eat.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="tuple_elem.htm">boost/preprocessor/tuple/elem.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="tuple_reverse.htm">boost/preprocessor/tuple/reverse.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="tuple_to_list.htm">boost/preprocessor/tuple/to_list.hpp</a>&gt;</dt>
<dt>#include &lt;<a href="while.htm">boost/preprocessor/while.hpp</a>&gt;</dt>
</dl>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,71 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/limits.hpp">boost/preprocessor/limits.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="inc.htm">Prev</a> <a href="list.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIMIT_DIM">#define BOOST_PP_LIMIT_DIM</a></h3>
<p>Expands to the number of dimensions of repeat supported by the
library.</p>
<p>This concerns the repetition primitives (<a href="enum.htm#BOOST_PP_ENUM">BOOST_PP_ENUM</a>(),
<a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>() and <a href="repeat_from_to.htm#BOOST_PP_REPEAT_FROM_TO">BOOST_PP_REPEAT_FROM_TO</a>()).</p>
<hr>
<h3><a name="BOOST_PP_LIMIT_MAG">#define BOOST_PP_LIMIT_MAG</a></h3>
<p>Expands to the maximum straight numeric literal supported by the
library.</p>
<p>This is also the limit of the repetition primitives (<a href="enum.htm#BOOST_PP_ENUM">BOOST_PP_ENUM</a>(),
<a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>() and <a href="repeat_from_to.htm#BOOST_PP_REPEAT_FROM_TO">BOOST_PP_REPEAT_FROM_TO</a>()).</p>
<h3>Note</h3>
<ul>
<li>Only decimal integer literals in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>]
are supported.</li>
<li>All arithmetic operations (<a href="arithmetic_add.htm#BOOST_PP_ADD">BOOST_PP_ADD</a>(), <a href="arithmetic_sub.htm#BOOST_PP_SUB">BOOST_PP_SUB</a>(),
<a href="arithmetic_mul.htm#BOOST_PP_MUL">BOOST_PP_MUL</a>(), <a href="arithmetic_div.htm#BOOST_PP_DIV">BOOST_PP_DIV</a>()) use saturation arithmetic.</li>
<li>The maximum repetition count supported by the library may not be reached
due to compiler limitations.</li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIMIT_TUPLE">#define BOOST_PP_LIMIT_TUPLE</a></h3>
<p>Expands to the maximum tuple size supported by the library.</p>
<hr>
<a href="inc.htm">Prev</a> <a href="list.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,53 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list.hpp">boost/preprocessor/list.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="limits.htm">Prev</a> <a href="list_adt.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Includes all list headers.</p>
<p>A list is an arbitrary size collection of elements.</p>
<p>In the preprocessor library, the internal representation of lists
uses parts that are like macro parameter lists. Thus an element of a list
can be any sequence of tokens that constitutes a single macro parameter.</p>
<p>Lists are manipulated using both list ADT macros and higher-order macros. For an introduction to manipulation of lists in functional programming, see
<a href="../bibliography.htm#[Thompson]">[Thompson]</a>,
<a href="../bibliography.htm#[Abelson]">[Abelson]</a> or
<a href="../bibliography.htm#[Cousineau]">[Cousineau]</a>.</p>
<hr>
<a href="limits.htm">Prev</a> <a href="list_adt.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,135 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/adt.hpp">boost/preprocessor/list/adt.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list.htm">Prev</a> <a href="list_append.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<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
compelling reasons to change the representation, you should avoid
writing code that depends on the internal representation details.</li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_CONS">#define BOOST_PP_LIST_CONS</a>(FIRST,REST)</h3>
<p>List constructor.</p>
<p>Lists are build using list constructors <a href="list_adt.htm#BOOST_PP_LIST_NIL">BOOST_PP_LIST_NIL</a> and
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(). For example,</p>
<pre>
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(1,
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(2,
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(3,
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(4,
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(5,
<a href="list_adt.htm#BOOST_PP_LIST_NIL">BOOST_PP_LIST_NIL</a>)))))
</pre>
<p>Short lists can also be build from tuples:</p>
<pre>
<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(5,(1,2,3,4,5))
</pre>
<p>Both of the above lists contain 5 elements: 1, 2, 3, 4 and 5.</p>
<p>Longer lists can be built from short lists with <a href="list_append.htm#BOOST_PP_LIST_APPEND_D">BOOST_PP_LIST_APPEND_D</a>()
and <a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT">BOOST_PP_LIST_FOLD_RIGHT</a>():</p>
<pre>
<a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT">BOOST_PP_LIST_FOLD_RIGHT</a>
( <a href="list_append.htm#BOOST_PP_LIST_APPEND_D">BOOST_PP_LIST_APPEND_D</a>
, <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>
( N
, <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(M, (E11, E12, ..., E1M) )
, <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(M, (E21, E22, ..., E2M) )
, ...
, <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(M, (EN1, EN2, ..., ENM) )
)
, <a href="list_adt.htm#BOOST_PP_LIST_NIL">BOOST_PP_LIST_NIL</a>
)
</pre>
<hr>
<h3><a name="BOOST_PP_LIST_NIL">#define BOOST_PP_LIST_NIL</a></h3>
<p>List nil constructor.</p>
<hr>
<h3><a name="BOOST_PP_LIST_IS_CONS">#define BOOST_PP_LIST_IS_CONS</a>(LIST)</h3>
<p>Expands to 1 if the list is not nil and 0 otherwise.</p>
<hr>
<h3><a name="BOOST_PP_LIST_IS_NIL">#define BOOST_PP_LIST_IS_NIL</a>(LIST)</h3>
<p>Expands to 1 if the list is nil and 0 otherwise.</p>
<hr>
<h3><a name="BOOST_PP_LIST_FIRST">#define BOOST_PP_LIST_FIRST</a>(LIST)</h3>
<p>Expands to the first element of the list. The list must not be nil.</p>
<p>For example,</p>
<pre>
<a href="list_adt.htm#BOOST_PP_LIST_FIRST">BOOST_PP_LIST_FIRST</a>(<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(5,(1,2,3,4,5)))
</pre>
<p>expands to 1.</p>
<hr>
<h3><a name="BOOST_PP_LIST_REST">#define BOOST_PP_LIST_REST</a>(LIST)</h3>
<p>Expands to a list of all but the first element of the list.</p>
<p>The list must not be nil.</p>
<p>For example,</p>
<pre>
<a href="list_adt.htm#BOOST_PP_LIST_REST">BOOST_PP_LIST_REST</a>(<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(5,(1,2,3,4,5)))
</pre>
<p>expands to the same as:</p>
<pre>
<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(4,(2,3,4,5))
</pre>
<hr>
<a href="list.htm">Prev</a> <a href="list_append.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,68 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/append.hpp">boost/preprocessor/list/append.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_adt.htm">Prev</a> <a href="list_at.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_APPEND">#define BOOST_PP_LIST_APPEND</a>(LIST_1ST,LIST_2ND)</h3>
<p>Catenates two lists together.</p>
<p>For example,</p>
<pre>
<a href="list_append.htm#BOOST_PP_LIST_APPEND">BOOST_PP_LIST_APPEND</a>
( <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(2,(1,2))
, <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(2,(3,4))
)
</pre>
<p>expands to the same as:</p>
<pre>
<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(4,(1,2,3,4))
</pre>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_APPEND_D">#define BOOST_PP_LIST_APPEND_D</a>(D,LIST_1ST,LIST_2ND)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="list_adt.htm">Prev</a> <a href="list_at.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,62 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/at.hpp">boost/preprocessor/list/at.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_append.htm">Prev</a> <a href="list_cat.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_AT">#define BOOST_PP_LIST_AT</a>(LIST,INDEX)</h3>
<p>Expands to the <code>INDEX</code>:th element of the list <code>LIST</code>. The
first element is at index <code>0</code>.</p>
<p>For example,</p>
<pre>
<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)),1)
</pre>
<p>expands to <code>B</code>.</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_AT_D">#define BOOST_PP_LIST_AT_D</a>(D,LIST,INDEX)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="list_append.htm">Prev</a> <a href="list_cat.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,65 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/cat.hpp">boost/preprocessor/list/cat.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_at.htm">Prev</a> <a href="list_enum.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_CAT">#define BOOST_PP_LIST_CAT</a>(LIST)</h3>
<p>Catenates all elements of the list.</p>
<p>For example,</p>
<pre>
<a href="list_cat.htm#BOOST_PP_LIST_CAT">BOOST_PP_LIST_CAT</a>(<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(1,2,3)))
</pre>
<p>expands to:</p>
<pre>
123
</pre>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_CAT_D">#define BOOST_PP_LIST_CAT_D</a>(D,LIST)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="list_at.htm">Prev</a> <a href="list_enum.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,65 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/enum.hpp">boost/preprocessor/list/enum.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_cat.htm">Prev</a> <a href="list_filter.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_ENUM">#define BOOST_PP_LIST_ENUM</a>(LIST)</h3>
<p>Converts the list to a comma separated list.</p>
<p>For example,</p>
<pre>
<a href="list_enum.htm#BOOST_PP_LIST_ENUM">BOOST_PP_LIST_ENUM</a>(<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
</pre>
<p>expands to:</p>
<pre>
A,B,C
</pre>
<h3>Uses</h3>
<ul>
<li><a href="list_for_each_i.htm#BOOST_PP_LIST_FOR_EACH_I">BOOST_PP_LIST_FOR_EACH_I</a>()</li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_ENUM_R">#define BOOST_PP_LIST_ENUM_R</a>(R,LIST)</h3>
<p>Can be used inside <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() (see for an explanation of the R parameter).</p>
<hr>
<a href="list_cat.htm">Prev</a> <a href="list_filter.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,66 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/filter.hpp">boost/preprocessor/list/filter.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_enum.htm">Prev</a> <a href="list_first_n.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_FILTER">#define BOOST_PP_LIST_FILTER</a>(PRED,DATA,LIST)</h3>
<p>Expands to a list containing all the elements <code>X</code> of the list
for which <code>PRED(D,DATA,X)</code> is true.</p>
<p>For example,</p>
<pre>
<a href="list_filter.htm#BOOST_PP_LIST_FILTER">BOOST_PP_LIST_FILTER</a>(<a href="comparison_not_equal.htm#BOOST_PP_NOT_EQUAL_D">BOOST_PP_NOT_EQUAL_D</a>,2,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(1,2,3)))
</pre>
<p>expands to the same as:</p>
<pre>
<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(2,(1,3))
</pre>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_FILTER_D">#define BOOST_PP_LIST_FILTER_D</a>(D,PRED,DATA,LIST)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="list_enum.htm">Prev</a> <a href="list_first_n.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,71 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/first_n.hpp">boost/preprocessor/list/first_n.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_filter.htm">Prev</a> <a href="list_fold_left.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_FIRST_N">#define BOOST_PP_LIST_FIRST_N</a>(COUNT,LIST)</h3>
<p>Expands to a list of the first <code>COUNT</code> elements of the list
<code>LIST</code>.</p>
<p>For example,</p>
<pre>
<a href="list_first_n.htm#BOOST_PP_LIST_FIRST_N">BOOST_PP_LIST_FIRST_N</a>(2,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(4,(+,-,*,/)))
</pre>
<p>expands to the same as:</p>
<pre>
<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(2,(+,-))
</pre>
<h3>See</h3>
<ul>
<li><a href="list_rest_n.htm#BOOST_PP_LIST_REST_N">BOOST_PP_LIST_REST_N</a>()</li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_FIRST_N_D">#define BOOST_PP_LIST_FIRST_N_D</a>(D,COUNT,LIST)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation the D parameter).</p>
<hr>
<a href="list_filter.htm">Prev</a> <a href="list_fold_left.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,103 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/fold_left.hpp">boost/preprocessor/list/fold_left.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_first_n.htm">Prev</a> <a href="list_fold_left_2nd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_FOLD_LEFT">#define BOOST_PP_LIST_FOLD_LEFT</a>(OP,STATE,LIST)</h3>
<p>Iterates <code>OP(D,STATE,X)</code> for each element <code>X</code> of the
list <code>LIST</code> (from the left or the start of the list).</p>
<p>In other words, expands to:</p>
<pre>
OP
( D
, ... OP(D, OP(D,STATE,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,0)), <a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,1)) ...
, <a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(LIST))
)
</pre>
<p>For example,</p>
<pre>
#define TEST(D,STATE,X) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(STATE,X)
<a href="list_fold_left.htm#BOOST_PP_LIST_FOLD_LEFT">BOOST_PP_LIST_FOLD_LEFT</a>(TEST,_,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
</pre>
<p>expands to:</p>
<pre>
_ABC
</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.</li>
</ul>
<h3>See</h3>
<ul>
<li><a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT">BOOST_PP_LIST_FOLD_RIGHT</a>()</li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_FOLD_LEFT_D">#define BOOST_PP_LIST_FOLD_LEFT_D</a>(D,OP,STATE,LIST)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<h3>Note</h3>
<ul>
<li><a href="list_fold_left.htm#BOOST_PP_LIST_FOLD_LEFT_D">BOOST_PP_LIST_FOLD_LEFT_D</a>() implements automatic recursion. You
can use a fold in the OP macro.</li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_FOLD_LEFT_2ND">#define BOOST_PP_LIST_FOLD_LEFT_2ND</a></h3>
<p>Obsolete, just use <a href="list_fold_left.htm#BOOST_PP_LIST_FOLD_LEFT">BOOST_PP_LIST_FOLD_LEFT</a>().</p>
<hr>
<h3><a name="BOOST_PP_LIST_FOLD_LEFT_2ND_D">#define BOOST_PP_LIST_FOLD_LEFT_2ND_D</a></h3>
<p>Obsolete, just use <a href="list_fold_left.htm#BOOST_PP_LIST_FOLD_LEFT_D">BOOST_PP_LIST_FOLD_LEFT_D</a>().</p>
<hr>
<a href="list_first_n.htm">Prev</a> <a href="list_fold_left_2nd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,46 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/fold_left_2nd.hpp">boost/preprocessor/list/fold_left_2nd.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_fold_left.htm">Prev</a> <a href="list_fold_right.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>This header is obsolete. Use the following code instead.</p>
<pre>
#include &lt;boost/preprocessor/list/fold_left.hpp&gt;
</pre>
<hr>
<a href="list_fold_left.htm">Prev</a> <a href="list_fold_right.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,106 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/fold_right.hpp">boost/preprocessor/list/fold_right.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_fold_left_2nd.htm">Prev</a> <a href="list_fold_right_2nd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_FOLD_RIGHT">#define BOOST_PP_LIST_FOLD_RIGHT</a>(OP,LIST,STATE)</h3>
<p>Iterates <code>OP(D,X,STATE)</code> for each element <code>X</code> of the
list <code>LIST</code> (from the right or the end of the list).</p>
<p>In other words, expands to:</p>
<pre>
OP
( D
, <a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,0)
, ... OP
( D
, <a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,<a href="arithmetic_sub.htm#BOOST_PP_SUB">BOOST_PP_SUB</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(LIST),2))
, OP
( D
, <a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,<a href="arithmetic_sub.htm#BOOST_PP_SUB">BOOST_PP_SUB</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(LIST),1))
, STATE
)
) ...
)
</pre>
<p>For example,</p>
<pre>
#define TEST(D,X,STATE) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(STATE,X)
<a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT">BOOST_PP_LIST_FOLD_RIGHT</a>(TEST,_,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
</pre>
<p>expands to:</p>
<pre>
_CBA
</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.</li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_FOLD_RIGHT_D">#define BOOST_PP_LIST_FOLD_RIGHT_D</a>(D,OP,LIST,STATE)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<h3>Note</h3>
<ul>
<li><a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT_D">BOOST_PP_LIST_FOLD_RIGHT_D</a>() implements automatic recursion. You
can use a fold in the OP macro.</li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_FOLD_RIGHT_2ND">#define BOOST_PP_LIST_FOLD_RIGHT_2ND</a></h3>
<p>Obsolete, just use <a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT">BOOST_PP_LIST_FOLD_RIGHT</a>().</p>
<hr>
<h3><a name="BOOST_PP_LIST_FOLD_RIGHT_2ND_D">#define BOOST_PP_LIST_FOLD_RIGHT_2ND_D</a></h3>
<p>Obsolete, just use <a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT_D">BOOST_PP_LIST_FOLD_RIGHT_D</a>().</p>
<hr>
<a href="list_fold_left_2nd.htm">Prev</a> <a href="list_fold_right_2nd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,46 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/fold_right_2nd.hpp">boost/preprocessor/list/fold_right_2nd.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_fold_right.htm">Prev</a> <a href="list_for_each.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>This header is obsolete. Use the following code instead.</p>
<pre>
#include &lt;boost/preprocessor/list/fold_right.hpp&gt;
</pre>
<hr>
<a href="list_fold_right.htm">Prev</a> <a href="list_for_each.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,81 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/for_each.hpp">boost/preprocessor/list/for_each.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_fold_right_2nd.htm">Prev</a> <a href="list_for_each_i.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_FOR_EACH">#define BOOST_PP_LIST_FOR_EACH</a>(MACRO,DATA,LIST)</h3>
<p>Repeats <code>MACRO(R,DATA,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,INDEX))</code> for each INDEX = [0,
<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(LIST)).</p>
<p>In other words, expands to the sequence:</p>
<pre>
MACRO(R,DATA,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,0))
MACRO(R,DATA,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,1))
...
MACRO(R,DATA,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(LIST))))
</pre>
<p>For example,</p>
<pre>
#define TEST(R,DATA,X) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(DATA,X)();
<a href="list_for_each.htm#BOOST_PP_LIST_FOR_EACH">BOOST_PP_LIST_FOR_EACH</a>(TEST,prefix_,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
</pre>
<p>expands to:</p>
<pre>
prefix_A(); prefix_B(); prefix_C();
</pre>
<h3>Example</h3>
<ul>
<li><a href="../../example/catch_builtin.cpp">catch_builtin.cpp</a></li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_FOR_EACH_R">#define BOOST_PP_LIST_FOR_EACH_R</a>(R,MACRO,DATA,LIST)</h3>
<p>Can be used inside <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() (see for an explanation of the R parameter).</p>
<hr>
<a href="list_fold_right_2nd.htm">Prev</a> <a href="list_for_each_i.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,71 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/for_each_i.hpp">boost/preprocessor/list/for_each_i.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_for_each.htm">Prev</a> <a href="list_for_each_product.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_FOR_EACH_I">#define BOOST_PP_LIST_FOR_EACH_I</a>(MACRO,DATA,LIST)</h3>
<p>Repeats <code>MACRO(R,DATA,INDEX,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,INDEX))</code> for each INDEX = [0,
<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(LIST)).</p>
<p>In other words, expands to the sequence:</p>
<pre>
MACRO(R,DATA,0,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,0))
MACRO(R,DATA,1,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,1))
...
MACRO(R,DATA,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(LIST)),<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(LIST))))
</pre>
<p>For example,</p>
<pre>
#define TEST(R,DATA,INDEX,X) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(DATA,X)(INDEX);
<a href="list_for_each_i.htm#BOOST_PP_LIST_FOR_EACH_I">BOOST_PP_LIST_FOR_EACH_I</a>(TEST,prefix_,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
</pre>
<p>expands to:</p>
<pre>
prefix_A(0); prefix_B(1); prefix_C(2);
</pre>
<hr>
<h3><a name="BOOST_PP_LIST_FOR_EACH_I_R">#define BOOST_PP_LIST_FOR_EACH_I_R</a>(R,MACRO,DATA,LIST)</h3>
<p>Can be used inside <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() (see for an explanation of the R parameter).</p>
<hr>
<a href="list_for_each.htm">Prev</a> <a href="list_for_each_product.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,82 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/for_each_product.hpp">boost/preprocessor/list/for_each_product.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_for_each_i.htm">Prev</a> <a href="list_rest_n.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_FOR_EACH_PRODUCT">#define BOOST_PP_LIST_FOR_EACH_PRODUCT</a>(MACRO,SIZE_OF_TUPLE,TUPLE_OF_LISTS)</h3>
<p>Repeats <code>MACRO(R,X)</code> for each element <code>X</code> of the
cartesian product of the lists of the <code>SIZE_OF_TUPLE</code>-tuple <code>TUPLE_OF_LISTS</code>.</p>
<p>This macro is useful for generating code to avoid combinatorial
explosion.</p>
<p>For example,</p>
<pre>
#define TEST(R,X) X
<a href="list_for_each_product.htm#BOOST_PP_LIST_FOR_EACH_PRODUCT">BOOST_PP_LIST_FOR_EACH_PRODUCT</a>
( TEST
, 2
, ( <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C))
, <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(2,(1,2))
)
)
</pre>
<p>expands to:</p>
<pre>
(A,1) (A,2) (B,1) (B,2) (C,1) (C,2)
</pre>
<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>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_FOR_EACH_PRODUCT_R">#define BOOST_PP_LIST_FOR_EACH_PRODUCT_R</a>(R,MACRO,SIZE_OF_TUPLE,TUPLE_OF_LISTS)</h3>
<p>Can be used inside <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() (see for an explanation of the R parameter).</p>
<hr>
<a href="list_for_each_i.htm">Prev</a> <a href="list_rest_n.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,71 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/rest_n.hpp">boost/preprocessor/list/rest_n.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_for_each_product.htm">Prev</a> <a href="list_reverse.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_REST_N">#define BOOST_PP_LIST_REST_N</a>(COUNT,LIST)</h3>
<p>Expands to a list of all but the first <code>COUNT</code> elements of the
list <code>LIST</code>.</p>
<p>For example,</p>
<pre>
<a href="list_rest_n.htm#BOOST_PP_LIST_REST_N">BOOST_PP_LIST_REST_N</a>(2,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(4,(+,-,*,/)))
</pre>
<p>expands to the same as:</p>
<pre>
<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(2,(*,/))
</pre>
<h3>See</h3>
<ul>
<li><a href="list_first_n.htm#BOOST_PP_LIST_FIRST_N">BOOST_PP_LIST_FIRST_N</a>()</li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_REST_N_D">#define BOOST_PP_LIST_REST_N_D</a>(D,COUNT,LIST)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="list_for_each_product.htm">Prev</a> <a href="list_reverse.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,65 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/reverse.hpp">boost/preprocessor/list/reverse.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_rest_n.htm">Prev</a> <a href="list_size.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_REVERSE">#define BOOST_PP_LIST_REVERSE</a>(LIST)</h3>
<p>List reversal.</p>
<p>For example,</p>
<pre>
<a href="list_reverse.htm#BOOST_PP_LIST_REVERSE">BOOST_PP_LIST_REVERSE</a>(<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
</pre>
<p>expands to the same as:</p>
<pre>
<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(C,B,A))
</pre>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_REVERSE_D">#define BOOST_PP_LIST_REVERSE_D</a>(D,LIST)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="list_rest_n.htm">Prev</a> <a href="list_size.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,61 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/size.hpp">boost/preprocessor/list/size.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_reverse.htm">Prev</a> <a href="list_to_tuple.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_SIZE">#define BOOST_PP_LIST_SIZE</a>(LIST)</h3>
<p>Expands to the number of elements in the list.</p>
<p>For example,</p>
<pre>
<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
</pre>
<p>expands to <code>3</code>.</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_SIZE_D">#define BOOST_PP_LIST_SIZE_D</a>(D,LIST)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="list_reverse.htm">Prev</a> <a href="list_to_tuple.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,67 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/to_tuple.hpp">boost/preprocessor/list/to_tuple.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_size.htm">Prev</a> <a href="list_transform.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_TO_TUPLE">#define BOOST_PP_LIST_TO_TUPLE</a>(LIST)</h3>
<p>Converts the list to a tuple.</p>
<p>For example,</p>
<pre>
<a href="list_to_tuple.htm#BOOST_PP_LIST_TO_TUPLE">BOOST_PP_LIST_TO_TUPLE</a>(<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
</pre>
<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
<a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a> rather than <a href="limits.htm#BOOST_PP_LIMIT_TUPLE">BOOST_PP_LIMIT_TUPLE</a>.</li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_TO_TUPLE_R">#define BOOST_PP_LIST_TO_TUPLE_R</a>(R,LIST)</h3>
<p>Can be used inside <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() (see for an explanation of the R parameter).</p>
<hr>
<a href="list_size.htm">Prev</a> <a href="list_transform.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,76 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/list/transform.hpp">boost/preprocessor/list/transform.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_to_tuple.htm">Prev</a> <a href="logical.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_LIST_TRANSFORM">#define BOOST_PP_LIST_TRANSFORM</a>(OP,DATA,LIST)</h3>
<p>Applies the macro <code>OP(D,DATA,X)</code> to each element <code>X</code>
of the list producing a new list.</p>
<p>In other words, expands to:</p>
<pre>
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(OP(D,DATA,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,0)),
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(OP(D,DATA,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,1)),
...
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(OP(D,DATA,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(LIST,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(LIST)))),
<a href="list_adt.htm#BOOST_PP_LIST_NIL">BOOST_PP_LIST_NIL</a>) ... ))
</pre>
<p>For example,</p>
<pre>
<a href="list_transform.htm#BOOST_PP_LIST_TRANSFORM">BOOST_PP_LIST_TRANSFORM</a>(<a href="arithmetic_add.htm#BOOST_PP_ADD_D">BOOST_PP_ADD_D</a>,2,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(2,(1,2)))
</pre>
<p>expands to the same as:</p>
<pre>
<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(2,(3,4))
</pre>
<h3>Test</h3>
<ul>
<li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_LIST_TRANSFORM_D">#define BOOST_PP_LIST_TRANSFORM_D</a>(D,OP,DATA,LIST)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="list_to_tuple.htm">Prev</a> <a href="logical.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,41 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/logical.hpp">boost/preprocessor/logical.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="list_transform.htm">Prev</a> <a href="logical_and.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Includes all logical headers.</p>
<hr>
<a href="list_transform.htm">Prev</a> <a href="logical_and.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,54 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/logical/and.hpp">boost/preprocessor/logical/and.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="logical.htm">Prev</a> <a href="logical_bool.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_AND">#define BOOST_PP_AND</a>(X,Y)</h3>
<p>Expands to the logical AND of the operands.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="logical_and.htm#BOOST_PP_AND">BOOST_PP_AND</a>(0,5)</code> expands to <code>0</code> (a single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/logical_test.cpp">logical_test.cpp</a></li>
</ul>
<hr>
<a href="logical.htm">Prev</a> <a href="logical_bool.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,48 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/logical/bool.hpp">boost/preprocessor/logical/bool.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="logical_and.htm">Prev</a> <a href="logical_nor.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_BOOL">#define BOOST_PP_BOOL</a>(X)</h3>
<p>Expands to <code>0</code> if <code>X == 0</code> and <code>1</code> if <code>X != 0</code>.</p>
<p><code>X</code> must be an integer literal in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="logical_bool.htm#BOOST_PP_BOOL">BOOST_PP_BOOL</a>(3)</code> expands to <code>1</code>.</p>
<hr>
<a href="logical_and.htm">Prev</a> <a href="logical_nor.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,54 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/logical/nor.hpp">boost/preprocessor/logical/nor.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="logical_bool.htm">Prev</a> <a href="logical_not.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_NOR">#define BOOST_PP_NOR</a>(X,Y)</h3>
<p>Expands to the logical NEITHER OR of the operands.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="logical_nor.htm#BOOST_PP_NOR">BOOST_PP_NOR</a>(0,5)</code> expands to <code>0</code> (a single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/logical_test.cpp">logical_test.cpp</a></li>
</ul>
<hr>
<a href="logical_bool.htm">Prev</a> <a href="logical_not.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,53 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/logical/not.hpp">boost/preprocessor/logical/not.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="logical_nor.htm">Prev</a> <a href="logical_or.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_NOT">#define BOOST_PP_NOT</a>(X)</h3>
<p>Expands to the logical NOT of the operand.</p>
<p><code>X</code> must be an integer literal in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="logical_not.htm#BOOST_PP_NOT">BOOST_PP_NOT</a>(0)</code> expands to <code>1</code> (a single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/logical_test.cpp">logical_test.cpp</a></li>
</ul>
<hr>
<a href="logical_nor.htm">Prev</a> <a href="logical_or.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,54 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/logical/or.hpp">boost/preprocessor/logical/or.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="logical_not.htm">Prev</a> <a href="logical_xor.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_OR">#define BOOST_PP_OR</a>(X,Y)</h3>
<p>Expands to the logical OR of the operands.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="logical_or.htm#BOOST_PP_OR">BOOST_PP_OR</a>(0,2)</code> expands to <code>1</code> (a single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/logical_test.cpp">logical_test.cpp</a></li>
</ul>
<hr>
<a href="logical_not.htm">Prev</a> <a href="logical_xor.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,54 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/logical/xor.hpp">boost/preprocessor/logical/xor.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="logical_or.htm">Prev</a> <a href="max.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_XOR">#define BOOST_PP_XOR</a>(X,Y)</h3>
<p>Expands to the logical EXCLUSIVE OR of the operands.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="logical_xor.htm#BOOST_PP_XOR">BOOST_PP_XOR</a>(1,2)</code> expands to <code>0</code> (a single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/logical_test.cpp">logical_test.cpp</a></li>
</ul>
<hr>
<a href="logical_or.htm">Prev</a> <a href="max.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/max.hpp">boost/preprocessor/max.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="logical_xor.htm">Prev</a> <a href="min.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_MAX">#define BOOST_PP_MAX</a>(X,Y)</h3>
<p>Expands to the maximum of <code>X</code> and <code>Y</code>.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="max.htm#BOOST_PP_MAX">BOOST_PP_MAX</a>(5,7)</code> expands to <code>7</code> (a
single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_MAX_D">#define BOOST_PP_MAX_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="logical_xor.htm">Prev</a> <a href="min.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,59 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/min.hpp">boost/preprocessor/min.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="max.htm">Prev</a> <a href="repeat.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_MIN">#define BOOST_PP_MIN</a>(X,Y)</h3>
<p>Expands to the minimum of <code>X</code> and <code>Y</code>.</p>
<p>Both <code>X</code> and <code>Y</code> must expand to integer literals
in the range [0, <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>].</p>
<p>For example, <code><a href="min.htm#BOOST_PP_MIN">BOOST_PP_MIN</a>(5,7)</code> expands to <code>5</code> (a
single token).</p>
<h3>Test</h3>
<ul>
<li><a href="../../test/arithmetic_test.cpp">arithmetic_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_MIN_D">#define BOOST_PP_MIN_D</a>(D,X,Y)</h3>
<p>Can be used inside <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for an explanation of the D parameter).</p>
<hr>
<a href="max.htm">Prev</a> <a href="repeat.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,95 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/repeat.hpp">boost/preprocessor/repeat.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="min.htm">Prev</a> <a href="repeat_2nd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_REPEAT">#define BOOST_PP_REPEAT</a>(COUNT,MACRO,DATA)</h3>
<p>Repeats the macro <code>MACRO(INDEX,DATA)</code> for <code>INDEX = [0,COUNT)</code>.</p>
<p>In other words, expands to the sequence:</p>
<pre>
MACRO(0,DATA) MACRO(1,DATA) ... MACRO(<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(COUNT),DATA)
</pre>
<p>For example,</p>
<pre>
#define TEST(INDEX,DATA) DATA(INDEX);
<a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>(3,TEST,X)
</pre>
<p>expands to:</p>
<pre>
X(0); X(1); X(2);
</pre>
<h3>2D and 3D repetition</h3>
<p><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>() implements automatic recursion. 2D and 3D repetition
are directly supported.</p>
<h3>Example</h3>
<ul>
<li><a href="../../example/duffs_device.c">duffs_device.c</a></li>
<li><a href="../../example/repeat_2d.c">repeat_2d.c</a></li>
</ul>
<h3>See</h3>
<ul>
<li><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>()</li>
<li><a href="limits.htm#BOOST_PP_LIMIT_DIM">BOOST_PP_LIMIT_DIM</a></li>
<li><a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a></li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/repeat_test.cpp">repeat_test.cpp</a></li>
<li><a href="../../test/repeat_2nd_test.cpp">repeat_2nd_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_REPEAT_2ND">#define BOOST_PP_REPEAT_2ND</a></h3>
<p>Obsolete, just use <a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>().</p>
<hr>
<h3><a name="BOOST_PP_REPEAT_3RD">#define BOOST_PP_REPEAT_3RD</a></h3>
<p>Obsolete, just use <a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>().</p>
<hr>
<a href="min.htm">Prev</a> <a href="repeat_2nd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,46 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/repeat_2nd.hpp">boost/preprocessor/repeat_2nd.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="repeat.htm">Prev</a> <a href="repeat_3rd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>This header is obsolete. Use the following code instead.</p>
<pre>
#include &lt;boost/preprocessor/repeat.hpp&gt;
</pre>
<hr>
<a href="repeat.htm">Prev</a> <a href="repeat_3rd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,46 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/repeat_3rd.hpp">boost/preprocessor/repeat_3rd.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="repeat_2nd.htm">Prev</a> <a href="repeat_from_to.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>This header is obsolete. Use the following code instead.</p>
<pre>
#include &lt;boost/preprocessor/repeat.hpp&gt;
</pre>
<hr>
<a href="repeat_2nd.htm">Prev</a> <a href="repeat_from_to.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,89 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/repeat_from_to.hpp">boost/preprocessor/repeat_from_to.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="repeat_3rd.htm">Prev</a> <a href="repeat_from_to_2nd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_REPEAT_FROM_TO">#define BOOST_PP_REPEAT_FROM_TO</a>(FIRST,LAST,MACRO,DATA)</h3>
<p>Repeats the macro <code>MACRO(INDEX,DATA)</code> for <code>INDEX = [FIRST,LAST)</code>.</p>
<p>In other words, expands to the sequence:</p>
<pre>
MACRO(FIRST,DATA) MACRO(<a href="inc.htm#BOOST_PP_INC">BOOST_PP_INC</a>(FIRST),DATA) ... MACRO(<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(LAST),DATA)
</pre>
<p>For example,</p>
<pre>
#define TEST(INDEX,DATA) DATA(INDEX);
<a href="repeat_from_to.htm#BOOST_PP_REPEAT_FROM_TO">BOOST_PP_REPEAT_FROM_TO</a>(4,7,TEST,X)
</pre>
<p>expands to:</p>
<pre>
X(4); X(5); X(6);
</pre>
<h3>2D and 3D repetition</h3>
<p><a href="repeat_from_to.htm#BOOST_PP_REPEAT_FROM_TO">BOOST_PP_REPEAT_FROM_TO</a>() implements automatic recursion. 2D and 3D repetition
are directly supported.</p>
<h3>See</h3>
<ul>
<li><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>()</li>
<li><a href="limits.htm#BOOST_PP_LIMIT_DIM">BOOST_PP_LIMIT_DIM</a></li>
<li><a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a></li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/repeat_test.cpp">repeat_test.cpp</a></li>
<li><a href="../../test/repeat_2nd_test.cpp">repeat_2nd_test.cpp</a></li>
</ul>
<hr>
<h3><a name="BOOST_PP_REPEAT_FROM_TO_2ND">#define BOOST_PP_REPEAT_FROM_TO_2ND</a></h3>
<p>Obsolete, just use <a href="repeat_from_to.htm#BOOST_PP_REPEAT_FROM_TO">BOOST_PP_REPEAT_FROM_TO</a>().</p>
<hr>
<h3><a name="BOOST_PP_REPEAT_FROM_TO_3RD">#define BOOST_PP_REPEAT_FROM_TO_3RD</a></h3>
<p>Obsolete, just use <a href="repeat_from_to.htm#BOOST_PP_REPEAT_FROM_TO">BOOST_PP_REPEAT_FROM_TO</a>().</p>
<hr>
<a href="repeat_3rd.htm">Prev</a> <a href="repeat_from_to_2nd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,46 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/repeat_from_to_2nd.hpp">boost/preprocessor/repeat_from_to_2nd.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="repeat_from_to.htm">Prev</a> <a href="repeat_from_to_3rd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>This header is obsolete. Use the following code instead.</p>
<pre>
#include &lt;boost/preprocessor/repeat_from_to.hpp&gt;
</pre>
<hr>
<a href="repeat_from_to.htm">Prev</a> <a href="repeat_from_to_3rd.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,46 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/repeat_from_to_3rd.hpp">boost/preprocessor/repeat_from_to_3rd.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="repeat_from_to_2nd.htm">Prev</a> <a href="stringize.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>This header is obsolete. Use the following code instead.</p>
<pre>
#include &lt;boost/preprocessor/repeat_from_to.hpp&gt;
</pre>
<hr>
<a href="repeat_from_to_2nd.htm">Prev</a> <a href="stringize.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,56 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/stringize.hpp">boost/preprocessor/stringize.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="repeat_from_to_3rd.htm">Prev</a> <a href="tuple.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_STRINGIZE">#define BOOST_PP_STRINGIZE</a>(X)</h3>
<p>Stringizes <code>X</code> after it is macro expanded.</p>
<p>For example, <code><a href="stringize.htm#BOOST_PP_STRINGIZE">BOOST_PP_STRINGIZE</a>(<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(a,b))</code> expands to <code>"ab"</code>.</p>
<h3>Example</h3>
<ul>
<li><a href="../../example/note.c">note.c</a></li>
</ul>
<h3>Test</h3>
<ul>
<li><a href="../../test/preprocessor_test.cpp">preprocessor_test.cpp</a></li>
</ul>
<hr>
<a href="repeat_from_to_3rd.htm">Prev</a> <a href="tuple.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,58 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/tuple.hpp">boost/preprocessor/tuple.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="stringize.htm">Prev</a> <a href="tuple_eat.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Includes all tuple headers.</p>
<p>A tuple is a fixed size collection of elements.</p>
<p>In the preprocessor library, tuples are represented like macro parameter
lists. Thus an element of a tuple can be any sequence of tokens that
constitutes a single macro parameter.</p>
<p>Examples of tuples:</p>
<pre>
(const, volatile) // 2-tuple
(*, /, %) // 3-tuple
(1, "2", '3', (4,5)) // 4-tuple
</pre>
<p>Tuples can be used for representing structured data.</p>
<hr>
<a href="stringize.htm">Prev</a> <a href="tuple_eat.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,55 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/tuple/eat.hpp">boost/preprocessor/tuple/eat.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="tuple.htm">Prev</a> <a href="tuple_elem.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_TUPLE_EAT">#define BOOST_PP_TUPLE_EAT</a>(SIZE_OF_TUPLE)</h3>
<p>Expands to a macro that eats a tuple of the specified size.</p>
<p><a href="tuple_eat.htm#BOOST_PP_TUPLE_EAT">BOOST_PP_TUPLE_EAT</a>() is designed to be used with <a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>() like
<a href="empty.htm#BOOST_PP_EMPTY">BOOST_PP_EMPTY</a>().</p>
<p>For example,</p>
<pre>
<a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>(0,<a href="enum_params.htm#BOOST_PP_ENUM_PARAMS">BOOST_PP_ENUM_PARAMS</a>,<a href="tuple_eat.htm#BOOST_PP_TUPLE_EAT">BOOST_PP_TUPLE_EAT</a>(2))(10,P)
</pre>
<p>expands to nothing.</p>
<hr>
<a href="tuple.htm">Prev</a> <a href="tuple_elem.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,57 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/tuple/elem.hpp">boost/preprocessor/tuple/elem.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="tuple_eat.htm">Prev</a> <a href="tuple_reverse.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_TUPLE_ELEM">#define BOOST_PP_TUPLE_ELEM</a>(SIZE_OF_TUPLE,INDEX,TUPLE)</h3>
<p>Expands to the <code>INDEX</code>:th element of an <code>SIZE_OF_TUPLE</code>-tuple.</p>
<p>For example,</p>
<pre>
<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,(A,B))
</pre>
<p>expands to <code>B</code>.</p>
<h3>See</h3>
<ul>
<li><a href="limits.htm#BOOST_PP_LIMIT_TUPLE">BOOST_PP_LIMIT_TUPLE</a></li>
</ul>
<hr>
<a href="tuple_eat.htm">Prev</a> <a href="tuple_reverse.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,52 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/tuple/reverse.hpp">boost/preprocessor/tuple/reverse.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="tuple_elem.htm">Prev</a> <a href="tuple_to_list.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_TUPLE_REVERSE">#define BOOST_PP_TUPLE_REVERSE</a>(SIZE_OF_TUPLE,TUPLE)</h3>
<p>Tuple reversal.</p>
<p>For example,</p>
<pre>
<a href="tuple_reverse.htm#BOOST_PP_TUPLE_REVERSE">BOOST_PP_TUPLE_REVERSE</a>(3,(A,B,C))
</pre>
<p>expands to <code>(C,B,A)</code>.</p>
<hr>
<a href="tuple_elem.htm">Prev</a> <a href="tuple_to_list.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,64 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/tuple/to_list.hpp">boost/preprocessor/tuple/to_list.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="tuple_reverse.htm">Prev</a> <a href="while.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_TUPLE_TO_LIST">#define BOOST_PP_TUPLE_TO_LIST</a>(SIZE_OF_TUPLE,TUPLE)</h3>
<p>Converts a tuple to a list.</p>
<p>For example,</p>
<pre>
<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C))
</pre>
<p>expands to the same as</p>
<pre>
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(A,
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(B,
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(C,
<a href="list_adt.htm#BOOST_PP_LIST_NIL">BOOST_PP_LIST_NIL</a>)))
</pre>
<h3>See</h3>
<ul>
<li><a href="limits.htm#BOOST_PP_LIMIT_TUPLE">BOOST_PP_LIMIT_TUPLE</a></li>
</ul>
<hr>
<a href="tuple_reverse.htm">Prev</a> <a href="while.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,107 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../../boost.css">
<title>Boost.Preprocessor - Reference</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Header &lt;<a href="../../../../boost/preprocessor/while.hpp">boost/preprocessor/while.hpp</a>&gt;</h2>
</td>
</tr>
</table>
<hr>
<a href="tuple_to_list.htm">Prev</a> <a href="arithmetic.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<h3><a name="BOOST_PP_WHILE">#define BOOST_PP_WHILE</a>(PRED,OP,STATE)</h3>
<p>Iterates <code>OP(D,STATE)</code> while <code>PRED(D,STATE)</code> is true.</p>
<p>In other words, expands to:</p>
<pre>
OP(D, ... OP(D, OP(D,STATE) ) ... )
</pre>
<p>The depth of iteration is determined by <code>PRED(D,STATE)</code>.</p>
<p>For example,</p>
<pre>
#define PRED(D,STATE) <a href="comparison_less.htm#BOOST_PP_LESS_D">BOOST_PP_LESS_D</a>(D,<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,STATE),<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,STATE))
#define OP(D,STATE) (<a href="inc.htm#BOOST_PP_INC">BOOST_PP_INC</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,STATE)),<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,STATE))
<a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>(PRED,OP,(0,3))
</pre>
<p>expands to:</p>
<pre>
(3,3)
</pre>
<h3>Legend</h3>
<ul>
<li><b>STATE</b> is the current state of iteration. The state is usually a tuple.</li>
<li><b>PRED</b> is the condition for iteration. It must expand to a decimal
integer literal.</li>
<li><b>OP</b> is the iterated macro. Note that if the state is a tuple, then
OP(D,STATE) 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 <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>(). Such macros include
<a href="arithmetic_add.htm#BOOST_PP_ADD">BOOST_PP_ADD</a>() and other arithmetic operations. For each macro using
<a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>(), there is a version of the macro, distinguished by the
D suffix (e.g. <a href="arithmetic_add.htm#BOOST_PP_ADD_D">BOOST_PP_ADD_D</a>()), 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.</li>
</ul>
<h3>Automatic recursion?</h3>
<p><a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() currently does not implement automatic recursion. The reason
for this is that it would lead to very poor performance. The automatic recursion
technique takes O(N) steps just to find out that the Nth recursion should be used.
This would dramatically effect the time complexity of macros using automatic
recursion.</p>
<h3>Note</h3>
<ul>
<li>The value of the D parameter may exceed <a href="limits.htm#BOOST_PP_LIMIT_MAG">BOOST_PP_LIMIT_MAG</a>.</li>
<li>Using <a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() 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 <a href="arithmetic_add.htm#BOOST_PP_ADD">BOOST_PP_ADD</a>() for additional examples.</li>
</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>
<hr>
<a href="tuple_to_list.htm">Prev</a> <a href="arithmetic.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body></html>

View File

@ -1,478 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
<title>Boost.Preprocessor - Tutorial</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center">Boost.Preprocessor</h1>
<h2 align="center">Tutorial</h2>
</td>
</tr>
</table>
<hr>
<h2>Contents</h2>
<dl class="page-index">
<dt><a href="#Motivation">Motivation</a></dt>
<dt><a href="#Techniques">Preprocessor Metaprogramming Techniques</a>
<dl class="page-index">
<dt><a href="#Local Macro">Use a Local Macro to avoid small scale repetition</a></dt>
<dt><a href="#UNUSED">Use BOOST_PP_EMPTY as an unused parameter in Local
Macro instantiations</a></dt>
<dt><a href="#CAT">Use BOOST_PP_CAT instead of ## when necessary</a></dt>
<dt><a href="#STRINGIZE">Use BOOST_PP_STRINGIZE instead of # whenever necessary</a></dt>
<dt><a href="#ENUM_PARAMS">Avoid O(N) repetition on lists in general</a></dt>
<dt><a href="#Conditional Define">Use a Conditional Define to enable user configuration of code repetition</a></dt>
<dt><a href="#Token Look-Up">Use Token Look-Up Function to eliminate categorical repetition</a></dt>
<dt><a href="#2ND_REPEAT">Use BOOST_PP_REPEAT to avoid O(N*N) repetition</a></dt>
<dt><a href="#IF">Use BOOST_PP_IF to implement special case for the first element</a></dt>
<dt><a href="#Arithmetic">Use arithmetic, logical and comparison operations when necessary</a></dt>
</dl>
</dt>
</dl>
<hr>
<h2><a name="Motivation">Motivation</a></h2>
<p>The C++ function and template parameter lists are special syntactic constructs
and it is impossible to directly manipulate or generate them using C++ constructs.
This leads to unnecessary code repetition.</p>
<p> Consider the implementation of the is_function<> metafunction in Boost. The
implementation uses an overloaded is_function_tester() function that is used
for testing if a type is convertible to pointer to a function. Because of the
special treatment of parameter lists, it is not possible to directly match a
function with an arbitrary parameter list. Instead, the is_function_tester()
must be overloaded for every distinct number of parameters that is to be supported.
Example:</p>
<pre>template &lt;class R&gt;
yes_type is_function_tester(R (*)());
template &lt;class R, class A0&gt;
yes_type is_function_tester(R (*)(A0));
template &lt;class R, class A0, A1&gt;
yes_type is_function_tester(R (*)(A0, A1));
template &lt;class R, class A0, A1, A2&gt;
yes_type is_function_tester(R (*)(A0, A1, A2));
// ...
</pre>
<P>The need for this kind of repetition occurs particularly frequently while implementing
generic components or metaprogramming facilities, but the need also manifests
itself in many far simpler situations. </P>
<h3>Typical solutions</h3>
<p>Typically the repetition is done manually. Manual code repetition is highly
unproductive, but sometimes more readable to the untrained eye.</p>
<p>Another solution is to write an external program for generating the repeated
code or use some other extra linquistic means such as a smart editor. Unfortunately,
using external code generators has many disadvantages:</p>
<ul>
<li>writing the generator takes time (this could be helped by using a standard
generator)</li>
<li>it is no longer productive to manipulate C++ code directly</li>
<li>invoking the generator may be difficult</li>
<li>automating the invocation of the generator can be difficult in certain environments
(automatic invocation is desirable for active libraries)</li>
<li>porting and distributing the generator may be difficult or simply takes
precious time</li>
</ul>
<h3>What about the preprocessor?</h3>
<p>Because C++ comes with a preprocessor, one would assume that it would support
these kind of needs directly. Using the preprocessor in this case is highly
desirable because:</p>
<ul>
<li>preprocessor is highly portable</li>
<li>preprocessor is automatically invoked as part of the compiling process</li>
<li>preprocessor metacode can be directly embedded into the C++ source code</li>
<li>Compilers generally allow to view or output the preprocessed code, which
can be used for debugging or to copy-paste the generated code.</li>
</ul>
<p>Most unfortunately, the preprocessor is a very low level preprocessor that
specifically does not support repetition or recursive macros. Library support
is needed!</p>
<p><i>For detailed information on the capabilities and limitations of the preprocessor,
please refer to the C++ standard <A href="bibliography.htm#[Std]">[Std]</A>.</i></p>
<h3>The motivation example revisited</h3>
<p>Using the primitives of the PREPROCESSOR library, the is_function_tester()s
could be implemented like this:</p>
<pre>#define IS_FUNCTION_TESTER(N,_)\
template&lt;class R BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, class A)&gt;\
yes_type is_function_tester(R (*)(BOOST_PP_ENUM_PARAMS(N,A)));
BOOST_PP_REPEAT(BOOST_PP_INC(MAX_IS_FUNCTION_TESTER_PARAMS),IS_FUNCTION_TESTER,_)
#undef IS_FUNCTION_TESTER
</pre>
<p>In order to change the maximum number of function parameters supported, you
now simply change the MAX_IS_FUNCTION_TESTER_PARAMS definition and recompile.</p>
<HR>
<H2><a name="Techniques">Preprocessor Metaprogramming Techniques</a></H2>
<P>The&nbsp;preprocessor metaprogramming techniques are presented in example format.
</P>
<HR>
<P><B><a name="Local Macro"></a><a href="examples_preprocessed.htm#Local Macro">EXAMPLE</a>:</B>
Use a Local Macro to avoid small scale repetition</P>
<pre>#define BOOST_PP_DEF(OP) \
template&lt;class T, int n&gt; \
vec&lt;T,n&gt;&amp; \
operator OP##= \
( vec&lt;T,n&gt;&amp; \
lhs \
, const vec&lt;T,n&gt;&amp; \
rhs \
) \
{ for (int i=0; i&lt;n; ++i)\
lhs(i) OP##= rhs(i); \
return lhs; \
}
BOOST_PP_DEF(+)
BOOST_PP_DEF(-)
BOOST_PP_DEF(*)
BOOST_PP_DEF(/)
#undef BOOST_PP_DEF
</pre>
<P><B>TIP:</B> It is usually okay to use a standard macro name like BOOST_PP_DEF
for this kind of code, because the macro is both defined and undefined in the
immediate site of its use.</P>
<P><B>TIP:</B> It is easier to verify proper use of
the line continuation operator when they are aligned.</P>
<P><B>NOTES:</B> You can extend this example by defining more and different kinds
of operators. Before doing so, consider using the Algebraic Categories technique
introduced in <A href="bibliography.htm#[Barton]">[Barton]</A> or a Layered Architecture (see for instance
<A href="bibliography.htm#[Czarnecki]">[Czarnecki]</A>). However, at some point you must type the operator tokens
*, /, +, -, ..., because it is impossible to generate them using templates.
The resulting Categorical Repetition of tokens can be eliminated by using preprocessor
metaprogramming.</P>
<HR>
<P><B><a name="UNUSED"></a><a href="examples_preprocessed.htm#UNUSED">EXAMPLE</a>:</B>
Use BOOST_PP_EMPTY as an unused parameter in Local Macro instantiations</P>
<pre>#define BOOST_PP_DEF(CV) \
template&lt;class base&gt; \
CV() typename implement_subscript_using_begin_subscript&lt;base&gt;::value_type&amp;\
implement_subscript_using_begin_subscript&lt;base&gt;::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><B>HOW:</B> BOOST_PP_EMPTY() expands to nothing and can be used as
an unused parameter.</P>
<P><b>NOTE:</b> BOOST_PP_EMPTY without the () never gets expanded. The
() is necessary to invoke a function-like macro.</P>
<B>CAVEAT:</B> You can not safely use concatenation while using BOOST_PP_EMPTY().
<P><B>TIP:</B> Occasionally one or two lines are
considerably longer than the rest. It can often save some work to not align all
of the line continuation operators without making the code too unreadable.</P>
<P><B>TIP:</B> Use syntax highlighting on preprocessor metaprogramming macro and
parameter identifiers such as</P>
<ul>
<li>BOOST_PP_DEF,</li>
<li>BOOST_PP_EMPTY,</li>
<li>BOOST_PP_REPEAT,</li>
<li>OP,</li>
<li>CV,</li>
<li>...</li>
</ul>
<p>It can greatly improve readability.</p>
<HR>
<P><a name="CAT"></a><a href="examples_preprocessed.htm#CAT"><B>EXAMPLE:</B></a> Use BOOST_PP_CAT instead of ## when necessary</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) &lt;= sizeof(long));
</pre>
<P><B>WHY:</B> Macro expansion proceeds recursively in "layers". Token pasting
prevents the&nbsp;preprocessor from performing macro expansion, therefore it
is often necessary to delay token concatenation.</P>
<hr>
<p><a name="STRINGIZE"></a><a href="examples_preprocessed.htm#STRINGIZE"><B>EXAMPLE:</B></a> Use BOOST_PP_STRINGIZE instead of # whenever necessary</p>
<pre>#define NOTE(STR)\
message(__FILE__ &quot;(&quot; BOOST_PP_STRINGIZE(__LINE__) &quot;) : &quot; STR)
// ...
#pragma NOTE("TBD!")
</pre>
<p><b>WHY:</b> Macro expansion proceeds recursively in &quot;layers&quot;. Stringization
prevents the preprocessor from performing macro expansion, therefore it is often
necessary to delay stringization.</p>
<HR>
<P><B><a name="ENUM_PARAMS"></a><a href="examples_preprocessed.htm#ENUM_PARAMS">EXAMPLE</a>:</B>
Use:</P>
<ul>
<li>BOOST_PP_ENUM_PARAMS,</li>
<li>BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT,</li>
<li>BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS,</li>
<li>BOOST_PP_ENUM_SHIFTED_PARAMS, or</li>
<li>BOOST_PP_REPEAT, and</li>
<li>BOOST_PP_COMMA_IF</li>
</ul>
<p>to avoid O(N) repetition on lists in general</p>
<pre>struct make_type_list_end;
template
&lt; BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT
( MAKE_TYPE_LIST_MAX_LENGTH
, class T
, make_type_list_end
)
&gt;
struct make_type_list
{
private:
enum
{ end = is_same&lt;T0,make_type_list_end&gt;::value
};
public:
typedef typename
type_if
&lt; end
, type_cons_empty
, type_cons
&lt; T0
, typename
type_inner_if
&lt; end
, type_identity&lt;end&gt;
, make_type_list
&lt; BOOST_PP_ENUM_SHIFTED_PARAMS
( MAKE_TYPE_LIST_MAX_LENGTH
, T
)
&gt;
&gt;::type
&gt;
&gt;::type type;
};
</pre>
<P><B>HOW:</B> BOOST_PP_REPEAT uses simulated recursion (pseudo code):</P>
<pre>#define BOOST_PP_REPEAT(N,M,P) BOOST_PP_REPEAT##N(M,P)
#define BOOST_PP_REPEAT0(M,P)
#define BOOST_PP_REPEAT1(M,P) M(0,P)
#define BOOST_PP_REPEAT2(M,P) M(0,P) M(1,P)
#define BOOST_PP_REPEAT3(M,P) BOOST_PP_REPEAT2(M,P) M(2,P)
#define BOOST_PP_REPEAT4(M,P) BOOST_PP_REPEAT3(M,P) M(3,P)
// ...
</pre>
<P>BOOST_PP_ENUM_PARAMS variations use BOOST_PP_REPEAT</P>
<P>BOOST_PP_COMMA_IF(I) expands to a comma if I != 0.</P>
<P>BOOST_PP_INC(I) expands essentially to "I+1" and BOOST_PP_DEC(I)
expands essentially to "I-1".</P>
<HR>
<P><a name="Conditional Define"><B>EXAMPLE:</B></a> Use a Conditional Define to
enable user configuration of code repetition based on need rather than some
"reasonable" upper limit</P>
<pre>#ifndef MAKE_TYPE_LIST_MAX_LENGTH
#define MAKE_TYPE_LIST_MAX_LENGTH 8
#endif
</pre>
<P>Now the user can configure the make_type_list primitive without modifying library
code.</P>
<HR>
<P><B><a name="Token Look-Up"></a><a href="examples_preprocessed.htm#Token Look-Up">EXAMPLE</a>:</B>
Use BOOST_PP_REPEAT and a Token Look-Up Function to eliminate categorical
repetition</P>
<pre>// CAVEAT: My compiler is not standard on arithmetic types.
#define ARITHMETIC_TYPE(I) ARITHMETIC_TYPE##I
#define ARITHMETIC_TYPE0 bool
#define ARITHMETIC_TYPE1 char
#define ARITHMETIC_TYPE2 signed char
#define ARITHMETIC_TYPE3 unsigned char
#define ARITHMETIC_TYPE4 short
#define ARITHMETIC_TYPE5 unsigned short
#define ARITHMETIC_TYPE6 int
#define ARITHMETIC_TYPE7 unsigned int
#define ARITHMETIC_TYPE8 long
#define ARITHMETIC_TYPE9 unsigned long
#define ARITHMETIC_TYPE10 float
#define ARITHMETIC_TYPE11 double
#define ARITHMETIC_TYPE12 long double
#define ARITHMETIC_TYPE_CNT 13
// ...
#define BOOST_PP_DEF(I,_)\
catch (ARITHMETIC_TYPE(I) t)\
{ report_typeid(t);\
report_value(t);\
}
BOOST_PP_REPEAT
( ARITHMETIC_TYPE_CNT
, BOOST_PP_DEF
, _
)
#undef BOOST_PP_DEF
// ...
</pre>
<P><B>NOTE:</B> The repetition of the above
example can be eliminated using template metaprogramming <A href="bibliography.htm#[Czarnecki]">[Czarnecki]</A>&nbsp;as well. However
categorical repetition of operator tokens can not be completely eliminated by
using template metaprogramming.</P>
<HR>
<P><B><a name="2ND_REPEAT"></a><a href="examples_preprocessed.htm#2ND_REPEAT">EXAMPLE</a>:</B>
Use BOOST_PP_REPEAT to avoid O(N*N) repetition</P>
<pre>#ifndef MAX_VEC_ARG_CNT
#define MAX_VEC_ARG_CNT 8
#endif
// ...
#define ARG_FUN(I,_) BOOST_PP_COMMA_IF(I) T a##I
#define ASSIGN_FUN(I,_) (*this)[I] = a##I;
#define DEF_VEC_CTOR_FUN(I,_)\
vec( BOOST_PP_REPEAT(I,ARG_FUN,_) )\
{ BOOST_PP_REPEAT(I,ASSIGN_FUN,_)\
}
BOOST_PP_REPEAT
( BOOST_PP_INC(MAX_VEC_ARG_CNT)
, DEF_VEC_CTOR_FUN
, _
)
#undef ARG_FUN
#undef ASSIGN_FUN
#undef DEF_VEC_CTOR_FUN
// ...
</pre>
<P><B>HOW:</B> BOOST_PP_REPEAT is implemented in a special way to enable
automatic recursion.</P>
<HR>
<P><a name="IF"></a><a href="examples_preprocessed.htm#IF"><B>EXAMPLE:</B></a> Use BOOST_PP_IF to implement special case for the first element</P>
<pre>#define BOOST_PP_COMMA_IF(C)\
BOOST_PP_IF(C,BOOST_PP_COMMA,BOOST_PP_EMPTY)()
BOOST_PP_IF(0,true,false) == false;
BOOST_PP_IF(1,true,false) == true;
</pre>
<P>BOOST_PP_IF enables convenient generation of lists using BOOST_PP_REPEAT.</P>
<P><B>NOTE:</B> THEN and ELSE don't have to be macros. However, if at least one
of them is a function-like macro and you want it to be expanded conditionally,
you have to make the other parameter a function-like macro, too. This can often
be done using BOOST_PP_IDENTITY. Consider the following example (by
Aleksey Gurtovoy):</P>
<pre>#define NUMBERED_EXPRESSION(I,X)\
BOOST_PP_IF \
( I \
, BOOST_PP_IDENTITY(X##I) \
, BOOST_PP_EMPTY \
)()</pre>
<P><b>NOTE:</b> Like in the above implementation of COMMA_IF, the result of IF
is often invoked and not the THEN and ELSE parameters. If the parameters were
invoked, the code would not expand correctly, because the EMPTY parameter would
get expanded to nothing before the IF would be properly expanded.</P>
<P><b>HOW:</b> BOOST_PP_IF is defined for the entire repeat range (pseudo
code):</P>
<pre>#define BOOST_PP_IF(C,THEN,ELSE) BOOST_PP_IF##C(THEN,ELSE)
#define BOOST_PP_IF0(THEN,ELSE) ELSE
#define BOOST_PP_IF1(THEN,ELSE) THEN
#define BOOST_PP_IF2(THEN,ELSE) THEN
// ...
</pre>
<hr>
<p><a name="Arithmetic"></a><a href="examples_preprocessed.htm#Arithmetic"><B>EXAMPLE:</B></a> Use arithmetic, logical and comparison operations when necessary</p>
<P>The PREPROCESSOR library supports saturated arithmetic, logical and
comparison operations on decimal integer literals in the range [0,BOOST_PP_LIMIT_MAG].</p>
<p>Suppose that you want to generate a numbered lists with a special element inserted
at a desired position. For example: E0, E1, S, E2. Consider the following example:</p>
<pre>#define SPECIAL_NUMBERED_LIST(N,I,ELEM,SPECIAL)\
BOOST_PP_ASSERT_MSG(BOOST_PP_LESS(I,N),BAD PARAMS FOR SPECIAL_NUMBERED_LIST!)\
BOOST_PP_ENUM_PARAMS(I,ELEM)\
BOOST_PP_COMMA_IF(I) SPECIAL\
BOOST_PP_REPEAT(BOOST_PP_SUB(\
BOOST_PP_DEC(N),I),SPECIAL_NUMBERED_LIST_HELPER,(ELEM,I))
#define SPECIAL_NUMBERED_LIST_HELPER(I,ELEM_BASE)\
,\
BOOST_PP_CAT\
( BOOST_PP_TUPLE_ELEM(2,0,ELEM_BASE)\
, BOOST_PP_ADD\
( I\
, BOOST_PP_TUPLE_ELEM(2,1,ELEM_BASE)\
)\
)
SPECIAL_NUMBERED_LIST(3,0,E,S)
SPECIAL_NUMBERED_LIST(3,1,E,S)
SPECIAL_NUMBERED_LIST(3,2,E,S)
SPECIAL_NUMBERED_LIST(3,3,E,S)
</pre>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>
<p>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.</p>
</body>
</html>

View File

@ -1,145 +0,0 @@
/* Copyright (C) 2002
* Housemarque Oy
* http://www.housemarque.com
*
* Permission to copy, use, modify, sell and distribute this software is
* granted provided this copyright notice appears in all copies. This
* software is provided "as is" without express or implied warranty, and
* with no claim as to its suitability for any purpose.
*
* See http://www.boost.org for most recent version.
*/
/* This example implements over 2200 functions for 1-dimensional arithmetic
* array manipulation in C. The idea is to use preprocessor data structures,
* lists and tuples, for storing metainformation to be used for generating
* the actual C code.
*
* Who needs templates anyway? :)
*
* Compile with any C compiler with a standards conforming preprocessor.
*/
#include <boost/preprocessor/list/for_each_product.hpp>
#include <boost/preprocessor/list/at.hpp>
#include <boost/preprocessor/list/cat.hpp>
#include <boost/preprocessor/list/append.hpp>
#include <boost/preprocessor/tuple/to_list.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#include <boost/preprocessor/comparison/less.hpp>
#include <boost/preprocessor/logical/or.hpp>
/* Information about C operators. */
/* Accessors for the operator datatype. */
#define OP_SYMBOL(O) BOOST_PP_TUPLE_ELEM(5,0,O)
#define OP_NAME(O) BOOST_PP_TUPLE_ELEM(5,1,O)
#define OP_IS_FLOATING(O) BOOST_PP_TUPLE_ELEM(5,2,O)
#define OP_IS_LOGICAL(O) BOOST_PP_TUPLE_ELEM(5,3,O)
#define OP_IS_SHIFT(O) BOOST_PP_TUPLE_ELEM(5,4,O)
/* List of applicative unary operators. */
#define APPLICATIVE_UNARY_OPS\
BOOST_PP_TUPLE_TO_LIST\
( 3\
, ( ( ! , logical_not , 1 , 1 , 0 )\
, ( ~ , bitwise_not , 0 , 0 , 0 )\
, ( - , neg , 1 , 0 , 0 )\
)\
)
/* List of applicative binary operators. */
#define APPLICATIVE_BINARY_OPS\
BOOST_PP_TUPLE_TO_LIST\
( 18\
, ( ( * , mul , 1 , 0 , 0 )\
, ( / , div , 1 , 0 , 0 )\
, ( % , mod , 0 , 0 , 0 )\
, ( + , add , 1 , 0 , 0 )\
, ( - , sub , 1 , 0 , 0 )\
, ( << , shift_left , 0 , 0 , 1 )\
, ( >> , shift_right , 0 , 0 , 1 )\
, ( < , less , 1 , 1 , 0 )\
, ( <= , less_equal , 1 , 1 , 0 )\
, ( >= , greater_equal , 1 , 1 , 0 )\
, ( > , greater , 1 , 1 , 0 )\
, ( == , equal , 1 , 1 , 0 )\
, ( != , not_equal , 1 , 1 , 0 )\
, ( & , bitwise_and , 0 , 0 , 0 )\
, ( | , bitwise_or , 0 , 0 , 0 )\
, ( ^ , bitwise_xor , 0 , 0 , 0 )\
, ( && , logical_and , 1 , 1 , 0 )\
, ( || , logical_or , 1 , 1 , 0 )\
)\
)
/* Information about C built-in types. */
/* Accessors for the type datatype. */
#define TYPE_NAME(T) BOOST_PP_TUPLE_ELEM(4,0,T)
#define TYPE_ABBREVIATION(T) BOOST_PP_TUPLE_ELEM(4,1,T)
#define TYPE_IS_FLOATING(T) BOOST_PP_TUPLE_ELEM(4,2,T)
#define TYPE_RANK(T) BOOST_PP_TUPLE_ELEM(4,3,T)
/* List of C built-in types. */
#define BUILTIN_TYPES\
BOOST_PP_TUPLE_TO_LIST\
( 12\
, ( ( signed char , sc , 0 , 1 )\
, ( char , ch , 0 , 1 )\
, ( unsigned char , uc , 0 , 1 )\
, ( short , ss , 0 , 2 )\
, ( unsigned short , us , 0 , 2 )\
, TYPE_INT\
, ( unsigned , ui , 0 , 4 )\
, ( long , sl , 0 , 5 )\
, ( unsigned long , ul , 0 , 6 )\
, ( float , fl , 1 , 7 )\
, ( double , db , 1 , 8 )\
, ( long double , ld , 1 , 9 )\
)\
)
/* Type int is needed in some type computations. */
#define TYPE_INT ( int , si , 0 , 3 )
/* Type computation macros. */
#define TYPE_OF_INTEGER_PROMOTION(T) BOOST_PP_IF(BOOST_PP_LESS(TYPE_RANK(T),TYPE_RANK(TYPE_INT)),TYPE_INT,T)
#define TYPE_OF_USUAL_ARITHMETIC_CONVERSION(L,R) TYPE_OF_INTEGER_PROMOTION(BOOST_PP_IF(BOOST_PP_LESS(TYPE_RANK(L),TYPE_RANK(R)),R,L))
#define TYPE_OF_UNARY_OP(O,T) BOOST_PP_IF(OP_IS_LOGICAL(O),TYPE_INT,TYPE_OF_INTEGER_PROMOTION(T))
#define TYPE_OF_BINARY_OP(O,L,R) BOOST_PP_IF(OP_IS_LOGICAL(O),TYPE_INT,BOOST_PP_IF(OP_IS_SHIFT(O),TYPE_OF_INTEGER_PROMOTION(L),TYPE_OF_USUAL_ARITHMETIC_CONVERSION(L,R)))
#define IS_VALID_UNARY_OP_AND_TYPE_COMBINATION(O,T) BOOST_PP_IF(TYPE_IS_FLOATING(T),OP_IS_FLOATING(O),1)
#define IS_VALID_BINARY_OP_AND_TYPE_COMBINATION(O,L,R) BOOST_PP_IF(BOOST_PP_OR(TYPE_IS_FLOATING(L),TYPE_IS_FLOATING(R)),OP_IS_FLOATING(O),1)
/* Generates code for all all unary operators and integral types. */
#define UNARY_ARRAY_OP(_,OT) BOOST_PP_IF(IS_VALID_UNARY_OP_AND_TYPE_COMBINATION OT,UNARY_ARRAY_OP_CODE,BOOST_PP_TUPLE2_EAT) OT
#define UNARY_ARRAY_OP_CODE(O,T)\
void BOOST_PP_LIST_CAT(BOOST_PP_TUPLE_TO_LIST(4,(array_,OP_NAME(O),_,TYPE_ABBREVIATION(T))))\
( const TYPE_NAME(T)* in\
, TYPE_NAME(TYPE_OF_UNARY_OP(O,T))* out\
, unsigned n\
)\
{ do\
{ *out++ = OP_SYMBOL(O) *in++;\
} while (--n);\
}
BOOST_PP_LIST_FOR_EACH_PRODUCT(UNARY_ARRAY_OP,2,(APPLICATIVE_UNARY_OPS,BUILTIN_TYPES))
/* Generates code for all binary operators and integral type pairs. */
#define BINARY_ARRAY_OP(_,OLR) BOOST_PP_IF(IS_VALID_BINARY_OP_AND_TYPE_COMBINATION OLR,BINARY_ARRAY_OP_CODE,BOOST_PP_TUPLE3_EAT) OLR
#define BINARY_ARRAY_OP_CODE(O,L,R)\
void BOOST_PP_LIST_CAT(BOOST_PP_TUPLE_TO_LIST(6,(array_,OP_NAME(O),_,TYPE_ABBREVIATION(L),_,TYPE_ABBREVIATION(R))))\
( const TYPE_NAME(L)* lhs_in\
, const TYPE_NAME(R)* rhs_in\
, TYPE_NAME(TYPE_OF_BINARY_OP(O,L,R))* out\
, unsigned n\
)\
{ do\
{ *out++ = *lhs_in OP_SYMBOL(O) *rhs_in;\
++lhs_in;\
++rhs_in;\
} while (--n);\
}
BOOST_PP_LIST_FOR_EACH_PRODUCT(BINARY_ARRAY_OP,3,(APPLICATIVE_BINARY_OPS,BUILTIN_TYPES,BUILTIN_TYPES))

View File

@ -1,50 +0,0 @@
/* Copyright (C) 2002
* Housemarque Oy
* http://www.housemarque.com
*
* Permission to copy, use, modify, sell and distribute this software is
* granted provided this copyright notice appears in all copies. This
* software is provided "as is" without express or implied warranty, and
* with no claim as to its suitability for any purpose.
*
* See http://www.boost.org for most recent version.
*/
/* This example demonstrates the usage of lists and BOOST_PP_LIST_FOR_EACH(). */
#include <boost/preprocessor/list/for_each.hpp>
#include <boost/preprocessor/tuple/to_list.hpp>
#include <iostream>
#include <typeinfo>
/* List of built-in types. (Strictly speaking wchar_t should be on the list.) */
#define BUILTIN_TYPES\
BOOST_PP_TUPLE_TO_LIST\
( 13\
, ( bool\
, char\
, signed char\
, unsigned char\
, unsigned short\
, short\
, int\
, unsigned\
, long\
, unsigned long\
, float\
, double\
, long double\
)\
)
/* This is the macro we pass to BOOST_PP_LIST_FOR_EACH(). */
#define CATCH(R,_,T)\
catch (T t) { std::cerr << "Caught an " << typeid(t).name() << " = " << t; }
int main()
{
try { throw 10; }
BOOST_PP_LIST_FOR_EACH(CATCH,_,BUILTIN_TYPES)
return 0;
}

View File

@ -1,30 +0,0 @@
/* Copyright (C) 2002
* Housemarque Oy
* http://www.housemarque.com
*
* Permission to copy, use, modify, sell and distribute this software is
* granted provided this copyright notice appears in all copies. This
* software is provided "as is" without express or implied warranty, and
* with no claim as to its suitability for any purpose.
*
* See http://www.boost.org for most recent version.
*/
/* This is a trivial example of using BOOST_PP_WHILE() that simply
* counts down from N to 0 ultimately expanding to a 0.
*/
#include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/while.hpp>
#define COUNT_DOWN(N) BOOST_PP_WHILE(COUNT_DOWN_C,COUNT_DOWN_F,N)
/* Above is the macro we are implementing using BOOST_PP_WHILE(). */
#define COUNT_DOWN_C(D,N) N
/* Above is the condition. It expands to the current N. */
#define COUNT_DOWN_F(D,N) BOOST_PP_DEC(N)
/* Above is the iteration macro. It decrements N. */
enum { x = COUNT_DOWN(50) };
/* The above expands to 0. */

View File

@ -1,92 +0,0 @@
/* Copyright (C) 2002
* Housemarque Oy
* http://www.housemarque.com
*
* Permission to copy, use, modify, sell and distribute this software is
* granted provided this copyright notice appears in all copies. This
* software is provided "as is" without express or implied warranty, and
* with no claim as to its suitability for any purpose.
*
* See http://www.boost.org for most recent version.
*/
#include <boost/preprocessor/while.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/empty.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
/* The time complexity of DELAY(N) is O(pow(2,N)).
*
* Handy when recompiles are too fast to take a coffee break. :)
*
* Template metaprogramming can be used for implementing similar
* delays. Unfortunately template instantiation consumes memory,
* therefore compilers usually fail to fully compile long template
* based delays, because they run out of memory.
*
* On many compilers (e.g. g++, MSVC++), this macro takes only a
* small amount of memory to preprocess. On some compilers (e.g.
* MWCW), however, this macro seems to consume huge amounts of
* memory.
*/
#ifndef DELAY_MAX
#define DELAY_MAX 14
#endif
#define DELAY(N) BOOST_PP_TUPLE_ELEM(2,0,(BOOST_PP_EMPTY,BOOST_PP_WHILE(DELAY_C,BOOST_PP_CAT(DELAY_F,N),BOOST_PP_DEC(N))))()
#define DELAY_C(D,N) N
#define DELAY_F0(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F1(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F2(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F3(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F4(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F5(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F6(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F7(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F8(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F9(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F10(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F11(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F12(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F13(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F14(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F15(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F16(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F17(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F18(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F19(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F20(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F21(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F22(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F23(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F24(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F25(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F26(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F27(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F28(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F29(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F30(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F31(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F32(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F33(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F34(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F35(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F36(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F37(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F38(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F39(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F40(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F41(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F42(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F43(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F44(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F45(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F46(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F47(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F48(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F49(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
#define DELAY_F50(D,N) BOOST_PP_IF(1,BOOST_PP_DEC(N),BOOST_PP_WHILE##D(DELAY_C,DELAY_F##N,BOOST_PP_DEC(N)))
DELAY(DELAY_MAX)

View File

@ -1,63 +0,0 @@
/* Copyright (C) 2002
* Housemarque Oy
* http://www.housemarque.com
*
* Permission to copy, use, modify, sell and distribute this software is
* granted provided this copyright notice appears in all copies. This
* software is provided "as is" without express or implied warranty, and
* with no claim as to its suitability for any purpose.
*
* See http://www.boost.org for most recent version.
*/
/* This example uses the preprocessor library to implement a generalized
* macro for implementing a Duff's Device.
*
* This example was inspired by an original generalized macro for
* implementing Duff's Device written by Joerg Walter.
*/
#include <boost/preprocessor/repeat.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <assert.h>
/* Expands to a Duff's Device. */
#define DUFFS_DEVICE(UNROLLING_FACTOR,COUNTER_TYPE,N,STATEMENT)\
do\
{\
COUNTER_TYPE duffs_device_initial_cnt = (N);\
if (duffs_device_initial_cnt > 0)\
{\
COUNTER_TYPE duffs_device_running_cnt = (duffs_device_initial_cnt + (UNROLLING_FACTOR-1))/UNROLLING_FACTOR;\
switch (duffs_device_initial_cnt % UNROLLING_FACTOR)\
{\
do\
{\
BOOST_PP_REPEAT(UNROLLING_FACTOR,DUFFS_DEVICE_C,(UNROLLING_FACTOR,{STATEMENT}))\
} while (--duffs_device_running_cnt);\
}\
}\
} while (0)
#define DUFFS_DEVICE_C(I,UNROLLING_FACTOR_STATEMENT)\
case (I?BOOST_PP_TUPLE_ELEM(2,0,UNROLLING_FACTOR_STATEMENT)-I:0): BOOST_PP_TUPLE_ELEM(2,1,UNROLLING_FACTOR_STATEMENT);
#ifndef UNROLLING_FACTOR
#define UNROLLING_FACTOR 16
#endif
#ifndef N
#define N 1000
#endif
int main(void)
{
int i=0;
DUFFS_DEVICE(UNROLLING_FACTOR, int, 0, ++i;);
assert(i == 0);
DUFFS_DEVICE(UNROLLING_FACTOR, int, N, ++i;);
assert(i == N);
return 0;
}

View File

@ -1,38 +0,0 @@
/* Copyright (C) 2002
* Housemarque Oy
* http://www.housemarque.com
*
* Permission to copy, use, modify, sell and distribute this software is
* granted provided this copyright notice appears in all copies. This
* software is provided "as is" without express or implied warranty, and
* with no claim as to its suitability for any purpose.
*
* See http://www.boost.org for most recent version.
*/
/* This example demonstrates the usage of preprocessor lists for generating C++ code. */
#include <boost/preprocessor/list/for_each_product.hpp>
#include <boost/preprocessor/list/at.hpp>
#include <boost/preprocessor/tuple/to_list.hpp>
#include <boost/preprocessor/empty.hpp>
/* List of integral types. (Strictly speaking, wchar_t should be on the list.) */
#define INTEGRAL_TYPES\
BOOST_PP_TUPLE_TO_LIST(9,(char, signed char, unsigned char, short, unsigned short, int, unsigned, long, unsigned long))
/* List of invokeable cv-qualifiers. */
#define CV_QUALIFIERS\
BOOST_PP_TUPLE_TO_LIST(4,(BOOST_PP_EMPTY, const BOOST_PP_EMPTY, volatile BOOST_PP_EMPTY, const volatile BOOST_PP_EMPTY))
/* Template for testing whether a type is an integral type. */
template<class T> struct is_integral {enum {value = false};};
/* Macro for defining a specialization of is_integral<> template. */
#define IS_INTEGRAL_SPECIALIZATION(R,L)\
template<> struct is_integral<BOOST_PP_TUPLE_ELEM(2,0,L)() BOOST_PP_TUPLE_ELEM(2,1,L)> {enum {value = true};};
BOOST_PP_LIST_FOR_EACH_PRODUCT(IS_INTEGRAL_SPECIALIZATION,2,(CV_QUALIFIERS, INTEGRAL_TYPES))
#undef IS_INTEGRAL_SPECIALIZATION
#undef CV_QUALIFIERS
#undef INTEGRAL_TYPES

View File

@ -1,91 +0,0 @@
/* Copyright (C) 2002
* Housemarque Oy
* http://www.housemarque.com
*
* Permission to copy, use, modify, sell and distribute this software is
* granted provided this copyright notice appears in all copies. This
* software is provided "as is" without express or implied warranty, and
* with no claim as to its suitability for any purpose.
*
* See http://www.boost.org for most recent version.
*/
/* This example shows how BOOST_PP_WHILE() can be used for implementing
* macros.
*/
#include <boost/preprocessor/while.hpp>
#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/list/adt.hpp>
#include <boost/preprocessor/comparison/less_equal.hpp>
#include <stdio.h>
/* First consider the following C implementation of Fibonacci. */
typedef struct linear_fib_state { int a0, a1, n; } linear_fib_state;
static int linear_fib_c( linear_fib_state p )
{
return p.n;
}
static linear_fib_state linear_fib_f( linear_fib_state p )
{
linear_fib_state r = { p.a1, p.a0 + p.a1, p.n - 1 };
return r;
}
static int linear_fib( int n )
{
linear_fib_state p = { 0, 1, n };
while ( linear_fib_c(p) ) { p = linear_fib_f(p); }
return p.a0;
}
/* Then consider the following preprocessor implementation of Fibonacci. */
#define LINEAR_FIB(N)\
LINEAR_FIB_D(0,N)
/* Since the macro is implemented using BOOST_PP_WHILE, the actual
* implementation takes a depth as a parameter so that it can be called
* inside a BOOST_PP_WHILE. The above easy-to-use version simply uses 0
* as the depth and can not be called inside a BOOST_PP_WHILE.
*/
#define LINEAR_FIB_D(D,N)\
BOOST_PP_TUPLE_ELEM(3,0,BOOST_PP_WHILE##D(LINEAR_FIB_C,LINEAR_FIB_F,(0,1,N)))
/* ^^^ ^^^ ^^ ^^ ^^^^^^^
* #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 LINEAR_FIB_C(D,P)\
/* p.n */ BOOST_PP_TUPLE_ELEM(3,2,P)
#define LINEAR_FIB_F(D,P)\
(/* p.a1 */ BOOST_PP_TUPLE_ELEM(3,1,P)\
,/* p.a0+p.a1*/ BOOST_PP_ADD_D(D,BOOST_PP_TUPLE_ELEM(3,0,P),BOOST_PP_TUPLE_ELEM(3,1,P))\
/* ^^ ^ \
* BOOST_PP_ADD() uses BOOST_PP_WHILE(). Therefore we must\
* pass the recursion depth explicitly to BOOST_PP_ADD_D().\
*/\
,/* p.n - 1 */ BOOST_PP_DEC(BOOST_PP_TUPLE_ELEM(3,2,P))\
)
int main()
{
printf("linear_fib(10) = %d\n", linear_fib(10));
printf("LINEAR_FIB(10) = %d\n", LINEAR_FIB(10));
return 0;
}

View File

@ -1,22 +0,0 @@
/* Copyright (C) 2002
* Housemarque Oy
* http://www.housemarque.com
*
* Permission to copy, use, modify, sell and distribute this software is
* granted provided this copyright notice appears in all copies. This
* software is provided "as is" without express or implied warranty, and
* with no claim as to its suitability for any purpose.
*
* See http://www.boost.org for most recent version.
*/
/* This example shows how BOOST_PP_STRINGIZE() can be used to allow macro
* expansion before stringization.
*/
#include <boost/preprocessor/stringize.hpp>
#define NOTE(STR)\
message(__FILE__ "(" BOOST_PP_STRINGIZE(__LINE__) ") : " STR)
#pragma NOTE("Hello, World!")

View File

@ -1,69 +0,0 @@
/* Copyright (C) 2002
* Housemarque Oy
* http://www.housemarque.com
*
* Permission to copy, use, modify, sell and distribute this software is
* granted provided this copyright notice appears in all copies. This
* software is provided "as is" without express or implied warranty, and
* with no claim as to its suitability for any purpose.
*
* See http://www.boost.org for most recent version.
*/
/* This example implements a generalized macro for 2D repetition using
* the simple repetition primitives of the preprocessor library.
*/
#include <boost/preprocessor/repeat.hpp>
/** <p>Repeats the macro <code>M(X,Y,DATA)</code> for <code>X = [0,W)</code> and <code>Y = [0,H)</code>.</p>
<p>In other words, expands to the sequence:</p>
<pre>
M( 0, 0, DATA) M( 1, 0, DATA) ... M(W-1, 0, DATA)
M( 0, 1, DATA) M( 1, 1, DATA) ... M(W-1, 1, DATA)
... ... ... ...
M( 0,H-1, DATA) M( 1,H-1, DATA) ... M(W-1,H-1, DATA)
</pre>
*/
#define REPEAT_2D(W,H,M,DATA)\
/* Here we can simply use BOOST_PP_REPEAT(), because\
* it implements automatic recursion.\
*/\
BOOST_PP_REPEAT\
( H\
, REPEAT_2D_ROW\
, (W,M,DATA)\
)
#define REPEAT_2D_ROW(Y,WMD)\
BOOST_PP_REPEAT\
( BOOST_PP_TUPLE_ELEM(3,0,WMD)\
, REPEAT_2D_ELEM\
, (Y, BOOST_PP_TUPLE_ELEM(3,1,WMD), BOOST_PP_TUPLE_ELEM(3,2,WMD))\
)
#define REPEAT_2D_ELEM(X,YMD)\
BOOST_PP_TUPLE_ELEM(3,1,YMD)\
( X\
, BOOST_PP_TUPLE_ELEM(3,0,YMD)\
, BOOST_PP_TUPLE_ELEM(3,2,YMD)\
)
#include <boost/preprocessor/logical/or.hpp>
#include <boost/preprocessor/comma_if.hpp>
#include <boost/preprocessor/list/cat.hpp>
#include <boost/preprocessor/tuple/to_list.hpp>
/* Here we use the above macro to generate something. */
#define ELEM(X,Y,E) BOOST_PP_COMMA_IF(BOOST_PP_OR(X,Y)) BOOST_PP_LIST_CAT(BOOST_PP_TUPLE_TO_LIST(5,(E,_,X,_,Y)))
enum { REPEAT_2D(3,4,ELEM,elem) };
/* The above expands to:
*
* enum { elem_0_0, elem_1_0, elem_2_0,
* elem_0_1, elem_1_1, elem_2_1,
* elem_0_2, elem_1_2, elem_2_2,
* elem_0_3, elem_1_3, elem_2_3 };
*/

Some files were not shown because too many files have changed in this diff Show More