![]() |
Home | Libraries | People | FAQ | More |
list is a Forward
Sequence of heterogenous typed data built on top of cons. It is more efficient than
vector
when the target sequence is constructed piecemeal (a data at a time). The
runtime cost of access to each element is peculiarly constant (see Recursive Inlined Functions).
#include <boost/fusion/sequence/container/list.hpp> #include <boost/fusion/sequence/container/list/list_forward.hpp>
template < typename T0 = unspecified , typename T1 = unspecified , typename T2 = unspecified ... , typename TN = unspecified > struct list;
The variadic class interface accepts 0
to FUSION_MAX_LIST_SIZE
elements, where FUSION_MAX_LIST_SIZE
is a user definable predefined maximum that defaults to 10.
Example:
list<int, char, double>
You may define the preprocessor constant FUSION_MAX_LIST_SIZE
before including any Fusion header to change the default. Example:
#define FUSION_MAX_LIST_SIZE 20
| Parameter | Description | Default |
|---|---|---|
T0...TN
|
Element types | unspecified-type |
Notation
Llist type
llist
e0...ensNSemantics of an expression is defined only where it differs from, or is not defined in Forward Sequence.
| Expression | Semantics |
|---|---|
L() |
Creates a list with default constructed elements. |
L(e0, e1,...
en) |
Creates
a list with elements e0...en. |
L(s) |
Copy
constructs a list from a Forward
Sequence, s. |
l =
s |
Assigns
to a list, l, from
a Forward
Sequence, s. |
|
The
Nth element from the beginning of the sequence; see at. |
is
provided for convenience and compatibility with the original Boost.Tuple
library, despite at<n>(l)list being
a Forward Sequence
only (at is supposed to be a Random
Access Sequence requirement). The runtime complexity of at is constant (see Recursive
Inlined Functions).
list<int, float> l(12, 5.5f); std::cout <<at<0>(l) << std::endl; std::cout <<at<1>(l) << std::endl;
| Copyright © 2001-2005 Joel de Guzman, Dan Marsden |