Brian Silverman | f27e085 | 2018-08-04 23:56:45 -0700 | [diff] [blame^] | 1 | <html> |
| 2 | <head> |
| 3 | <title>BOOST_PP_EXPR_IIF</title> |
| 4 | <link rel="stylesheet" type="text/css" href="../styles.css"> |
| 5 | </head> |
| 6 | <body> |
| 7 | <div style="margin-left: 0px;"> |
| 8 | The <b>BOOST_PP_EXPR_IIF</b> macro expands to its second argument if its first argument is <i>1</i> and expands to nothing if its first argument is <i>0</i>. |
| 9 | </div> |
| 10 | <h4>Usage</h4> |
| 11 | <div class="code"> |
| 12 | <b>BOOST_PP_EXPR_IIF</b>(<i>bit</i>, <i>expr</i>) |
| 13 | </div> |
| 14 | <h4>Arguments</h4> |
| 15 | <dl> |
| 16 | <dt>bit</dt> |
| 17 | <dd> |
| 18 | The condition that determines if the result is <i>expr</i> or nothing. |
| 19 | This value must expand to <i>0</i> or </i>1</i>. |
| 20 | </dd> |
| 21 | <dt>expr</dt> |
| 22 | <dd> |
| 23 | The result of the expansion if <i>bit</i> is <i>1</i>. |
| 24 | </dd> |
| 25 | </dl> |
| 26 | <h4>Remarks</h4> |
| 27 | <div> |
| 28 | This macro <i>does not</i> perform a boolean conversion on its first argument. |
| 29 | If that conversion is necessary, use <b>BOOST_PP_EXPR_IF</b> instead. |
| 30 | </div> |
| 31 | <h4>See Also</h4> |
| 32 | <ul> |
| 33 | <li><a href="expr_if.html">BOOST_PP_EXPR_IF</a></li> |
| 34 | <li><a href="limit_mag.html">BOOST_PP_LIMIT_MAG</a></li> |
| 35 | </ul> |
| 36 | <h4>Requirements</h4> |
| 37 | <div> |
| 38 | <b>Header:</b> <a href="../headers/control/expr_iif.html"><boost/preprocessor/control/expr_iif.hpp></a> |
| 39 | </div> |
| 40 | <h4>Sample Code</h4> |
| 41 | <div><pre> |
| 42 | #include <<a href="../headers/logical/and.html">boost/preprocessor/logical/and.hpp</a>> |
| 43 | #include <<a href="../headers/control/expr_iif.html">boost/preprocessor/control/expr_iif.hpp</a>> |
| 44 | |
| 45 | #define INSERT_AND(p, q, text) \ |
| 46 | <a href="expr_iif.html">BOOST_PP_EXPR_IIF</a>( \ |
| 47 | <a href="and.html">BOOST_PP_AND</a>(p, q), \ |
| 48 | text \ |
| 49 | ) \ |
| 50 | /**/ |
| 51 | |
| 52 | INSERT_AND(2, 3, abc) // expands to abc |
| 53 | INSERT_AND(0, 7, xyz) // expands to nothing |
| 54 | </pre></div> |
| 55 | <hr size="1"> |
| 56 | <div style="margin-left: 0px;"> |
| 57 | <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i> |
| 58 | </br><i>© Copyright Paul Mensonides 2002</i> |
| 59 | </div> |
| 60 | <div style="margin-left: 0px;"> |
| 61 | <p><small>Distributed under the Boost Software License, Version 1.0. (See |
| 62 | accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or |
| 63 | copy at <a href= |
| 64 | "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p> |
| 65 | </div> |
| 66 | </body> |
| 67 | </html> |