]> git.lyx.org Git - lyx.git/blob - boost/boost/preprocessor/if.hpp
0ade0993f128012f1c5d0de7a0ca1d922845dc78
[lyx.git] / boost / boost / preprocessor / if.hpp
1 #ifndef BOOST_PREPROCESSOR_IF_HPP
2 #define BOOST_PREPROCESSOR_IF_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/logical/bool.hpp>
17
18 /** <p>Expands to <code>THEN</code> if <code>COND != 0</code> and <code>ELSE</code> if
19 <code>COND == 0</code>.</p>
20
21 <p><code>COND</code> must expand to an integer literal in the range [0, BOOST_PP_LIMIT_MAG].</p>
22
23 <p>For example, <code>BOOST_PP_IF(0,1,2)</code> expands to <code>2</code>.</p>
24
25 <h3>See</h3>
26 <ul>
27   <li>BOOST_PP_EXPR_IF()</li>
28 </ul>
29
30 <h3>Test</h3>
31 <ul>
32   <li><a href="../../test/preprocessor_test.cpp">preprocessor_test.cpp</a></li>
33 </ul>
34 */
35 #define BOOST_PP_IF(COND,THEN,ELSE) BOOST_PP_IF_BOOL(BOOST_PP_BOOL(COND),ELSE,THEN)
36
37 #define BOOST_PP_IF_BOOL(C,E,T) BOOST_PP_IF_BOOL_DELAY(C,E,T)
38 #define BOOST_PP_IF_BOOL_DELAY(C,E,T) BOOST_PP_IF##C(E,T)
39
40 #define BOOST_PP_IF0(E,T) E
41 #define BOOST_PP_IF1(E,T) T
42 #endif