![]() |
Home | Libraries | People | FAQ | More |
list is a Forward
Sequence of heterogeneous 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/container/list.hpp> #include <boost/fusion/include/list.hpp> #include <boost/fusion/container/list/list_fwd.hpp> #include <boost/fusion/include/list_fwd.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 |
|---|---|---|
|
|
Element types |
unspecified |
Notation
L
A list type
l
An instance of list
e0...enHeterogeneous values
sNSemantics of an expression is defined only where it differs from, or is not defined in Forward Sequence.
|
Expression |
Semantics |
|---|---|
|
|
Creates a list with default constructed elements. |
|
|
Creates a list with elements |
|
|
Copy constructs a list from a Forward
Sequence, |
|
|
Assigns to a list, |
|
|
The Nth element from the beginning of the sequence; see |
![]() |
Note |
|---|---|
|
list<int, float> l(12, 5.5f); std::cout <<at_c<0>(l) << std::endl; std::cout <<at_c<1>(l) << std::endl;