]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/doc/src/refmanual/insert_range.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / insert_range.rst
1 .. Sequences/Intrinsic Metafunctions//insert_range
2
3 insert_range
4 ============
5
6 Synopsis
7 --------
8
9 .. parsed-literal::
10
11 template<
12 typename Sequence
13 , typename Pos
14 , typename Range
15 >
16 struct insert_range
17 {
18 typedef |unspecified| type;
19 };
20
21
22
23 Description
24 -----------
25
26 ``insert_range`` performs an insertion of a range of elements at an arbitrary position in
27 the sequence.
28
29 Header
30 ------
31
32 .. parsed-literal::
33
34 #include <boost/mpl/insert_range.hpp>
35
36
37 Model of
38 --------
39
40 |Tag Dispatched Metafunction|
41
42
43 Parameters
44 ----------
45
46 +---------------+-----------------------------------+-----------------------------------------------+
47 | Parameter | Requirement | Description |
48 +===============+===================================+===============================================+
49 | ``Sequence`` | |Extensible Sequence| or | A sequence to insert into. |
50 | | |Extensible Associative Sequence| | |
51 +---------------+-----------------------------------+-----------------------------------------------+
52 | ``Pos`` | |Forward Iterator| | An iterator in ``Sequence`` specifying the |
53 | | | insertion position. |
54 +---------------+-----------------------------------+-----------------------------------------------+
55 | ``Range`` | |Forward Sequence| | The range of elements to be inserted. |
56 +---------------+-----------------------------------+-----------------------------------------------+
57
58
59 Expression semantics
60 --------------------
61
62 For any |Extensible Sequence| ``s``, iterator ``pos`` in ``s``, and |Forward Sequence| ``range``:
63
64 .. parsed-literal::
65
66 typedef insert<s,pos,range>::type r;
67
68 :Return type:
69 |Extensible Sequence|.
70
71 :Precondition:
72 ``pos`` is an iterator into ``s``.
73
74 :Semantics:
75 ``r`` is a sequence, |concept-identical| to ``s``, of the following elements:
76 [``begin<s>::type``, ``pos``), [``begin<r>::type``, ``end<r>::type``),
77 [``pos``, ``end<s>::type``).
78
79 :Postcondition:
80 The relative order of the elements in ``r`` is the same as in ``s``;
81
82 .. parsed-literal::
83
84 size<r>::value == size<s>::value + size<range>::value
85
86
87 Complexity
88 ----------
89
90 Sequence dependent. Quadratic in the worst case, linear at best; see the particular
91 sequence class' specification for details.
92
93
94 Example
95 -------
96
97 .. parsed-literal::
98
99 typedef vector_c<int,0,1,7,8,9> numbers;
100 typedef find< numbers,integral_c<int,7> >::type pos;
101 typedef insert_range< numbers,pos,range_c<int,2,7> >::type range;
102
103 BOOST_MPL_ASSERT_RELATION( size<range>::value, ==, 10 );
104 BOOST_MPL_ASSERT(( equal< range,range_c<int,0,10> > ));
105
106 typedef insert_range<
107 list\ ``0``\ <>
108 , end< list\ ``0``\ <> >::type
109 , list<int>
110 >::type result2;
111
112 BOOST_MPL_ASSERT_RELATION( size<result2>::value, ==, 1 );
113
114
115 See also
116 --------
117
118 |Extensible Sequence|, |insert|, |push_front|, |push_back|, |erase|
119
120
121 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
122 Distributed under the Boost Software License, Version 1.0. (See accompanying
123 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)