mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-23 09:07:13 +02:00
lib cleanup
[SVN r15693]
This commit is contained in:
71
doc/ref/deduce_d.html
Normal file
71
doc/ref/deduce_d.html
Normal file
@ -0,0 +1,71 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>BOOST_PP_DEDUCE_D</title>
|
||||
<link rel="stylesheet" type="text/css" href="../styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin-left: 0px;">
|
||||
The <b>BOOST_PP_DEDUCE_D</b> macro manually deduces the state of the <b>BOOST_PP_WHILE</b> construct.
|
||||
</div>
|
||||
<h4>Usage</h4>
|
||||
<div class="code">
|
||||
<b>BOOST_PP_DEDUCE_D</b>()
|
||||
</div>
|
||||
<h4>Remarks</h4>
|
||||
<div>
|
||||
This macro is intended to avoid the use of <i>automatic-recursion</i> at deep expansion depths.
|
||||
<i>Automatic-recursion</i> at such depths can be inefficient on some preprocessors.
|
||||
It is not intended to be used directly with the invocation of macros with a <b>_D</b> suffix such as:
|
||||
<div>
|
||||
<b>BOOST_PP_ADD_D</b>(<b>BOOST_PP_DEDUCE_D</b>(), <i>x</i>, <i>y</i>)
|
||||
</div>
|
||||
If it is used in this context, the <b>_D</b> macro will fail.
|
||||
The <b>_D</b> macros directly concatenate to the <i>d</i> parameter that is passed to them,
|
||||
which would prevent <b>BOOST_PP_DEDUCE_D</b>() from expanding.
|
||||
Furthermore, it is pointless to use this macro in a situation such as this
|
||||
because it would already be too late to gain any efficiency.
|
||||
</div>
|
||||
<h4>See Also</h4>
|
||||
<ul>
|
||||
<li><a href="while.html">BOOST_PP_WHILE</a></li>
|
||||
</ul>
|
||||
<h4>Requirements</h4>
|
||||
<div>
|
||||
<b>Header:</b> <a href="../headers/control/deduce_d.hpp.html"><boost/preprocessor/control/deduce_d.hpp></a>
|
||||
</div>
|
||||
<h4>Sample Code</h4>
|
||||
<div><pre>
|
||||
#include <<a href="../headers/arithmetic/add.hpp.html">boost/preprocessor/arithmetic/add.hpp</a>>
|
||||
#include <<a href="../headers/arithmetic/inc.hpp.html">boost/preprocessor/arithmetic/inc.hpp</a>>
|
||||
#include <<a href="../headers/arithmetic/sub.hpp.html">boost/preprocessor/arithmetic/sub.hpp</a>>
|
||||
#include <<a href="../headers/control/deduce_d.hpp.html">boost/preprocessor/control/deduce_d.hpp</a>>
|
||||
#include <<a href="../headers/punctuation/comma_if.hpp.html">boost/preprocessor/punctuation/comma_if.hpp</a>>
|
||||
#include <<a href="../headers/repetition/repeat.hpp.html">boost/preprocessor/repetition/repeat.hpp</a>>
|
||||
#include <<a href="../headers/tuple/elem.hpp.html">boost/preprocessor/tuple/elem.hpp</a>>
|
||||
|
||||
#define RANGE(first, last) \
|
||||
<a href="repeat.html">BOOST_PP_REPEAT</a>( \
|
||||
<a href="inc.html">BOOST_PP_INC</a>( \
|
||||
<a href="sub.html">BOOST_PP_SUB</a>(last, first) \
|
||||
, \
|
||||
RANGE_M, \
|
||||
(first, <a href="deduce_d.html">BOOST_PP_DEDUCE_D</a>()) \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#define RANGE_M(z, n, data) \
|
||||
RANGE_M_2( \
|
||||
n, \
|
||||
<a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, 0, data), \
|
||||
<a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, 1, data) \
|
||||
) \
|
||||
/**/
|
||||
|
||||
#define RANGE_M_2(n, first, d) \
|
||||
<a href="comma_if.html">BOOST_PP_COMMA_IF</a>(n) <a href="add_d.html">BOOST_PP_ADD_D</a>(d, n, first) \
|
||||
/**/
|
||||
|
||||
RANGE(5, 10) // expands to 5, 6, 7, 8, 9, 10
|
||||
</pre></div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user