preprocessor/doc/ref/identity_n.html
2018-01-11 14:20:16 +00:00

59 lines
1.8 KiB
HTML

<html>
<head>
<title>BOOST_PP_IDENTITY_N</title>
<link rel="stylesheet" type="text/css" href="../styles.css">
</head>
<body>
<div style="margin-left: 0px;">
The <b>BOOST_PP_IDENTITY_N</b> macro expands to its first argument when invoked.
</div>
<h4>Usage</h4>
<div class="code">
<b>BOOST_PP_IDENTITY_N</b>(<i>item,n</i>)(n-arguments)
</div>
<h4>Arguments</h4>
<dl>
<dt>item</dt>
<dd>
The result of the expansion.
</dd>
<dt>n</dt>
<dd>
The number of arguments when invoked.
</dd>
</dl>
<h4>Remarks</h4>
<div>
This macro is designed to be used with <b>BOOST_PP_IF</b> and <b>BOOST_PP_IIF</b> when only one of the clauses needs to be invoked.
</div>
<h4>See Also</h4>
<ul>
<li><a href="if.html">BOOST_PP_IF</a></li>
<li><a href="iif.html">BOOST_PP_IIF</a></li>
</ul>
<h4>Requirements</h4>
<div>
<b>Header:</b> &nbsp;<a href="../headers/facilities/identity.html">&lt;boost/preprocessor/facilities/identity.hpp&gt;</a>
</div>
<h4>Sample Code</h4>
<div><pre>
#include &lt;<a href="../headers/control/if.html">boost/preprocessor/control/if.hpp</a>&gt;
#include &lt;<a href="../headers/facilities/identity.html">boost/preprocessor/facilities/identity.hpp</a>&gt;
#define MACRO_CAT(y,z) y ## z
#define MACRO(n) <a href="if.html">BOOST_PP_IF</a>(n, <a href="identity_n.html">BOOST_PP_IDENTITY_N</a>(x,2), MACRO_CAT)(a,b)
MACRO(0) // expands to ab
MACRO(1) // expands to x
</pre></div>
<hr size="1">
<div style="margin-left: 0px"><i>&copy; Copyright Edward Diener 2015</i></div>
<div style="margin-left: 0px;">
<p><small>Distributed under the Boost Software License, Version 1.0. (See
accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
</div>
</body>
</html>