list_first_n.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <html>
  2. <head>
  3. <title>BOOST_PP_LIST_FIRST_N</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_FIRST_N</b> macro expands to a <i>list</i> of the first <i>count</i> elements of a <i>list</i>.
  9. </div>
  10. <h4>Usage</h4>
  11. <div class="code">
  12. <b>BOOST_PP_LIST_FIRST_N</b>(<i>count</i>, <i>list</i>)
  13. </div>
  14. <h4>Arguments</h4>
  15. <dl>
  16. <dt>count</dt>
  17. <dd>
  18. The number of elements to extract.
  19. </dd>
  20. <dt>list</dt>
  21. <dd>
  22. The <i>list</i> from which the elements are extracted.
  23. </dd>
  24. </dl>
  25. <h4>Remarks</h4>
  26. <div>
  27. This macro extracts <i>count</i> elements from the beginning of <i>list</i> and returns them as a <i>list</i>
  28. </div>
  29. <div>
  30. Previously, this macro could not be used inside <b>BOOST_PP_WHILE</b>.&nbsp;
  31. There is no longer any such restriction.&nbsp;
  32. It is more efficient, however, to use <b>BOOST_PP_LIST_FIRST_N_D</b> in such a situation.
  33. </div>
  34. <h4>See Also</h4>
  35. <ul>
  36. <li><a href="list_first_n_d.html">BOOST_PP_LIST_FIRST_N_D</a></li>
  37. </ul>
  38. <h4>Requirements</h4>
  39. <div>
  40. <b>Header:</b> &nbsp;<a href="../headers/list/first_n.html">&lt;boost/preprocessor/list/first_n.hpp&gt;</a>
  41. </div>
  42. <h4>Sample Code</h4>
  43. <div><pre>
  44. #include &lt;<a href="../headers/list/first_n.html">boost/preprocessor/list/first_n.hpp</a>&gt;
  45. #define LIST (a, (b, (c, <a href="nil.html">BOOST_PP_NIL</a>)))
  46. <a href="list_first_n.html">BOOST_PP_LIST_FIRST_N</a>(2, LIST) // expands to (a, (b, <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>