Line | |
---|
1 | <html> |
---|
2 | <head> |
---|
3 | <title>arrays.html</title> |
---|
4 | <link rel="stylesheet" type="text/css" href="../styles.css"> |
---|
5 | </head> |
---|
6 | <body> |
---|
7 | <h4>Arrays</h4> |
---|
8 | <div> |
---|
9 | An <i>array</i> is a data structure consisting of a two-element <i>tuple</i>. |
---|
10 | The first element is the number of elements in the <i>array</i>. |
---|
11 | The second element is another <i>tuple</i> of the elements in the <i>array</i>. |
---|
12 | For example, |
---|
13 | </div> |
---|
14 | <div class="code"> |
---|
15 | (<i>3</i>, (<i>a</i>, <i>b</i>, <i>c</i>)) |
---|
16 | </div> |
---|
17 | <div> |
---|
18 | ...is an <i>array</i> of <i>3</i> elements--<i>a</i>, <i>b</i>, and <i>c</i>. |
---|
19 | </div> |
---|
20 | <div> |
---|
21 | The primary strength of <i>arrays</i> is that they store their own size. |
---|
22 | Because of this, access to elements does not require the size. |
---|
23 | It only requires that an element exists at a certain index. |
---|
24 | </div> |
---|
25 | <div> |
---|
26 | This allows macro parameters to be variable in size and allows data states to change |
---|
27 | size without the user explicitly keeping track of the size independently. |
---|
28 | </div> |
---|
29 | <div> |
---|
30 | Elements of an <i>array</i> can be extracted with <b>BOOST_PP_ARRAY_ELEM</b>, |
---|
31 | an <i>array's</i> size can be extracted with <b>BOOST_PP_ARRAY_SIZE</b>, and |
---|
32 | an <i>array</i> can be converted to the more primitive <i>tuple</i> data structure |
---|
33 | with <b>BOOST_PP_ARRAY_DATA</b>. |
---|
34 | </div> |
---|
35 | <h4>Primitives</h4> |
---|
36 | <ul> |
---|
37 | <li><a href="../ref/array_data.html">BOOST_PP_ARRAY_DATA</a></li> |
---|
38 | <li><a href="../ref/array_elem.html">BOOST_PP_ARRAY_ELEM</a></li> |
---|
39 | <li><a href="../ref/array_size.html">BOOST_PP_ARRAY_SIZE</a></li> |
---|
40 | </ul> |
---|
41 | </body> |
---|
42 | </html> |
---|
Note: See
TracBrowser
for help on using the repository browser.