]> git.lyx.org Git - lyx.git/blob - boost/boost/preprocessor/enum_params_with_defaults.hpp
update
[lyx.git] / boost / boost / preprocessor / enum_params_with_defaults.hpp
1 #ifndef BOOST_PREPROCESSOR_ENUM_PARAMS_WITH_DEFAULTS_HPP
2 #define BOOST_PREPROCESSOR_ENUM_PARAMS_WITH_DEFAULTS_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/cat.hpp>
17 #include <boost/preprocessor/enum.hpp>
18
19 /** <p>Generates a comma separated list of parameters with defaults.</p>
20
21 <p>In other words, expands to the sequence:</p>
22
23 <pre>
24 BOOST_PP_CAT(PARAM,0) = BOOST_PP_CAT(DEFAULT,0),
25 BOOST_PP_CAT(PARAM,1) = BOOST_PP_CAT(DEFAULT,1),
26 ...,
27 BOOST_PP_CAT(PARAM,BOOST_PP_DEC(COUNT)) = BOOST_PP_CAT(DEFAULT,BOOST_PP_DEC(COUNT))
28 </pre>
29
30 <p>For example,</p>
31
32 <pre>
33 BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS(3,x,y)
34 </pre>
35
36 <p>expands to:</p>
37
38 <pre>
39 x0 = y0, x1 = y1, x2 = y2
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_PARAMS_WITH_DEFAULTS(COUNT,PARAM,DEFAULT) BOOST_PP_ENUM(COUNT,BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS_F,(PARAM,DEFAULT))
53
54 #define BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS_F(I,PD) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,PD),I)=BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,PD),I)
55 #endif