• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3	<title>BOOST_PP_APPLY</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_APPLY</b> macro abstracts the difference between an argument and nothing.
9	</div>
10	<h4>Usage</h4>
11		<div class="code">
12			<b>BOOST_PP_APPLY</b>(<i>x</i>)
13		</div>
14	<h4>Arguments</h4>
15		<dl>
16			<dt>x</dt>
17			<dd>
18				The abstracted argument.&nbsp;
19				This argument must be either <b>BOOST_PP_NIL</b> or a <i>tuple</i> with one element--such as <i>(arg)</i> or <i>((a, b))</i>.
20			</dd>
21		</dl>
22	<h4>Remarks</h4>
23		<div>
24			If <i>x</i> is <b>BOOST_PP_NIL</b>, this macro expands to nothing.&nbsp;
25			If <i>x</i> is a one element <i>tuple</i>, it expands to the contents of that <i>tuple</i>.
26		</div>
27	<h4>See Also</h4>
28		<ul>
29			<li><a href="nil.html">BOOST_PP_NIL</a></li>
30		</ul>
31	<h4>Requirements</h4>
32		<div>
33			<b>Header:</b> &nbsp;<a href="../headers/facilities/apply.html">&lt;boost/preprocessor/facilities/apply.hpp&gt;</a>
34		</div>
35	<h4>Sample Code</h4>
36<div><pre>
37#include &lt;<a href="../headers/facilities/apply.html">boost/preprocessor/facilities/apply.hpp</a>&gt;
38#include &lt;<a href="../headers/tuple/elem.html">boost/preprocessor/tuple/elem.hpp</a>&gt;
39
40#define CV(i) \
41   <a href="apply.html">BOOST_PP_APPLY</a>( \
42      <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>( \
43         4, i, \
44         (<a href="nil.html">BOOST_PP_NIL</a>, (const), (volatile), (const volatile)) \
45      ) \
46   ) \
47   /**/
48
49CV(0) // expands to nothing
50CV(1) // expands to const
51</pre></div>
52	<hr size="1">
53	<div style="margin-left: 0px;">
54		<i>� Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
55		</br><i>� Copyright Paul Mensonides 2002</i>
56	</div>
57	<div style="margin-left: 0px;">
58		<p><small>Distributed under the Boost Software License, Version 1.0. (See
59		accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
60		copy at <a href=
61		"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
62	</div>
63</body>
64</html>
65