+
arrays.html
@@ -17,12 +18,19 @@
size. It only requires that an element exists at a certain index.
This allows macro parameters to be variable in size and allows data
states to change size without the user explicitly keeping track of the
- size independently.
+ size independently.
+
+ An array can be empty and have no elements. An empty array has a
+ 0 size. The notation for an empty array is '(0,())'.
+
+
With variadic macro support a tuple has all of the
functionality as an array, knows its own size, and is easier
syntactically to use. Because of that an array should be used, as
opposed to a tuple, only if your compiler does not support
- variadic macros.
+ variadic macros. The only advantage an array has over a tuple
+ is that an array can be empty while a tuple always
+ has at least one element and therefore can never have a size of 0.
Elements of an array can be extracted with BOOST_PP_ARRAY_ELEM,
an array's size can be extracted with BOOST_PP_ARRAY_SIZE,
diff --git a/doc/data/lists.html b/doc/data/lists.html
index d7d99a3..27abf08 100644
--- a/doc/data/lists.html
+++ b/doc/data/lists.html
@@ -1,46 +1,42 @@
-
- lists.html
-
-
-
-
Lists
-
- A list is a simple cons-style list with a head and a tail.
- The head of a list is an element,
- and the tail is either another list or BOOST_PP_NIL.
- For example,
-
-
- (a, (b, (c, BOOST_PP_NIL)))
-
-
- ...is a list of 3 elements--a, b, and c.
-
-
- This allows macro parameters to be variable in size and allows data states to change
- size without the user explicitly keeping track of the size independently.
-
-
- Elements of a list can be extracted with
- BOOST_PP_LIST_FIRST and BOOST_PP_LIST_REST.
-
A list is a simple cons-style list with a head and a
+ tail. The head of a list is an element, and the tail is
+ either another list or BOOST_PP_NIL. For example,
+
(a, (b, (c, BOOST_PP_NIL)))
+
+
...is a list of 3 elements--a, b, and c.
+
+
This allows macro parameters to be variable in size and allows data
+ states to change size without the user explicitly keeping track of the
+ size independently.
+
+ A list can be empty and therefore have a size of 0. An empty list is
+ represented by the notation BOOST_PP_NIL.
+
+
+
Elements of a list can be extracted with BOOST_PP_LIST_FIRST
+ and BOOST_PP_LIST_REST.
- A sequence (abbreviated to seq) is a group of adjacent parenthesized elements. For example,
-
-
- (a)(b)(c)
-
-
- ...is a seq of 3 elements--a, b, and c.
-
-
- Sequences are data structures that merge the properties of both lists and
- tuples with the exception that a seq cannot be empty.
- Therefore, an "empty" seq is considered a special case scenario that
- must be handled separately in C++.
-
A sequence (abbreviated to seq) is a group of adjacent
+ parenthesized elements. For example,
+
(a)(b)(c)
+
...is a seq of 3 elements--a, b, and c.
+
+
Sequences are data structures that merge the properties of
+ both lists and tuples with the exception that a seq, like
+ a tuple, cannot be empty. Therefore, an "empty" seq
+ is considered a special case scenario that must be handled separately in
+ C++.
+
+
#define SEQ (x)(y)(z)
#define REVERSE(s, state, elem) (elem) state
// append to head ^
@@ -41,35 +34,27 @@ BOOST_PP_SEQ_FOLD_RIGHT(INC, BOOST_PP_SEQ_NIL, SEQ)
// ^
// special placeholder that will be "eaten"
// by appending to the tail
-
-
-
- Sequences are extremely efficient. Element access speed approaches
- random access--even with seqs of up to 256 elements. This
- is because element access (among other things) is implemented iteratively
- rather than recursively. Therefore, elements can be accessed at extremely
- high indices even on preprocessors with low maximum expansion depths.
-
-
- Elements of a seq can be extracted with BOOST_PP_SEQ_ELEM.
-
Sequences are extremely efficient. Element access speed
+ approaches random access--even with seqs of up to 256
+ elements. This is because element access (among other things) is
+ implemented iteratively rather than recursively. Therefore, elements
+ can be accessed at extremely high indices even on preprocessors with low
+ maximum expansion depths.
+
Elements of a seq can be extracted with BOOST_PP_SEQ_ELEM.
+
+
diff --git a/doc/data/tuples.html b/doc/data/tuples.html
index 4b5bbea..7a93c9b 100644
--- a/doc/data/tuples.html
+++ b/doc/data/tuples.html
@@ -1,5 +1,6 @@
+
tuples.html
@@ -9,13 +10,19 @@
parenthesis. For example,
(a, b, c)
...is a tuple of 3 elements--a, b, and
- c.
+ c.
+
+ A tuple cannot be empty. The notation '()' as a tuple is
+ a single element tuple of size 1, where the element is empty.
Tuples are fast and easy to use. With variadic macro
support it is not necessary to know the size of a tuple; without
variadic macro support all access to tuples requires
knowledge of its size. Use a tuple instead of an array if
your compiler supports variadic macros, since a tuple has all of
- the functionality as an array and is easier syntactically to use.
+ the functionality as an array and is easier syntactically to use.
+ The only functionality an array has which a tuple does
+ not have is that an array can be empty whereas a tuple cannot
+ be empty.
Elements of a tuple can be extracted with BOOST_PP_TUPLE_ELEM.