1.. Sequences/Classes//list |20
2
3list
4====
5
6Description
7-----------
8
9A ``list`` is a |variadic|, `forward`__, `extensible`__ sequence of types that
10supports constant-time insertion and removal of elements  at the beginning, and
11linear-time insertion and removal of elements at the end and in the middle.
12
13__ `Forward Sequence`_
14__ `Extensible Sequence`_
15
16Header
17------
18
19+-------------------+-------------------------------------------------------+
20| Sequence form     | Header                                                |
21+===================+=======================================================+
22| Variadic          | ``#include <boost/mpl/list.hpp>``                     |
23+-------------------+-------------------------------------------------------+
24| Numbered          | ``#include <boost/mpl/list/list``\ *n*\ ``.hpp>``     |
25+-------------------+-------------------------------------------------------+
26
27
28Model of
29--------
30
31* |Variadic Sequence|
32* |Forward Sequence|
33* |Extensible Sequence|
34* |Front Extensible Sequence|
35
36
37Expression semantics
38--------------------
39
40In the following table, ``l`` is a ``list``, ``pos`` and ``last`` are iterators into ``l``,
41``r`` is a |Forward Sequence|, and |t1...tn| and ``x`` are arbitrary types.
42
43+---------------------------------------+-----------------------------------------------------------+
44| Expression                            | Semantics                                                 |
45+=======================================+===========================================================+
46| .. parsed-literal::                   | ``list`` of elements |t1...tn|; see                       |
47|                                       | |Variadic Sequence|.                                      |
48|    list<|t1...tn|>                    |                                                           |
49|    list\ *n*\ <|t1...tn|>             |                                                           |
50+---------------------------------------+-----------------------------------------------------------+
51| .. parsed-literal::                   | Identical to ``list``\ *n*\ ``<``\ |t1...tn|\ ``>``;      |
52|                                       | see |Variadic Sequence|.                                  |
53|    list<|t1...tn|>::type              |                                                           |
54|    list\ *n*\ <|t1...tn|>::type       |                                                           |
55+---------------------------------------+-----------------------------------------------------------+
56| ``begin<l>::type``                    | An iterator to the beginning of ``l``;                    |
57|                                       | see |Forward Sequence|.                                   |
58+---------------------------------------+-----------------------------------------------------------+
59| ``end<l>::type``                      | An iterator to the end of ``l``;                          |
60|                                       | see |Forward Sequence|.                                   |
61+---------------------------------------+-----------------------------------------------------------+
62| ``size<l>::type``                     | The size of ``l``; see |Forward Sequence|.                |
63+---------------------------------------+-----------------------------------------------------------+
64| ``empty<l>::type``                    | |true if and only if| ``l`` is empty; see                 |
65|                                       | |Forward Sequence|.                                       |
66+---------------------------------------+-----------------------------------------------------------+
67| ``front<l>::type``                    | The first element in ``l``; see                           |
68|                                       | |Forward Sequence|.                                       |
69+---------------------------------------+-----------------------------------------------------------+
70| ``insert<l,pos,x>::type``             | A new ``list`` of following elements:                     |
71|                                       | [``begin<l>::type``, ``pos``), ``x``,                     |
72|                                       | [``pos``, ``end<l>::type``); see |Extensible Sequence|.   |
73+---------------------------------------+-----------------------------------------------------------+
74| ``insert_range<l,pos,r>::type``       | A new ``list`` of following elements:                     |
75|                                       | [``begin<l>::type``, ``pos``),                            |
76|                                       | [``begin<r>::type``, ``end<r>::type``)                    |
77|                                       | [``pos``, ``end<l>::type``); see |Extensible Sequence|.   |
78+---------------------------------------+-----------------------------------------------------------+
79| ``erase<l,pos>::type``                | A new ``list`` of following elements:                     |
80|                                       | [``begin<l>::type``, ``pos``),                            |
81|                                       | [``next<pos>::type``, ``end<l>::type``); see              |
82|                                       | |Extensible Sequence|.                                    |
83+---------------------------------------+-----------------------------------------------------------+
84| ``erase<l,pos,last>::type``           | A new ``list`` of following elements:                     |
85|                                       | [``begin<l>::type``, ``pos``),                            |
86|                                       | [``last``, ``end<l>::type``); see |Extensible Sequence|.  |
87+---------------------------------------+-----------------------------------------------------------+
88| ``clear<l>::type``                    | An empty ``list``; see |Extensible Sequence|.             |
89+---------------------------------------+-----------------------------------------------------------+
90| ``push_front<l,x>::type``             | A new ``list`` containing ``x`` as its first              |
91|                                       | element; see |Front Extensible Sequence|.                 |
92+---------------------------------------+-----------------------------------------------------------+
93| ``pop_front<l>::type``                | A new ``list`` containing all but the first elements      |
94|                                       | of ``l`` in  the same order; see                          |
95|                                       | |Front Extensible Sequence|.                              |
96+---------------------------------------+-----------------------------------------------------------+
97
98
99Example
100-------
101
102.. parsed-literal::
103
104    typedef list<float,double,long double> floats;
105    typedef push_front<floats,int>::type types;
106
107    BOOST_MPL_ASSERT(( is_same< front<types>::type, int > ));
108
109
110See also
111--------
112
113|Sequences|, |Variadic Sequence|, |Forward Sequence|, |Extensible Sequence|, |vector|, |list_c|
114
115
116.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
117   Distributed under the Boost Software License, Version 1.0. (See accompanying
118   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
119