list_at_d.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <html>
  2. <head>
  3. <title>BOOST_PP_LIST_AT_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_LIST_AT_D</b> macro extracts an element in a <i>list</i>.&nbsp;
  9. It reenters <b>BOOST_PP_WHILE</b> with maximum efficiency.
  10. </div>
  11. <h4>Usage</h4>
  12. <div class="code">
  13. <b>BOOST_PP_LIST_AT_D</b>(<i>d</i>, <i>list</i>, <i>index</i>)
  14. </div>
  15. <h4>Arguments</h4>
  16. <dl>
  17. <dt>d</dt>
  18. <dd>
  19. The next available <b>BOOST_PP_WHILE</b> iteration.
  20. </dd>
  21. <dt>list</dt>
  22. <dd>
  23. The <i>list</i> from which a element is to be extracted.&nbsp;
  24. This <i>list</i> must have at least <i>index</i> + <i>1</i> elements.
  25. </dd>
  26. <dt>index</dt>
  27. <dd>
  28. The zero-based position in the <i>list</i> of the element to be extracted.
  29. </dd>
  30. </dl>
  31. <h4>See Also</h4>
  32. <ul>
  33. <li><a href="list_at.html">BOOST_PP_LIST_AT</a></li>
  34. </ul>
  35. <h4>Requirements</h4>
  36. <div>
  37. <b>Header:</b> &nbsp;<a href="../headers/list/at.html">&lt;boost/preprocessor/list/at.hpp&gt;</a>
  38. </div>
  39. <h4>Sample Code</h4>
  40. <div><pre>
  41. #include &lt;<a href="../headers/control/while.html">boost/preprocessor/control/while.hpp</a>&gt;
  42. #include &lt;<a href="../headers/list/at.html">boost/preprocessor/list/at.hpp</a>&gt;
  43. #define LIST (7, (2, (0, (1, <a href="nil.html">BOOST_PP_NIL</a>))))
  44. #define PRED(d, state) <a href="list_at_d.html">BOOST_PP_LIST_AT_D</a>(d, state, 0)
  45. #define OP(d, state) <a href="list_rest.html">BOOST_PP_LIST_REST</a>(state)
  46. <a href="while.html">BOOST_PP_WHILE</a>(PRED, OP, LIST) // expands to (0, (1, <a href="nil.html">BOOST_PP_NIL</a>))
  47. </pre></div>
  48. <hr size="1">
  49. <div style="margin-left: 0px;">
  50. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  51. </br><i>© Copyright Paul Mensonides 2002</i>
  52. </div>
  53. <div style="margin-left: 0px;">
  54. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  55. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  56. copy at <a href=
  57. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  58. </div>
  59. </body>
  60. </html>