1 #ifndef BOOST_PREPROCESSOR_IF_HPP
2 #define BOOST_PREPROCESSOR_IF_HPP
6 * http://www.housemarque.com
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.
13 * See http://www.boost.org for most recent version.
16 #include <boost/preprocessor/detail/cat.hpp>
17 #include <boost/preprocessor/logical/bool.hpp>
19 /** <p>Expands to <code>THEN</code> if <code>COND != 0</code> and <code>ELSE</code> if
20 <code>COND == 0</code>.</p>
22 <p><code>COND</code> must expand to an integer literal in the range [0, BOOST_PP_LIMIT_MAG].</p>
24 <p>For example, <code>BOOST_PP_IF(0,1,2)</code> expands to <code>2</code>.</p>
28 <li>BOOST_PP_EXPR_IF()</li>
33 <li><a href="../../test/preprocessor_test.cpp">preprocessor_test.cpp</a></li>
36 #define BOOST_PP_IF(COND,THEN,ELSE) BOOST_PP_DETAIL_CAT2(BOOST_PP_IF,BOOST_PP_BOOL(COND))(ELSE,THEN)
37 #define BOOST_PP_IF0(E,T) E
38 #define BOOST_PP_IF1(E,T) T