File: list_adt.htm

package info (click to toggle)
boost 1.27.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 19,908 kB
  • ctags: 26,546
  • sloc: cpp: 122,225; ansic: 10,956; python: 4,412; sh: 855; yacc: 803; makefile: 257; perl: 165; lex: 90; csh: 6
file content (120 lines) | stat: -rw-r--r-- 4,259 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Boost.Preprocessor - Reference</title>
</head>
<body bgcolor="#FFFFFF" link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
    "header">
  <tr> 
    <td valign="top" width="300"> 
      <h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
    </td>
    <td valign="top"> 
      <h1 align="center">Boost.Preprocessor</h1>
      <h2 align="center">Reference</h2>
    </td>
  </tr>
</table>

<hr>

<a href="list.htm">Prev</a> <a href="list_append.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>

<h1>#include &lt;<a href="../../../../boost/preprocessor/list/adt.hpp">boost/preprocessor/list/adt.hpp</a>&gt;</h1>
 <p>This header defines the fundamental list operations.</p>

<h3>Note</h3>
<ul>
  <li>The internal representation of lists is hidden. Although there aren't
      compelling reasons to change the representation, you should avoid
      writing code that depends on the internal representation details.</li>
</ul>

<hr>

<h2><a name="BOOST_PP_LIST_CONS">#define BOOST_PP_LIST_CONS</a>(H,T)</h2>
 <p>List constructor.</p>

<p>Lists are build using list constructors <a href="list_adt.htm#BOOST_PP_LIST_NIL">BOOST_PP_LIST_NIL</a> and
<a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(). For example,</p>

<pre>
  <a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(1,
  <a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(2,
  <a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(3,
  <a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(4,
  <a href="list_adt.htm#BOOST_PP_LIST_CONS">BOOST_PP_LIST_CONS</a>(5,
  <a href="list_adt.htm#BOOST_PP_LIST_NIL">BOOST_PP_LIST_NIL</a>)))))
</pre>

<p>Short lists can also be build from tuples:</p>

<pre>
  <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(5,(1,2,3,4,5))
</pre>

<p>Both of the above lists contain 5 elements: 1, 2, 3, 4 and 5.</p>

<p>Longer lists can be built with the help of <a href="list_append.htm#BOOST_PP_LIST_APPEND">BOOST_PP_LIST_APPEND</a>().</p>

<hr>

<h2><a name="BOOST_PP_LIST_NIL">#define BOOST_PP_LIST_NIL</a></h2>
 <p>List nil constructor.</p> 
<hr>

<h2><a name="BOOST_PP_LIST_IS_CONS">#define BOOST_PP_LIST_IS_CONS</a>(L)</h2>
 <p>Expands to 1 if the list is not nil and 0 otherwise.</p> 
<hr>

<h2><a name="BOOST_PP_LIST_IS_NIL">#define BOOST_PP_LIST_IS_NIL</a>(L)</h2>
 <p>Expands to 1 if the list is nil and 0 otherwise.</p> 
<hr>

<h2><a name="BOOST_PP_LIST_FIRST">#define BOOST_PP_LIST_FIRST</a>(L)</h2>
 <p>Expands to the first element of the list. The list must not be nil.</p>

<p>For example,</p>

<pre>
  <a href="list_adt.htm#BOOST_PP_LIST_FIRST">BOOST_PP_LIST_FIRST</a>(<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(5,(1,2,3,4,5)))
</pre>

<p>expands to 1.</p>

<hr>

<h2><a name="BOOST_PP_LIST_REST">#define BOOST_PP_LIST_REST</a>(L)</h2>
 <p>Expands to a list of all but the first element of the list.</p>

<p>The list must not be nil.</p>

<p>For example,</p>

<pre>
  <a href="list_adt.htm#BOOST_PP_LIST_REST">BOOST_PP_LIST_REST</a>(<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(5,(1,2,3,4,5)))
</pre>

<p>expands to the same as:</p>

<pre>
  <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(4,(2,3,4,5))
</pre>

<hr>

<a href="list.htm">Prev</a> <a href="list_append.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
<hr>

<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>

<p><i>&copy; Copyright <a href="http://www.housemarque.com">Housemarque Oy</a> 2002</i></p>

<p><i>Permission to copy, use, modify, sell and distribute this document is granted
provided this copyright notice appears in all copies. This document is provided
"as is" without express or implied warranty, and with no claim as to its suitability
for any purpose.</i></p>

</body></html>