]> git.lyx.org Git - lyx.git/blob - boost/boost/preprocessor/enum.hpp
major boost update
[lyx.git] / boost / boost / preprocessor / enum.hpp
1 #ifndef BOOST_PREPROCESSOR_ENUM_HPP
2 #define BOOST_PREPROCESSOR_ENUM_HPP
3
4 /* Copyright (C) 2001
5  * Housemarque Oy
6  * http://www.housemarque.com
7  *
8  * Permission to copy, use, modify, sell and distribute this software is
9  * granted provided this copyright notice appears in all copies. This
10  * software is provided "as is" without express or implied warranty, and
11  * with no claim as to its suitability for any purpose.
12  *
13  * See http://www.boost.org for most recent version.
14  */
15
16 #include <boost/preprocessor/comma_if.hpp>
17 #include <boost/preprocessor/repeat.hpp>
18 #include <boost/preprocessor/tuple.hpp>
19
20 /** <p>Generates a comma separated list.</p>
21
22 <p>In other words, expands to the sequence:</p>
23
24 <pre>
25 MACRO(0,DATA), MACRO(1,DATA), ..., MACRO(BOOST_PP_DEC(COUNT),DATA)
26 </pre>
27
28 <p>For example,</p>
29
30 <pre>
31 #define TYPED_PARAM(INDEX,DATA)\
32   BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,DATA),INDEX) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,DATA),INDEX)
33 BOOST_PP_ENUM(3,TYPED_PARAM,(X,x))
34 </pre>
35
36 <p>expands to:</p>
37
38 <pre>
39 X0 x0, X1 x1, X2 x2
40 </pre>
41
42 <h3>Uses</h3>
43 <ul>
44   <li>BOOST_PP_REPEAT()</li>
45 </ul>
46
47 <h3>Test</h3>
48 <ul>
49   <li><a href="../../test/repeat_test.cpp">repeat_test.cpp</a></li>
50 </ul>
51 */
52 #define BOOST_PP_ENUM(COUNT,MACRO,DATA) BOOST_PP_REPEAT(COUNT,BOOST_PP_ENUM_F,(MACRO,DATA))
53
54 #if !defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__)
55 #  define BOOST_PP_ENUM_F(I,FP) BOOST_PP_COMMA_IF(I) BOOST_PP_TUPLE_ELEM(2,0,FP)(I,BOOST_PP_TUPLE_ELEM(2,1,FP))
56 #else
57 #  define BOOST_PP_ENUM_F(I,FP) BOOST_PP_COMMA_IF(I) BOOST_PP_TUPLE2_ELEM0 FP(I,BOOST_PP_TUPLE2_ELEM1 FP)
58 #endif
59 #endif