1<html> 2<head> 3 <title>BOOST_PP_DEDUCE_D</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_DEDUCE_D</b> macro manually deduces the state of the <b>BOOST_PP_WHILE</b> construct. 9 </div> 10 <h4>Usage</h4> 11 <div class="code"> 12 <b>BOOST_PP_DEDUCE_D</b>() 13 </div> 14 <h4>Remarks</h4> 15 <div> 16 This macro is intended to avoid the use of <i>automatic-recursion</i> at deep expansion depths. 17 <i>Automatic-recursion</i> at such depths can be inefficient on some preprocessors. 18 It is not intended to be used directly with the invocation of macros with a <b>_D</b> suffix such as: 19 <div> 20 <b>BOOST_PP_ADD_D</b>(<b>BOOST_PP_DEDUCE_D</b>(), <i>x</i>, <i>y</i>) 21 </div> 22 If it is used in this context, the <b>_D</b> macro will fail. 23 The <b>_D</b> macros directly concatenate to the <i>d</i> parameter that is passed to them, 24 which would prevent <b>BOOST_PP_DEDUCE_D</b>() from expanding. 25 Furthermore, it is pointless to use this macro in a situation such as this 26 because it would already be too late to gain any efficiency. 27 </div> 28 <h4>See Also</h4> 29 <ul> 30 <li><a href="while.html">BOOST_PP_WHILE</a></li> 31 </ul> 32 <h4>Requirements</h4> 33 <div> 34 <b>Header:</b> <a href="../headers/control/deduce_d.html"><boost/preprocessor/control/deduce_d.hpp></a> 35 </div> 36 <h4>Sample Code</h4> 37<div><pre> 38#include <<a href="../headers/arithmetic/add.html">boost/preprocessor/arithmetic/add.hpp</a>> 39#include <<a href="../headers/arithmetic/inc.html">boost/preprocessor/arithmetic/inc.hpp</a>> 40#include <<a href="../headers/arithmetic/sub.html">boost/preprocessor/arithmetic/sub.hpp</a>> 41#include <<a href="../headers/control/deduce_d.html">boost/preprocessor/control/deduce_d.hpp</a>> 42#include <<a href="../headers/punctuation/comma_if.html">boost/preprocessor/punctuation/comma_if.hpp</a>> 43#include <<a href="../headers/repetition/repeat.html">boost/preprocessor/repetition/repeat.hpp</a>> 44#include <<a href="../headers/tuple/elem.html">boost/preprocessor/tuple/elem.hpp</a>> 45 46#define RANGE(first, last) \ 47 <a href="repeat.html">BOOST_PP_REPEAT</a>( \ 48 <a href="inc.html">BOOST_PP_INC</a>( \ 49 <a href="sub.html">BOOST_PP_SUB</a>(last, first) \ 50 ), \ 51 RANGE_M, \ 52 (first, <a href="deduce_d.html">BOOST_PP_DEDUCE_D</a>()) \ 53 ) \ 54 /**/ 55 56#define RANGE_M(z, n, data) \ 57 RANGE_M_2( \ 58 n, \ 59 <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, 0, data), \ 60 <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, 1, data) \ 61 ) \ 62 /**/ 63 64#define RANGE_M_2(n, first, d) \ 65 <a href="comma_if.html">BOOST_PP_COMMA_IF</a>(n) <a href="add_d.html">BOOST_PP_ADD_D</a>(d, n, first) \ 66 /**/ 67 68RANGE(5, 10) // expands to 5, 6, 7, 8, 9, 10 69</pre></div> 70 <hr size="1"> 71 <div style="margin-left: 0px;"> 72 <i>� Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i> 73 </br><i>� Copyright Paul Mensonides 2002</i> 74 </div> 75 <div style="margin-left: 0px;"> 76 <p><small>Distributed under the Boost Software License, Version 1.0. (See 77 accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or 78 copy at <a href= 79 "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p> 80 </div> 81</body> 82</html> 83