<<<<<<< .working ======= >>>>>>> .merge-right.r57125
Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
<<<<<<< .working

list

Description

=======
Description
>>>>>>> .merge-right.r57125

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).

<<<<<<< .working

Header

=======
Header
>>>>>>> .merge-right.r57125
#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>
<<<<<<< .working

Synopsis

=======
Synopsis
>>>>>>> .merge-right.r57125
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
<<<<<<< .working

Template parameters

=======
Template parameters
>>>>>>> .merge-right.r57125

Parameter

Description

Default

T0...TN

Element types

unspecified-type

<<<<<<< .working

Model of

=======
Model of
>>>>>>> .merge-right.r57125

Notation

L

A list type

l

An instance of list

e0...en

Heterogeneous values

s

A Forward Sequence

N

An MPL Integral Constant

<<<<<<< .working

Expression Semantics

=======
Expression Semantics
>>>>>>> .merge-right.r57125

Semantics 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.

at<N>(l)

The Nth element from the beginning of the sequence; see at.

Example

=======

Example
>>>>>>> .merge-right.r57125
list<int, float> l(12, 5.5f);
std::cout << at_c<0>(l) << std::endl;
std::cout << at_c<1>(l) << std::endl;

PrevUpHomeNext