list_append_d.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <html>
  2. <head>
  3. <title>BOOST_PP_LIST_APPEND_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_APPEND_D</b> macro appends two <i>lists</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_APPEND_D</b>(<i>d</i>, <i>a</i>, <i>b</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>a</dt>
  22. <dd>
  23. The first <i>list</i>.
  24. </dd>
  25. <dt>b</dt>
  26. <dd>
  27. The second <i>list</i>.
  28. </dd>
  29. </dl>
  30. <h4>Remarks</h4>
  31. <div>
  32. This macro appends two lists.&nbsp;
  33. For example, if <i>a</i> is (<i>1</i>, (<i>2</i>, (<i>3</i>, <b>BOOST_PP_NIL</b>))) and <i>b</i> is (<i>4</i>, (<i>5</i>, <b>BOOST_PP_NIL</b>)),
  34. this macro will expand to:
  35. <div>
  36. (<i>1</i>, (<i>2</i>, (<i>3</i>, (<i>4</i>, (<i>5</i>, <b>BOOST_PP_NIL</b>)))))
  37. </div>
  38. </div>
  39. <h4>See Also</h4>
  40. <ul>
  41. <li><a href="list_append.html">BOOST_PP_LIST_APPEND</a></li>
  42. </ul>
  43. <h4>Requirements</h4>
  44. <div>
  45. <b>Header:</b> &nbsp;<a href="../headers/list/append.html">&lt;boost/preprocessor/list/append.hpp&gt;</a>
  46. </div>
  47. <h4>Sample Code</h4>
  48. <div><pre>
  49. #include &lt;<a href="../headers/arithmetic/dec.html">boost/preprocessor/arithmetic/dec.hpp</a>&gt;
  50. #include &lt;<a href="../headers/control/while.html">boost/preprocessor/control/while.hpp</a>&gt;
  51. #include &lt;<a href="../headers/list/append.html">boost/preprocessor/list/append.hpp</a>&gt;
  52. #include &lt;<a href="../headers/tuple/elem.html">boost/preprocessor/tuple/elem.hpp</a>&gt;
  53. #define LIST (1, (2, (3, <a href="nil.html">BOOST_PP_NIL</a>)))
  54. #define PRED(d, state) <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(3, 1, state)
  55. #define OP(d, state) \
  56. ( \
  57. <a href="list_append_d.html">BOOST_PP_LIST_APPEND_D</a>( \
  58. d, <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(3, 0, state), \
  59. <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(3, 2, state) \
  60. ), \
  61. <a href="dec.html">BOOST_PP_DEC</a>( \
  62. <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(3, 1, state) \
  63. ), \
  64. <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(3, 2, state) \
  65. ) \
  66. /**/
  67. #define LIST_MULTIPLY(c, list) \
  68. <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>( \
  69. 3, 0, \
  70. <a href="while.html">BOOST_PP_WHILE</a>( \
  71. PRED, OP, \
  72. (<a href="nil.html">BOOST_PP_NIL</a>, c, list) \
  73. ) \
  74. ) \
  75. /**/
  76. LIST_MULTIPLY(3, LIST)
  77. // expands to (1, (2, (3, (1, (2, (3, (1, (2, (3, <a href="nil.html">BOOST_PP_NIL</a>)))))))))
  78. </pre></div>
  79. <hr size="1">
  80. <div style="margin-left: 0px;">
  81. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  82. </br><i>© Copyright Paul Mensonides 2002</i>
  83. </div>
  84. <div style="margin-left: 0px;">
  85. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  86. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  87. copy at <a href=
  88. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  89. </div>
  90. </body>
  91. </html>