Brian Silverman | f27e085 | 2018-08-04 23:56:45 -0700 | [diff] [blame^] | 1 | <html> |
| 2 | <head> |
| 3 | <title>BOOST_PP_LIST_CONS</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_CONS</b> macro is a <i>list</i> constructor. |
| 9 | </div> |
| 10 | <h4>Usage</h4> |
| 11 | <div class="code"> |
| 12 | <b>BOOST_PP_LIST_CONS</b>(<i>head</i>, <i>tail</i>) |
| 13 | </div> |
| 14 | <h4>Arguments</h4> |
| 15 | <dl> |
| 16 | <dt>head</dt> |
| 17 | <dd> |
| 18 | An element in a <i>list</i>. |
| 19 | </dd> |
| 20 | <dt>tail</dt> |
| 21 | <dd> |
| 22 | Either a <i>list</i>, <b>BOOST_PP_LIST_NIL</b>, or <b>BOOST_PP_NIL</b>. |
| 23 | </dd> |
| 24 | </dl> |
| 25 | <h4>Remarks</h4> |
| 26 | <div> |
| 27 | This macro appends a new head to an existing <i>list</i> or creates a <i>list</i> from <b>BOOST_PP_LIST_NIL</b>. |
| 28 | </div> |
| 29 | <div> |
| 30 | This macro is no longer necessary. |
| 31 | For example... |
| 32 | <div> |
| 33 | <b>BOOST_PP_LIST_CONS</b>(a, <b>BOOST_PP_LIST_CONS</b>(b, <b>BOOST_PP_LIST_NIL</b>))) |
| 34 | </div> |
| 35 | ...is just an explicit way of writing the following: |
| 36 | <div> |
| 37 | (a, (b, <b>BOOST_PP_NIL</b>)) |
| 38 | </div> |
| 39 | Because of this, this macro is deprecated. |
| 40 | </div> |
| 41 | <h4>See Also</h4> |
| 42 | <ul> |
| 43 | <li><a href="list_nil.html">BOOST_PP_LIST_NIL</a></li> |
| 44 | <li><a href="nil.html">BOOST_PP_NIL</a></li> |
| 45 | </ul> |
| 46 | <h4>Requirements</h4> |
| 47 | <div> |
| 48 | <b>Header:</b> <a href="../headers/list/adt.html"><boost/preprocessor/list/adt.hpp></a> |
| 49 | </div> |
| 50 | <h4>Sample Code</h4> |
| 51 | <div><pre> |
| 52 | #include <<a href="../headers/list/adt.html">boost/preprocessor/list/adt.hpp</a>> |
| 53 | |
| 54 | #define OLD \ |
| 55 | <a href="list_cons.html">BOOST_PP_LIST_CONS</a>( \ |
| 56 | a, \ |
| 57 | <a href="list_cons.html">BOOST_PP_LIST_CONS</a>( \ |
| 58 | b, \ |
| 59 | <a href="list_cons.html">BOOST_PP_LIST_CONS</a>( \ |
| 60 | c, \ |
| 61 | <a href="list_nil.html">BOOST_PP_LIST_NIL</a> \ |
| 62 | ) \ |
| 63 | ) \ |
| 64 | ) \ |
| 65 | /**/ |
| 66 | |
| 67 | #define NEW (a, (b, (c, <a href="nil.html">BOOST_PP_NIL</a>))) |
| 68 | |
| 69 | <a href="list_first.html">BOOST_PP_LIST_FIRST</a>(OLD) == <a href="list_first.html">BOOST_PP_LIST_FIRST</a>(NEW) |
| 70 | // expands to a == a |
| 71 | |
| 72 | <a href="list_rest.html">BOOST_PP_LIST_REST</a>(OLD) == <a href="list_rest.html">BOOST_PP_LIST_REST</a>(NEW) |
| 73 | // expands to (b, (c, <a href="nil.html">BOOST_PP_NIL</a>)) == (b, (c, <a href="nil.html">BOOST_PP_NIL</a>)) |
| 74 | </pre></div> |
| 75 | <hr size="1"> |
| 76 | <div style="margin-left: 0px;"> |
| 77 | <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i> |
| 78 | </br><i>© Copyright Paul Mensonides 2002</i> |
| 79 | </div> |
| 80 | <div style="margin-left: 0px;"> |
| 81 | <p><small>Distributed under the Boost Software License, Version 1.0. (See |
| 82 | accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or |
| 83 | copy at <a href= |
| 84 | "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p> |
| 85 | </div> |
| 86 | </body> |
| 87 | </html> |