]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Algorithms/Inserters//front_inserter |
2 | ||
3 | front_inserter | |
4 | ============== | |
5 | ||
6 | Synopsis | |
7 | -------- | |
8 | ||
9 | .. parsed-literal:: | |
10 | ||
11 | template< | |
12 | typename Seq | |
13 | > | |
14 | struct front_inserter | |
15 | { | |
16 | // |unspecified| | |
17 | // |...| | |
18 | }; | |
19 | ||
20 | ||
21 | Description | |
22 | ----------- | |
23 | ||
24 | Inserts elements at the beginning of the sequence. | |
25 | ||
26 | Header | |
27 | ------ | |
28 | ||
29 | .. parsed-literal:: | |
30 | ||
31 | #include <boost/mpl/front_inserter.hpp> | |
32 | ||
33 | Model of | |
34 | -------- | |
35 | ||
36 | |Inserter| | |
37 | ||
38 | ||
39 | Parameters | |
40 | ---------- | |
41 | ||
42 | +---------------+-------------------------------+---------------------------------------+ | |
43 | | Parameter | Requirement | Description | | |
44 | +===============+===============================+=======================================+ | |
45 | | ``Seq`` | |Front Extensible Sequence| | A sequence to bind the inserter to. | | |
46 | +---------------+-------------------------------+---------------------------------------+ | |
47 | ||
48 | ||
49 | Expression semantics | |
50 | -------------------- | |
51 | ||
52 | |Semantics disclaimer...| |Inserter|. | |
53 | ||
54 | For any |Front Extensible Sequence| ``s``: | |
55 | ||
56 | +---------------------------+-------------------------------------------------------+ | |
57 | | Expression | Semantics | | |
58 | +===========================+=======================================================+ | |
59 | | ``front_inserter<s>`` | An |Inserter| ``in``, equivalent to | | |
60 | | | | | |
61 | | | .. parsed-literal:: | | |
62 | | | | | |
63 | | | struct in : inserter<s,push_front<_1,_2> > {}; | | |
64 | +---------------------------+-------------------------------------------------------+ | |
65 | ||
66 | ||
67 | Complexity | |
68 | ---------- | |
69 | ||
70 | Amortized constant time. | |
71 | ||
72 | ||
73 | Example | |
74 | ------- | |
75 | ||
76 | .. parsed-literal:: | |
77 | ||
78 | typedef reverse_copy< | |
79 | range_c<int,0,5> | |
80 | , front_inserter< vector_c<int,5,6,7,8,9> > | |
81 | >::type range; | |
82 | ||
83 | BOOST_MPL_ASSERT(( equal< range, range_c<int,0,10> > )); | |
84 | ||
85 | ||
86 | See also | |
87 | -------- | |
88 | ||
89 | |Algorithms|, |Inserter|, |Reversible Algorithm|, |[inserter]|, |back_inserter|, |push_front| | |
90 | ||
91 | ||
92 |