Added information about empty data.

This commit is contained in:
Edward Diener
2015-05-17 00:46:10 -04:00
parent 4360660e39
commit 633f1e679a
4 changed files with 101 additions and 105 deletions

View File

@ -1,5 +1,6 @@
<html> <html>
<head> <head>
<meta content="text/html; charset=windows-1252" http-equiv="content-type">
<title>arrays.html</title> <title>arrays.html</title>
<link rel="stylesheet" type="text/css" href="../styles.css"> <link rel="stylesheet" type="text/css" href="../styles.css">
</head> </head>
@ -17,12 +18,19 @@
size.&nbsp; It only requires that an element exists at a certain index. </div> size.&nbsp; It only requires that an element exists at a certain index. </div>
<div> This allows macro parameters to be variable in size and allows data <div> This allows macro parameters to be variable in size and allows data
states to change size without the user explicitly keeping track of the states to change size without the user explicitly keeping track of the
size independently.</div> size independently.<br>
<br>
An <i>array </i>can be empty and have no elements. An empty array has a
0 size. The notation for an empty array is '(0,())'.<br>
<br>
<span style="font-style: italic;"> </span></div>
<div>With variadic macro support a <i>tuple </i>has all of the <div>With variadic macro support a <i>tuple </i>has all of the
functionality as an <i>array</i>, knows its own size, and is easier functionality as an <i>array</i>, knows its own size, and is easier
syntactically to use. Because of that an <i>array</i> should be used, as syntactically to use. Because of that an <i>array</i> should be used, as
opposed to a <i>tuple</i>, only if your compiler does not support opposed to a <i>tuple</i>, only if your compiler does not support
variadic macros.<br> variadic macros. The only advantage an <i>array </i>has over a <i>tuple
</i>is that an <i>array </i>can be empty while a <i>tuple </i>always
has at least one element and therefore can never have a size of 0.<br>
<br> <br>
Elements of an <i>array</i> can be extracted with <b>BOOST_PP_ARRAY_ELEM</b>, Elements of an <i>array</i> can be extracted with <b>BOOST_PP_ARRAY_ELEM</b>,
an <i>array's</i> size can be extracted with <b>BOOST_PP_ARRAY_SIZE</b>, an <i>array's</i> size can be extracted with <b>BOOST_PP_ARRAY_SIZE</b>,

View File

@ -1,46 +1,42 @@
<html> <html>
<head> <head>
<title>lists.html</title> <meta content="text/html; charset=windows-1252" http-equiv="content-type">
<link rel="stylesheet" type="text/css" href="../styles.css"> <title>lists.html</title>
</head> <link rel="stylesheet" type="text/css" href="../styles.css">
<body> </head>
<h4>Lists</h4> <body>
<div> <h4>Lists</h4>
A <i>list</i> is a simple cons-style list with a head and a tail.&nbsp; <div> A <i>list</i> is a simple cons-style list with a head and a
The head of a <i>list</i> is an element, tail.&nbsp; The head of a <i>list</i> is an element, and the tail is
and the tail is either another <i>list</i> or <b>BOOST_PP_NIL</b>. either another <i>list</i> or <b>BOOST_PP_NIL</b>. For example, </div>
For example, <div class="code"> (<i>a</i>, (<i>b</i>, (<i>c</i>, <b>BOOST_PP_NIL</b>)))
</div> </div>
<div class="code"> <div> ...is a <i>list</i> of <i>3</i> elements--<i>a</i>, <i>b</i>, and <i>c</i>.
(<i>a</i>, (<i>b</i>, (<i>c</i>, <b>BOOST_PP_NIL</b>))) </div>
</div> <div> This allows macro parameters to be variable in size and allows data
<div> states to change size without the user explicitly keeping track of the
...is a <i>list</i> of <i>3</i> elements--<i>a</i>, <i>b</i>, and <i>c</i>. size independently.<br>
</div> <br>
<div> A list can be empty and therefore have a size of 0. An empty list is
This allows macro parameters to be variable in size and allows data states to change represented by the notation <b>BOOST_PP_NIL.<br>
size without the user explicitly keeping track of the size independently. <br>
</div> </b></div>
<div> <div> Elements of a <i>list</i> can be extracted with <b>BOOST_PP_LIST_FIRST</b>
Elements of a <i>list</i> can be extracted with and <b>BOOST_PP_LIST_REST</b>.&nbsp; </div>
<b>BOOST_PP_LIST_FIRST</b> and <b>BOOST_PP_LIST_REST</b>.&nbsp; <h4>Primitives</h4>
</div> <ul>
<h4>Primitives</h4> <li><a href="../ref/list_first.html">BOOST_PP_LIST_FIRST</a></li>
<ul> <li><a href="../ref/list_rest.html">BOOST_PP_LIST_REST</a></li>
<li><a href="../ref/list_first.html">BOOST_PP_LIST_FIRST</a></li> <li><a href="../ref/nil.html">BOOST_PP_NIL</a></li>
<li><a href="../ref/list_rest.html">BOOST_PP_LIST_REST</a></li> </ul>
<li><a href="../ref/nil.html">BOOST_PP_NIL</a></li> <hr size="1">
</ul> <div style="margin-left: 0px;"> <i><EFBFBD> Copyright <a href="http://www.housemarque.com"
<hr size="1"> target="_top">Housemarque Oy</a> 2002</i> <br>
<div style="margin-left: 0px;"> <i><EFBFBD> Copyright Paul Mensonides 2002</i> </div>
<i><EFBFBD> Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i> <div style="margin-left: 0px;">
</br><i><EFBFBD> Copyright Paul Mensonides 2002</i> <p><small>Distributed under the Boost Software License, Version 1.0. (See
</div> accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
<div style="margin-left: 0px;"> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
<p><small>Distributed under the Boost Software License, Version 1.0. (See </div>
accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or </body>
copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
</div>
</body>
</html> </html>

View File

@ -1,30 +1,23 @@
<html> <html>
<head> <head>
<title>sequences.html</title> <meta content="text/html; charset=windows-1252" http-equiv="content-type">
<link rel="stylesheet" type="text/css" href="../styles.css"> <title>sequences.html</title>
</head> <link rel="stylesheet" type="text/css" href="../styles.css">
<body> </head>
<h4> <body>
Sequences <h4> Sequences </h4>
</h4> <div> A <i>sequence</i> (abbreviated to <i>seq</i>) is a group of adjacent
<div> parenthesized elements. For example, </div>
A <i>sequence</i> (abbreviated to <i>seq</i>) is a group of adjacent parenthesized elements. For example, <div class="code"> (<i>a</i>)(<i>b</i>)(<i>c</i>) </div>
</div> <div> ...is a <i>seq</i> of <i>3</i> elements--<i>a</i>, <i>b</i>, and <i>c</i>.
<div class="code"> </div>
(<i>a</i>)(<i>b</i>)(<i>c</i>) <div> <i>Sequences</i> are data structures that merge the properties of
</div> both <i>lists</i> and <i>tuples</i> with the exception that a <i>seq, </i>like
<div> a <i>tuple, </i>cannot be empty.&nbsp; Therefore, an "empty" <i>seq</i>
...is a <i>seq</i> of <i>3</i> elements--<i>a</i>, <i>b</i>, and <i>c</i>. is considered a special case scenario that must be handled separately in
</div> C++. </div>
<div> <div class="code">
<i>Sequences</i> are data structures that merge the properties of both <i>lists</i> and <pre>#define SEQ (x)(y)(z)
<i>tuples</i> with the exception that a <i>seq</i> cannot be empty.&nbsp;
Therefore, an "empty" <i>seq</i> is considered a special case scenario that
must be handled separately in C++.
</div>
<div class="code">
<pre>
#define SEQ (x)(y)(z)
#define REVERSE(s, state, elem) (elem) state #define REVERSE(s, state, elem) (elem) state
// append to head ^ // append to head ^
@ -41,35 +34,27 @@ BOOST_PP_SEQ_FOLD_RIGHT(INC, BOOST_PP_SEQ_NIL, SEQ)
// ^ // ^
// special placeholder that will be "eaten" // special placeholder that will be "eaten"
// by appending to the tail // by appending to the tail
</pre> </pre> </div>
</div> <div> <i>Sequences</i> are extremely efficient.&nbsp; Element access speed
<div> approaches random access--even with <i>seqs</i> of up to <i>256</i>
<i>Sequences</i> are extremely efficient.&nbsp; Element access speed approaches elements.&nbsp; This is because element access (among other things) is
random access--even with <i>seqs</i> of up to <i>256</i> elements.&nbsp; This implemented iteratively rather than recursively.&nbsp; Therefore, elements
is because element access (among other things) is implemented iteratively can be accessed at extremely high indices even on preprocessors with low
rather than recursively.&nbsp; Therefore, elements can be accessed at extremely maximum expansion depths. </div>
high indices even on preprocessors with low maximum expansion depths. <div> Elements of a <i>seq</i> can be extracted with <b>BOOST_PP_SEQ_ELEM</b>.
</div> </div>
<div> <h4> Primitives </h4>
Elements of a <i>seq</i> can be extracted with <b>BOOST_PP_SEQ_ELEM</b>. <ul>
</div> <li> <a href="../ref/seq_elem.html">BOOST_PP_SEQ_ELEM</a></li>
<h4> </ul>
Primitives <hr size="1">
</h4> <div style="margin-left: 0px;"> <i><EFBFBD> Copyright <a href="http://www.housemarque.com"
<ul> target="_top">Housemarque Oy</a> 2002</i> <br>
<li> <i><EFBFBD> Copyright Paul Mensonides 2002</i> </div>
<a href="../ref/seq_elem.html">BOOST_PP_SEQ_ELEM</a></li> <div style="margin-left: 0px;">
</ul> <p><small>Distributed under the Boost Software License, Version 1.0. (See
<hr size="1"> accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
<div style="margin-left: 0px;"> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
<i><EFBFBD> Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i> </div>
</br><i><EFBFBD> Copyright Paul Mensonides 2002</i> </body>
</div>
<div style="margin-left: 0px;">
<p><small>Distributed under the Boost Software License, Version 1.0. (See
accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
</div>
</body>
</html> </html>

View File

@ -1,5 +1,6 @@
<html> <html>
<head> <head>
<meta content="text/html; charset=windows-1252" http-equiv="content-type">
<title>tuples.html</title> <title>tuples.html</title>
<link rel="stylesheet" type="text/css" href="../styles.css"> <link rel="stylesheet" type="text/css" href="../styles.css">
</head> </head>
@ -9,13 +10,19 @@
parenthesis.&nbsp; For example, </div> parenthesis.&nbsp; For example, </div>
<div class="code"> (<i>a</i>, <i>b</i>, <i>c</i>) </div> <div class="code"> (<i>a</i>, <i>b</i>, <i>c</i>) </div>
<div> ...is a <i>tuple</i> of <i>3</i> elements--<i>a</i>, <i>b</i>, and <div> ...is a <i>tuple</i> of <i>3</i> elements--<i>a</i>, <i>b</i>, and
<i>c</i>. </div> <i>c</i>.<br>
<br>
A <i>tuple </i>cannot be empty. The notation '()' as a <i>tuple </i>is
a single element <i>tuple </i>of size 1, where the element is empty. </div>
<div> <i>Tuples</i> are fast and easy to use.&nbsp; With variadic macro <div> <i>Tuples</i> are fast and easy to use.&nbsp; With variadic macro
support it is not necessary to know the size of a <i>tuple; </i>without support it is not necessary to know the size of a <i>tuple; </i>without
variadic macro support&nbsp;all access to <i>tuples</i> requires variadic macro support&nbsp;all access to <i>tuples</i> requires
knowledge of its size. Use a <i>tuple </i>instead of an <i>array</i> if knowledge of its size. Use a <i>tuple </i>instead of an <i>array</i> if
your compiler supports variadic macros, since a <i>tuple </i>has all of your compiler supports variadic macros, since a <i>tuple </i>has all of
the functionality as an <i>array </i>and is easier syntactically to use.</div> the functionality as an <i>array </i>and is easier syntactically to use.
The only functionality an <i>array </i>has which a <i>tuple </i>does
not have is that an <i>array </i>can be empty whereas a <i>tuple </i>cannot
be empty.</div>
<div> Elements of a <i>tuple</i> can be extracted with <b>BOOST_PP_TUPLE_ELEM</b>. <div> Elements of a <i>tuple</i> can be extracted with <b>BOOST_PP_TUPLE_ELEM</b>.
</div> </div>
<h4>Primitives</h4> <h4>Primitives</h4>