]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN"> |
2 | ||
3 | <html> | |
4 | <head> | |
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
6 | <title>Boost.MultiIndex Documentation - Sequenced indices reference</title> | |
7 | <link rel="stylesheet" href="../style.css" type="text/css"> | |
8 | <link rel="start" href="../index.html"> | |
9 | <link rel="prev" href="hash_indices.html"> | |
10 | <link rel="up" href="index.html"> | |
11 | <link rel="next" href="rnd_indices.html"> | |
12 | </head> | |
13 | ||
14 | <body> | |
15 | <h1><img src="../../../../boost.png" alt="boost.png (6897 bytes)" align= | |
16 | "middle" width="277" height="86">Boost.MultiIndex Sequenced indices reference</h1> | |
17 | ||
18 | <div class="prev_link"><a href="hash_indices.html"><img src="../prev.gif" alt="hashed indices" border="0"><br> | |
19 | Hashed indices | |
20 | </a></div> | |
21 | <div class="up_link"><a href="index.html"><img src="../up.gif" alt="Boost.MultiIndex reference" border="0"><br> | |
22 | Boost.MultiIndex reference | |
23 | </a></div> | |
24 | <div class="next_link"><a href="rnd_indices.html"><img src="../next.gif" alt="random access indices" border="0"><br> | |
25 | Random access indices | |
26 | </a></div><br clear="all" style="clear: all;"> | |
27 | ||
28 | <hr> | |
29 | ||
30 | <h2>Contents</h2> | |
31 | ||
32 | <ul> | |
33 | <li><a href="#seq_index_fwd_synopsis">Header | |
34 | <code>"boost/multi_index/sequenced_index_fwd.hpp"</code> synopsis</a></li> | |
35 | <li><a href="#synopsis">Header | |
36 | <code>"boost/multi_index/sequenced_index.hpp"</code> synopsis</a> | |
37 | <ul> | |
38 | <li><a href="#sequenced"><code>sequenced</code> index specifier</a></li> | |
39 | <li><a href="#seq_indices">Sequenced indices</a> | |
40 | <ul> | |
41 | <li><a href="#complexity_signature">Complexity signature</a></li> | |
42 | <li><a href="#instantiation_types">Instantiation types</a></li> | |
43 | <li><a href="#constructors">Constructors, copy and assignment</a></li> | |
44 | <li><a href="#iterators">Iterators</a></li> | |
45 | <li><a href="#capacity">Capacity operations</a></li> | |
46 | <li><a href="#modifiers">Modifiers</a></li> | |
47 | <li><a href="#list_operations">List operations</a></li> | |
48 | <li><a href="#rearrange_operations">Rearrange operations</a></li> | |
49 | <li><a href="#serialization">Serialization</a></li> | |
50 | </ul> | |
51 | </li> | |
52 | </ul> | |
53 | </li> | |
54 | </ul> | |
55 | ||
56 | <h2> | |
57 | <a name="seq_index_fwd_synopsis">Header | |
58 | <a href="../../../../boost/multi_index/sequenced_index_fwd.hpp"> | |
59 | <code>"boost/multi_index/sequenced_index_fwd.hpp"</code></a> synopsis</a></h2> | |
60 | ||
61 | <blockquote><pre> | |
62 | <span class=keyword>namespace</span> <span class=identifier>boost</span><span class=special>{</span> | |
63 | ||
64 | <span class=keyword>namespace</span> <span class=identifier>multi_index</span><span class=special>{</span> | |
65 | ||
66 | <span class=comment>// sequenced index specifier</span> | |
67 | ||
68 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>TagList</span><span class=special>=</span><span class=identifier>tag</span><span class=special><></span> <span class=special>></span> <span class=keyword>struct</span> <span class=identifier>sequenced</span><span class=special>;</span> | |
69 | ||
70 | <span class=comment>// indices</span> | |
71 | ||
72 | <span class=keyword>namespace</span> <span class=identifier>detail</span><span class=special>{</span> | |
73 | ||
74 | <span class=keyword>template</span><span class=special><</span><b>implementation defined</b><span class=special>></span> <span class=keyword>class</span> <b>index class name implementation defined</b><span class=special>;</span> | |
75 | ||
76 | <span class=special>}</span> <span class=comment>// namespace boost::multi_index::detail</span> | |
77 | ||
78 | <span class=special>}</span> <span class=comment>// namespace boost::multi_index</span> | |
79 | ||
80 | <span class=special>}</span> <span class=comment>// namespace boost</span> | |
81 | </pre></blockquote> | |
82 | ||
83 | <p> | |
84 | <code>sequenced_index_fwd.hpp</code> provides forward declarations for the | |
85 | <a href="#sequenced"><code>sequenced</code></a> index specifier and | |
86 | its associated <a href="#seq_indices">sequenced index</a> class. | |
87 | </p> | |
88 | ||
89 | <h2> | |
90 | <a name="synopsis">Header | |
91 | <a href="../../../../boost/multi_index/sequenced_index.hpp"> | |
92 | <code>"boost/multi_index/sequenced_index.hpp"</code></a> synopsis</a></h2> | |
93 | ||
94 | <blockquote><pre> | |
95 | <span class=preprocessor>#include</span> <span class=special><</span><span class=identifier>initializer_list</span><span class=special>></span> | |
96 | ||
97 | <span class=keyword>namespace</span> <span class=identifier>boost</span><span class=special>{</span> | |
98 | ||
99 | <span class=keyword>namespace</span> <span class=identifier>multi_index</span><span class=special>{</span> | |
100 | ||
101 | <span class=comment>// sequenced index specifier</span> | |
102 | ||
103 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>TagList</span><span class=special>=</span><span class=identifier>tag</span><span class=special><></span> <span class=special>></span> <span class=keyword>struct</span> <span class=identifier>sequenced</span><span class=special>;</span> | |
104 | ||
105 | <span class=comment>// indices</span> | |
106 | ||
107 | <span class=keyword>namespace</span> <span class=identifier>detail</span><span class=special>{</span> | |
108 | ||
109 | <span class=keyword>template</span><span class=special><</span><b>implementation defined</b><span class=special>></span> <span class=keyword>class</span> <b>index class name implementation defined</b><span class=special>;</span> | |
110 | ||
111 | <span class=comment>// index comparison:</span> | |
112 | ||
113 | <span class=comment>// <b>OP</b> is any of ==,<,!=,>,>=,<=</span> | |
114 | ||
115 | <span class=keyword>template</span><span class=special><</span><b>arg set 1</b><span class=special>,</span><b>arg set 2</b><span class=special>></span> | |
116 | <span class=keyword>bool</span> <span class=keyword>operator</span> <b><i>OP</i></b><span class=special>(</span> | |
117 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 1</b><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span><span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 2</b><span class=special>>&</span> <span class=identifier>y</span><span class=special>);</span> | |
118 | ||
119 | <span class=comment>// index specialized algorithms:</span> | |
120 | ||
121 | <span class=keyword>template</span><span class=special><</span><b>implementation defined</b><span class=special>></span> | |
122 | <span class=keyword>void</span> <span class=identifier>swap</span><span class=special>(</span><b>index class name</b><span class=special>&</span> <span class=identifier>x</span><span class=special>,</span><b>index class name</b><span class=special>&</span> <span class=identifier>y</span><span class=special>);</span> | |
123 | ||
124 | <span class=special>}</span> <span class=comment>// namespace boost::multi_index::detail</span> | |
125 | ||
126 | <span class=special>}</span> <span class=comment>// namespace boost::multi_index</span> | |
127 | ||
128 | <span class=special>}</span> <span class=comment>// namespace boost</span> | |
129 | </pre></blockquote> | |
130 | ||
131 | <h3><a name="sequenced"> | |
132 | <code>sequenced</code> index specifier | |
133 | </a></h3> | |
134 | ||
135 | <p> | |
136 | This index specifier allows for insertion of a <a href="#seq_indices">sequenced | |
137 | index</a>.</p> | |
138 | ||
139 | <blockquote><pre> | |
140 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>TagList</span><span class=special>=</span><span class=identifier>tag</span><span class=special><></span> <span class=special>></span> <span class=keyword>struct</span> <span class=identifier>sequenced</span><span class=special>;</span> | |
141 | </pre></blockquote> | |
142 | ||
143 | <p>If provided, <code>TagList</code> must be an instantiation of | |
144 | <a href="indices.html#tag"><code>tag</code></a>. | |
145 | </p> | |
146 | ||
147 | <h3><a name="seq_indices">Sequenced indices</a></h3> | |
148 | ||
149 | <p> | |
150 | Sequenced indices are modeled after the semantics of a bidirectional list | |
151 | like <code>std::list</code>. Elements in a sequenced index are by default | |
152 | sorted according to their order of insertion: this means that new elements | |
153 | inserted through a different index of the <code>multi_index_container</code> are appended | |
154 | to the end of the sequenced index. Additionally, the index allows for free | |
155 | reordering of elements in the same vein as <code>std::list</code> does. Validity | |
156 | of iterators and references to elements is preserved in all operations. | |
157 | </p> | |
158 | ||
159 | <p> | |
160 | Except where noted or if the corresponding interface does not exist, sequenced | |
161 | indices verify the same container requirements as <code>std::list</code>: | |
162 | we only provide descriptions of those types and operations that are either not | |
163 | present in <code>std::list</code> or behave differently. Some of the | |
164 | most important differences are: | |
165 | <ul> | |
166 | <li>The complexity of some operations, notably insertion and deletion, differ | |
167 | from those of <code>std::list</code>. | |
168 | </li> | |
169 | <li>Unlike as in <code>std::list</code>, insertions into a sequenced index | |
170 | may fail due to clashings with other indices. This alters the semantics | |
171 | of the operations provided with respect to their analogues in | |
172 | <code>std::list</code>. | |
173 | </li> | |
174 | <li>Elements in a sequenced index are not mutable, and can only be changed | |
175 | by means of <a href="#replace"><code>replace</code></a> and | |
176 | <a href="#modify"><code>modify</code></a> member functions. | |
177 | </li> | |
178 | </ul> | |
179 | </p> | |
180 | ||
181 | <blockquote><pre> | |
182 | <span class=keyword>namespace</span> <span class=identifier>boost</span><span class=special>{</span> | |
183 | ||
184 | <span class=keyword>namespace</span> <span class=identifier>multi_index</span><span class=special>{</span> | |
185 | ||
186 | <span class=keyword>namespace</span> <span class=identifier>detail</span><span class=special>{</span> | |
187 | ||
188 | <span class=keyword>template</span><span class=special><</span><b>implementation defined: dependent on types Value, Allocator, TagList</b><span class=special>></span> | |
189 | <span class=keyword>class</span> <b>name is implementation defined</b> | |
190 | <span class=special>{</span> | |
191 | <span class=keyword>public</span><span class=special>:</span> | |
192 | <span class=comment>// types:</span> | |
193 | ||
194 | <span class=keyword>typedef</span> <span class=identifier>Value</span> <span class=identifier>value_type</span><span class=special>;</span> | |
195 | <span class=keyword>typedef</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuples</span><span class=special>::</span><span class=identifier>null_type</span> <span class=identifier>ctor_args</span><span class=special>;</span> | |
196 | <span class=keyword>typedef</span> <span class=identifier>TagList</span> <span class=identifier>tag_list</span><span class=special>;</span> | |
197 | <span class=keyword>typedef</span> <span class=identifier>Allocator</span> <span class=identifier>allocator_type</span><span class=special>;</span> | |
198 | <span class=keyword>typedef</span> <span class=keyword>typename</span> <span class=identifier>allocator_type</span><span class=special>::</span><span class=identifier>reference</span> <span class=identifier>reference</span><span class=special>;</span> | |
199 | <span class=keyword>typedef</span> <span class=keyword>typename</span> <span class=identifier>allocator_type</span><span class=special>::</span><span class=identifier>const_reference</span> <span class=identifier>const_reference</span><span class=special>;</span> | |
200 | <span class=keyword>typedef</span> <b>implementation defined</b> <span class=identifier>iterator</span><span class=special>;</span> | |
201 | <span class=keyword>typedef</span> <b>implementation defined</b> <span class=identifier>const_iterator</span><span class=special>;</span> | |
202 | <span class=keyword>typedef</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>size_t</span> <span class=identifier>size_type</span><span class=special>;</span> | |
203 | <span class=keyword>typedef</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>ptrdiff_t</span> <span class=identifier>difference_type</span><span class=special>;</span> | |
204 | <span class=keyword>typedef</span> <span class=keyword>typename</span> <span class=identifier>allocator_type</span><span class=special>::</span><span class=identifier>pointer</span> <span class=identifier>pointer</span><span class=special>;</span> | |
205 | <span class=keyword>typedef</span> <span class=keyword>typename</span> <span class=identifier>allocator_type</span><span class=special>::</span><span class=identifier>const_pointer</span> <span class=identifier>const_pointer</span><span class=special>;</span> | |
206 | <span class=keyword>typedef</span> <b>equivalent to | |
207 | std::reverse_iterator<iterator></b> <span class=identifier>reverse_iterator</span><span class=special>;</span> | |
208 | <span class=keyword>typedef</span> <b>equivalent to | |
209 | std::reverse_iterator<const_iterator></b> <span class=identifier>const_reverse_iterator</span><span class=special>;</span> | |
210 | ||
211 | <span class=comment>// construct/copy/destroy:</span> | |
212 | ||
213 | <b>index class name</b><span class=special>&</span> <span class=keyword>operator</span><span class=special>=(</span><span class=keyword>const</span> <b>index class name</b><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
214 | <b>index class name</b><span class=special>&</span> <span class=keyword>operator</span><span class=special>=(</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>initializer_list</span><span class=special><</span><span class=identifier>value_type</span><span class=special>></span> <span class=identifier>list</span><span class=special>);</span> | |
215 | ||
216 | <span class=keyword>template</span> <span class=special><</span><span class=keyword>class</span> <span class=identifier>InputIterator</span><span class=special>></span> | |
217 | <span class=keyword>void</span> <span class=identifier>assign</span><span class=special>(</span><span class=identifier>InputIterator</span> <span class=identifier>first</span><span class=special>,</span><span class=identifier>InputIterator</span> <span class=identifier>last</span><span class=special>);</span> | |
218 | <span class=keyword>void</span> <span class=identifier>assign</span><span class=special>(</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>initializer_list</span><span class=special><</span><span class=identifier>value_type</span><span class=special>></span> <span class=identifier>list</span><span class=special>);</span> | |
219 | <span class=keyword>void</span> <span class=identifier>assign</span><span class=special>(</span><span class=identifier>size_type</span> <span class=identifier>n</span><span class=special>,</span><span class=keyword>const</span> <span class=identifier>value_type</span><span class=special>&</span> <span class=identifier>value</span><span class=special>);</span> | |
220 | ||
221 | <span class=identifier>allocator_type</span> <span class=identifier>get_allocator</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
222 | ||
223 | <span class=comment>// iterators:</span> | |
224 | ||
225 | <span class=identifier>iterator</span> <span class=identifier>begin</span><span class=special>()</span><span class=keyword>noexcept</span><span class=special>;</span> | |
226 | <span class=identifier>const_iterator</span> <span class=identifier>begin</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
227 | <span class=identifier>iterator</span> <span class=identifier>end</span><span class=special>()</span><span class=keyword>noexcept</span><span class=special>;</span> | |
228 | <span class=identifier>const_iterator</span> <span class=identifier>end</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
229 | <span class=identifier>reverse_iterator</span> <span class=identifier>rbegin</span><span class=special>()</span><span class=keyword>noexcept</span><span class=special>;</span> | |
230 | <span class=identifier>const_reverse_iterator</span> <span class=identifier>rbegin</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
231 | <span class=identifier>reverse_iterator</span> <span class=identifier>rend</span><span class=special>()</span><span class=keyword>noexcept</span><span class=special>;</span> | |
232 | <span class=identifier>const_reverse_iterator</span> <span class=identifier>rend</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
233 | <span class=identifier>const_iterator</span> <span class=identifier>cbegin</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
234 | <span class=identifier>const_iterator</span> <span class=identifier>cend</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
235 | <span class=identifier>const_reverse_iterator</span> <span class=identifier>crbegin</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
236 | <span class=identifier>const_reverse_iterator</span> <span class=identifier>crend</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
237 | ||
238 | <span class=identifier>iterator</span> <span class=identifier>iterator_to</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>value_type</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
239 | <span class=identifier>const_iterator</span> <span class=identifier>iterator_to</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>value_type</span><span class=special>&</span> <span class=identifier>x</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span> | |
240 | ||
241 | <span class=comment>// capacity:</span> | |
242 | ||
243 | <span class=keyword>bool</span> <span class=identifier>empty</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
244 | <span class=identifier>size_type</span> <span class=identifier>size</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
245 | <span class=identifier>size_type</span> <span class=identifier>max_size</span><span class=special>()</span><span class=keyword>const</span> <span class=keyword>noexcept</span><span class=special>;</span> | |
246 | ||
247 | <span class=keyword>void</span> <span class=identifier>resize</span><span class=special>(</span><span class=identifier>size_type</span> <span class=identifier>n</span><span class=special>);</span> | |
248 | <span class=keyword>void</span> <span class=identifier>resize</span><span class=special>(</span><span class=identifier>size_type</span> <span class=identifier>n</span><span class=special>,</span><span class=keyword>const</span> <span class=identifier>value_type</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
249 | ||
250 | <span class=comment>// access:</span> | |
251 | ||
252 | <span class=identifier>const_reference</span> <span class=identifier>front</span><span class=special>()</span><span class=keyword>const</span><span class=special>;</span> | |
253 | <span class=identifier>const_reference</span> <span class=identifier>back</span><span class=special>()</span><span class=keyword>const</span><span class=special>;</span> | |
254 | ||
255 | <span class=comment>// modifiers:</span> | |
256 | ||
257 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Args</span><span class=special>></span> | |
258 | <span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special><</span><span class=identifier>iterator</span><span class=special>,</span><span class=keyword>bool</span><span class=special>></span> <span class=identifier>emplace_front</span><span class=special>(</span><span class=identifier>Args</span><span class=special>&&...</span> <span class=identifier>args</span><span class=special>);</span> | |
259 | <span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special><</span><span class=identifier>iterator</span><span class=special>,</span><span class=keyword>bool</span><span class=special>></span> <span class=identifier>push_front</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>value_type</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
260 | <span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special><</span><span class=identifier>iterator</span><span class=special>,</span><span class=keyword>bool</span><span class=special>></span> <span class=identifier>push_front</span><span class=special>(</span><span class=identifier>value_type</span><span class=special>&&</span> <span class=identifier>x</span><span class=special>);</span> | |
261 | <span class=keyword>void</span> <span class=identifier>pop_front</span><span class=special>();</span> | |
262 | ||
263 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Args</span><span class=special>></span> | |
264 | <span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special><</span><span class=identifier>iterator</span><span class=special>,</span><span class=keyword>bool</span><span class=special>></span> <span class=identifier>emplace_back</span><span class=special>(</span><span class=identifier>Args</span><span class=special>&&...</span> <span class=identifier>args</span><span class=special>);</span> | |
265 | <span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special><</span><span class=identifier>iterator</span><span class=special>,</span><span class=keyword>bool</span><span class=special>></span> <span class=identifier>push_back</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>value_type</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
266 | <span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special><</span><span class=identifier>iterator</span><span class=special>,</span><span class=keyword>bool</span><span class=special>></span> <span class=identifier>push_back</span><span class=special>(</span><span class=identifier>value_type</span><span class=special>&&</span> <span class=identifier>x</span><span class=special>);</span> | |
267 | <span class=keyword>void</span> <span class=identifier>pop_back</span><span class=special>();</span> | |
268 | ||
269 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Args</span><span class=special>></span> | |
270 | <span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special><</span><span class=identifier>iterator</span><span class=special>,</span><span class=keyword>bool</span><span class=special>></span> <span class=identifier>emplace</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=identifier>Args</span><span class=special>&&...</span> <span class=identifier>args</span><span class=special>);</span> | |
271 | <span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special><</span><span class=identifier>iterator</span><span class=special>,</span><span class=keyword>bool</span><span class=special>></span> <span class=identifier>insert</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=keyword>const</span> <span class=identifier>value_type</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
272 | <span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special><</span><span class=identifier>iterator</span><span class=special>,</span><span class=keyword>bool</span><span class=special>></span> <span class=identifier>insert</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=identifier>value_type</span><span class=special>&&</span> <span class=identifier>x</span><span class=special>);</span> | |
273 | <span class=keyword>void</span> <span class=identifier>insert</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=identifier>size_type</span> <span class=identifier>n</span><span class=special>,</span><span class=keyword>const</span> <span class=identifier>value_type</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
274 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>InputIterator</span><span class=special>></span> | |
275 | <span class=keyword>void</span> <span class=identifier>insert</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=identifier>InputIterator</span> <span class=identifier>first</span><span class=special>,</span><span class=identifier>InputIterator</span> <span class=identifier>last</span><span class=special>);</span> | |
276 | <span class=keyword>void</span> <span class=identifier>insert</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>initializer_list</span><span class=special><</span><span class=identifier>value_type</span><span class=special>></span> <span class=identifier>list</span><span class=special>);</span> | |
277 | ||
278 | <span class=identifier>iterator</span> <span class=identifier>erase</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>);</span> | |
279 | <span class=identifier>iterator</span> <span class=identifier>erase</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>first</span><span class=special>,</span><span class=identifier>iterator</span> <span class=identifier>last</span><span class=special>);</span> | |
280 | ||
281 | <span class=keyword>bool</span> <span class=identifier>replace</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=keyword>const</span> <span class=identifier>value_type</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
282 | <span class=keyword>bool</span> <span class=identifier>replace</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=identifier>value_type</span><span class=special>&&</span> <span class=identifier>x</span><span class=special>);</span> | |
283 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Modifier</span><span class=special>></span> <span class=keyword>bool</span> <span class=identifier>modify</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=identifier>Modifier</span> <span class=identifier>mod</span><span class=special>);</span> | |
284 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Modifier</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Rollback</span><span class=special>></span> | |
285 | <span class=keyword>bool</span> <span class=identifier>modify</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=identifier>Modifier</span> <span class=identifier>mod</span><span class=special>,</span><span class=identifier>Rollback</span> <span class=identifier>back</span><span class=special>);</span> | |
286 | ||
287 | <span class=keyword>void</span> <span class=identifier>swap</span><span class=special>(</span><b>index class name</b><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
288 | ||
289 | <span class=keyword>void</span> <span class=identifier>clear</span><span class=special>()</span><span class=keyword>noexcept</span><span class=special>;</span> | |
290 | ||
291 | <span class=comment>// list operations:</span> | |
292 | ||
293 | <span class=keyword>void</span> <span class=identifier>splice</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><b>index class name</b><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
294 | <span class=keyword>void</span> <span class=identifier>splice</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><b>index class name</b><span class=special>&</span> <span class=identifier>x</span><span class=special>,</span><span class=identifier>iterator</span> <span class=identifier>i</span><span class=special>);</span> | |
295 | <span class=keyword>void</span> <span class=identifier>splice</span><span class=special>(</span> | |
296 | <span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><b>index class name</b><span class=special>&</span> <span class=identifier>x</span><span class=special>,</span><span class=identifier>iterator</span> <span class=identifier>first</span><span class=special>,</span><span class=identifier>iterator</span> <span class=identifier>last</span><span class=special>);</span> | |
297 | ||
298 | <span class=keyword>void</span> <span class=identifier>remove</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>value_type</span><span class=special>&</span> <span class=identifier>value</span><span class=special>);</span> | |
299 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Predicate</span><span class=special>></span> <span class=keyword>void</span> <span class=identifier>remove_if</span><span class=special>(</span><span class=identifier>Predicate</span> <span class=identifier>pred</span><span class=special>);</span> | |
300 | ||
301 | <span class=keyword>void</span> <span class=identifier>unique</span><span class=special>();</span> | |
302 | <span class=keyword>template</span> <span class=special><</span><span class=keyword>class</span> <span class=identifier>BinaryPredicate</span><span class=special>></span> | |
303 | <span class=keyword>void</span> <span class=identifier>unique</span><span class=special>(</span><span class=identifier>BinaryPredicate</span> <span class=identifier>binary_pred</span><span class=special>);</span> | |
304 | ||
305 | <span class=keyword>void</span> <span class=identifier>merge</span><span class=special>(</span><b>index class name</b><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span> | |
306 | <span class=keyword>template</span> <span class=special><</span><span class=keyword>typename</span> <span class=identifier>Compare</span><span class=special>></span> <span class=keyword>void</span> <span class=identifier>merge</span><span class=special>(</span><b>index class name</b><span class=special>&</span> <span class=identifier>x</span><span class=special>,</span><span class=identifier>Compare</span> <span class=identifier>comp</span><span class=special>);</span> | |
307 | ||
308 | <span class=keyword>void</span> <span class=identifier>sort</span><span class=special>();</span> | |
309 | <span class=keyword>template</span> <span class=special><</span><span class=keyword>typename</span> <span class=identifier>Compare</span><span class=special>></span> <span class=keyword>void</span> <span class=identifier>sort</span><span class=special>(</span><span class=identifier>Compare</span> <span class=identifier>comp</span><span class=special>);</span> | |
310 | ||
311 | <span class=keyword>void</span> <span class=identifier>reverse</span><span class=special>()</span><span class=keyword>noexcept</span><span class=special>;</span> | |
312 | ||
313 | <span class=comment>// rearrange operations:</span> | |
314 | ||
315 | <span class=keyword>void</span> <span class=identifier>relocate</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=identifier>iterator</span> <span class=identifier>i</span><span class=special>);</span> | |
316 | <span class=keyword>void</span> <span class=identifier>relocate</span><span class=special>(</span><span class=identifier>iterator</span> <span class=identifier>position</span><span class=special>,</span><span class=identifier>iterator</span> <span class=identifier>first</span><span class=special>,</span><span class=identifier>iterator</span> <span class=identifier>last</span><span class=special>);</span> | |
317 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>InputIterator</span><span class=special>></span> <span class=keyword>void</span> <span class=identifier>rearrange</span><span class=special>(</span><span class=identifier>InputIterator</span> <span class=identifier>first</span><span class=special>);</span> | |
318 | <span class=special>}</span> | |
319 | ||
320 | <span class=comment>// index comparison:</span> | |
321 | ||
322 | <span class=keyword>template</span><span class=special><</span><b>arg set 1</b><span class=special>,</span><b>arg set 2</b><span class=special>></span> | |
323 | <span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>==(</span> | |
324 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 1</b><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span> | |
325 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 2</b><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span> | |
326 | <span class=special>{</span> | |
327 | <span class=keyword>return</span> <span class=identifier>x</span><span class=special>.</span><span class=identifier>size</span><span class=special>()==</span><span class=identifier>y</span><span class=special>.</span><span class=identifier>size</span><span class=special>()&&</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>equal</span><span class=special>(</span><span class=identifier>x</span><span class=special>.</span><span class=identifier>begin</span><span class=special>(),</span><span class=identifier>x</span><span class=special>.</span><span class=identifier>end</span><span class=special>(),</span><span class=identifier>y</span><span class=special>.</span><span class=identifier>begin</span><span class=special>());</span> | |
328 | <span class=special>}</span> | |
329 | ||
330 | <span class=keyword>template</span><span class=special><</span><b>arg set 1</b><span class=special>,</span><b>arg set 2</b><span class=special>></span> | |
331 | <span class=keyword>bool</span> <span class=keyword>operator</span><span class=special><(</span> | |
332 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 1</b><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span> | |
333 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 2</b><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span> | |
334 | <span class=special>{</span> | |
335 | <span class=keyword>return</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>lexicographical_compare</span><span class=special>(</span><span class=identifier>x</span><span class=special>.</span><span class=identifier>begin</span><span class=special>(),</span><span class=identifier>x</span><span class=special>.</span><span class=identifier>end</span><span class=special>(),</span><span class=identifier>y</span><span class=special>.</span><span class=identifier>begin</span><span class=special>(),</span><span class=identifier>y</span><span class=special>.</span><span class=identifier>end</span><span class=special>());</span> | |
336 | <span class=special>}</span> | |
337 | ||
338 | <span class=keyword>template</span><span class=special><</span><b>arg set 1</b><span class=special>,</span><b>arg set 2</b><span class=special>></span> | |
339 | <span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>!=(</span> | |
340 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 1</b><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span> | |
341 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 2</b><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span> | |
342 | <span class=special>{</span> | |
343 | <span class=keyword>return</span> <span class=special>!(</span><span class=identifier>x</span><span class=special>==</span><span class=identifier>y</span><span class=special>);</span> | |
344 | <span class=special>}</span> | |
345 | ||
346 | <span class=keyword>template</span><span class=special><</span><b>arg set 1</b><span class=special>,</span><b>arg set 2</b><span class=special>></span> | |
347 | <span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>>(</span> | |
348 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 1</b><span class=special>>&</span> <span class=identifier>x</span> | |
349 | <span class=special>,</span><span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 2</b><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span> | |
350 | <span class=special>{</span> | |
351 | <span class=keyword>return</span> <span class=identifier>y</span><span class=special><</span><span class=identifier>x</span><span class=special>;</span> | |
352 | <span class=special>}</span> | |
353 | ||
354 | <span class=keyword>template</span><span class=special><</span><b>arg set 1</b><span class=special>,</span><b>arg set 2</b><span class=special>></span> | |
355 | <span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>>=(</span> | |
356 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 1</b><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span> | |
357 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 2</b><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span> | |
358 | <span class=special>{</span> | |
359 | <span class=keyword>return</span> <span class=special>!(</span><span class=identifier>x</span><span class=special><</span><span class=identifier>y</span><span class=special>);</span> | |
360 | <span class=special>}</span> | |
361 | ||
362 | <span class=keyword>template</span><span class=special><</span><b>arg set 1</b><span class=special>,</span><b>arg set 2</b><span class=special>></span> | |
363 | <span class=keyword>bool</span> <span class=keyword>operator</span><span class=special><=(</span> | |
364 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 1</b><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span> | |
365 | <span class=keyword>const</span> <b>index class name</b><span class=special><</span><b>arg set 2</b><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span> | |
366 | <span class=special>{</span> | |
367 | <span class=keyword>return</span> <span class=special>!(</span><span class=identifier>x</span><span class=special>></span><span class=identifier>y</span><span class=special>);</span> | |
368 | <span class=special>}</span> | |
369 | ||
370 | <span class=comment>// index specialized algorithms:</span> | |
371 | ||
372 | <span class=keyword>template</span><span class=special><</span><b>implementation defined</b><span class=special>></span> | |
373 | <span class=keyword>void</span> <span class=identifier>swap</span><span class=special>(</span><b>index class name</b><span class=special>&</span> <span class=identifier>x</span><span class=special>,</span><b>index class name</b><span class=special>&</span> <span class=identifier>y</span><span class=special>);</span> | |
374 | ||
375 | <span class=special>}</span> <span class=comment>// namespace boost::multi_index::detail</span> | |
376 | ||
377 | <span class=special>}</span> <span class=comment>// namespace boost::multi_index</span> | |
378 | ||
379 | <span class=special>}</span> <span class=comment>// namespace boost</span> | |
380 | </pre></blockquote> | |
381 | ||
382 | <h4><a name="complexity_signature">Complexity signature</a></h4> | |
383 | ||
384 | <p> | |
385 | Here and in the descriptions of operations of sequenced indices, we adopt the | |
386 | scheme outlined in the | |
387 | <a href="indices.html#complexity_signature">complexity signature | |
388 | section</a>. The complexity signature of sequenced indices is: | |
389 | <ul> | |
390 | <li>copying: <code>c(n)=n*log(n)</code>,</li> | |
391 | <li>insertion: <code>i(n)=1</code> (constant),</li> | |
392 | <li>hinted insertion: <code>h(n)=1</code> (constant),</li> | |
393 | <li>deletion: <code>d(n)=1</code> (constant),</li> | |
394 | <li>replacement: <code>r(n)=1</code> (constant),</li> | |
395 | <li>modifying: <code>m(n)=1</code> (constant).</li> | |
396 | </ul> | |
397 | </p> | |
398 | ||
399 | <h4><a name="instantiation_types">Instantiation types</a></h4> | |
400 | ||
401 | <p>Sequenced indices are instantiated internally to <code>multi_index_container</code> | |
402 | and specified by means of <a href="indices.html#indexed_by"> | |
403 | <code>indexed_by</code></a> with the <a href="#sequenced"><code>sequenced</code></a> | |
404 | index specifier. Instantiations are dependent on the following types: | |
405 | <ul> | |
406 | <li><code>Value</code> from <code>multi_index_container</code>,</li> | |
407 | <li><code>Allocator</code> from <code>multi_index_container</code>,</li> | |
408 | <li><code>TagList</code> from the index specifier (if provided, otherwise <code>tag<></code> is assumed).</li> | |
409 | </ul> | |
410 | <code>TagList</code> must be an instantiation of | |
411 | <a href="indices.html#tag"><code>tag</code></a>. | |
412 | </p> | |
413 | ||
414 | <h4><a name="constructors">Constructors, copy and assignment</a></h4> | |
415 | ||
416 | <p> | |
417 | As explained in the <a href="indices.html#index_concepts">index | |
418 | concepts section</a>, indices do not have public constructors or destructors. | |
419 | Assignment, on the other hand, is provided. | |
420 | </p> | |
421 | ||
422 | <code><b>index class name</b>& operator=(const <b>index class name</b>& x);</code> | |
423 | ||
424 | <blockquote> | |
425 | <b>Effects:</b> | |
426 | <blockquote><pre> | |
427 | <span class=identifier>a</span><span class=special>=</span><span class=identifier>b</span><span class=special>;</span> | |
428 | </pre></blockquote> | |
429 | where <code>a</code> and <code>b</code> are the <code>multi_index_container</code> | |
430 | objects to which <code>*this</code> and <code>x</code> belong, respectively.<br> | |
431 | <b>Returns:</b> <code>*this</code>.<br> | |
432 | </blockquote> | |
433 | ||
434 | <code><b>index class name</b>& operator=(std::initializer_list<value_type> list);</code> | |
435 | ||
436 | <blockquote> | |
437 | <b>Effects:</b> | |
438 | <blockquote><pre> | |
439 | <span class=identifier>a</span><span class=special>=</span><span class=identifier>list</span><span class=special>;</span> | |
440 | </pre></blockquote> | |
441 | where <code>a</code> is the <code>multi_index_container</code> | |
442 | object to which <code>*this</code> belongs.<br> | |
443 | <b>Returns:</b> <code>*this</code>.<br> | |
444 | </blockquote> | |
445 | ||
446 | <code>template <class InputIterator><br> | |
447 | void assign(InputIterator first,InputIterator last);</code> | |
448 | ||
449 | <blockquote> | |
450 | <b>Effects:</b> | |
451 | <blockquote><pre> | |
452 | <span class=identifier>clear</span><span class=special>();</span> | |
453 | <span class=identifier>insert</span><span class=special>(</span><span class=identifier>end</span><span class=special>(),</span><span class=identifier>first</span><span class=special>,</span><span class=identifier>last</span><span class=special>);</span> | |
454 | </pre></blockquote> | |
455 | </blockquote> | |
456 | ||
457 | <code>void assign(std::initializer_list<value_type> list);</code> | |
458 | ||
459 | <blockquote> | |
460 | <b>Effects:</b> | |
461 | <blockquote><pre> | |
462 | <span class=identifier>assign</span><span class=special>(</span><span class=identifier>list</span><span class=special>.</span><span class=identifier>begin</span><span class=special>(),</span><span class=identifier>list</span><span class=special>.</span><span class=identifier>end</span><span class=special>());</span> | |
463 | </pre></blockquote> | |
464 | </blockquote> | |
465 | ||
466 | <code>void assign(size_type n,const value_type& value);</code> | |
467 | ||
468 | <blockquote> | |
469 | <b>Effects:</b> | |
470 | <blockquote><pre> | |
471 | <span class=identifier>clear</span><span class=special>();</span> | |
472 | <span class=keyword>for</span><span class=special>(</span><span class=identifier>size_type</span> <span class=identifier>i</span><span class=special>=</span><span class=number>0</span><span class=special>;</span><span class=identifier>i</span><span class=special><</span><span class=identifier>n</span><span class=special>;++</span><span class=identifier>n</span><span class=special>)</span><span class=identifier>push_back</span><span class=special>(</span><span class=identifier>v</span><span class=special>);</span> | |
473 | </pre></blockquote> | |
474 | </blockquote> | |
475 | ||
476 | <h4><a name="iterators">Iterators</a></h4> | |
477 | ||
478 | <code>iterator iterator_to(const value_type& x);<br> | |
479 | const_iterator iterator_to(const value_type& x)const;</code> | |
480 | ||
481 | <blockquote> | |
482 | <b>Requires:</b> <code>x</code> is a reference to an element of the container.<br> | |
483 | <b>Returns:</b> An iterator to <code>x</code>.<br> | |
484 | <b>Complexity:</b> Constant.<br> | |
485 | <b>Exception safety:</b> <code>nothrow</code>.<br> | |
486 | </blockquote> | |
487 | ||
488 | <h4><a name="capacity">Capacity operations</a></h4> | |
489 | ||
490 | <code>void resize(size_type n);<br> | |
491 | void resize(size_type n,const value_type& x);</code> | |
492 | ||
493 | <blockquote> | |
494 | <b>Requires (first version):</b> <code>value_type</code> is <code>DefaultInsertable</code> | |
495 | into <code>multi_index_container</code>.<br> | |
496 | <b>Requires (second version):</b> <code>value_type</code> is <code>CopyInsertable</code> | |
497 | into <code>multi_index_container</code>.<br> | |
498 | <b>Effects:</b> If <code>size()<n</code>, tries to append <code>n-size()</code> default-inserted | |
499 | elements (first version) or copies of <code>x</code> (second version) at the end of | |
500 | the index. If <code>n<size()</code>, erases the last <code>size()-n</code> elements.<br> | |
501 | <b>Note:</b> If an expansion is requested, the size of the index is not guaranteed | |
502 | to be <code>n</code> after this operation (other indices may ban insertions.) | |
503 | </blockquote> | |
504 | ||
505 | <h4><a name="modifiers">Modifiers</a></h4> | |
506 | ||
507 | <code>template<typename... Args><br> | |
508 | std::pair<iterator,bool> emplace_front(Args&&... args);</code> | |
509 | ||
510 | <blockquote> | |
511 | <b>Effects:</b> | |
512 | <blockquote><pre> | |
513 | <span class=identifier>emplace</span><span class=special>(</span><span class=identifier>begin</span><span class=special>(),</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>forward</span><span class=special><</span><span class=identifier>Args</span><span class=special>>(</span><span class=identifier>args</span><span class=special>)...);</span> | |
514 | </pre></blockquote> | |
515 | <b>Returns:</b> The return value is a pair <code>p</code>. <code>p.second</code> | |
516 | is <code>true</code> if and only if insertion took place. On successful | |
517 | insertion, <code>p.first</code> points to the element inserted; otherwise, | |
518 | <code>p.first</code> points to an element that caused the insertion to be banned. | |
519 | Note that more than one element can be causing insertion not to be allowed.<br> | |
520 | </blockquote> | |
521 | ||
522 | <code>std::pair<iterator,bool> push_front(const value_type& x);</code><br> | |
523 | <code>std::pair<iterator,bool> push_front(value_type&& x);</code> | |
524 | ||
525 | <blockquote> | |
526 | <b>Effects:</b> | |
527 | <blockquote><pre> | |
528 | <span class=identifier>insert</span><span class=special>(</span><span class=identifier>begin</span><span class=special>(),</span><span class=identifier>x</span><span class=special>);</span> <span class=comment>// lvalue ref version</span> | |
529 | <span class=identifier>insert</span><span class=special>(</span><span class=identifier>begin</span><span class=special>(),</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>move</span><span class=special>(</span><span class=identifier>x</span><span class=special>));</span> <span class=comment>// rvalue ref version</span> | |
530 | </pre></blockquote> | |
531 | <b>Returns:</b> The return value is a pair <code>p</code>. <code>p.second</code> | |
532 | is <code>true</code> if and only if insertion took place. On successful | |
533 | insertion, <code>p.first</code> points to the element inserted; otherwise, | |
534 | <code>p.first</code> points to an element that caused the insertion to be banned. | |
535 | Note that more than one element can be causing insertion not to be allowed.<br> | |
536 | </blockquote> | |
537 | ||
538 | <code>template<typename... Args><br> | |
539 | std::pair<iterator,bool> emplace_back(Args&&... args);</code> | |
540 | ||
541 | <blockquote> | |
542 | <b>Effects:</b> | |
543 | <blockquote><pre> | |
544 | <span class=identifier>emplace</span><span class=special>(</span><span class=identifier>end</span><span class=special>(),</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>forward</span><span class=special><</span><span class=identifier>Args</span><span class=special>>(</span><span class=identifier>args</span><span class=special>)...);</span> | |
545 | </pre></blockquote> | |
546 | <b>Returns:</b> The return value is a pair <code>p</code>. <code>p.second</code> | |
547 | is <code>true</code> if and only if insertion took place. On successful | |
548 | insertion, <code>p.first</code> points to the element inserted; otherwise, | |
549 | <code>p.first</code> points to an element that caused the insertion to be banned. | |
550 | Note that more than one element can be causing insertion not to be allowed.<br> | |
551 | </blockquote> | |
552 | ||
553 | <code>std::pair<iterator,bool> push_back(const value_type& x);</code><br> | |
554 | <code>std::pair<iterator,bool> push_back(value_type&& x);</code> | |
555 | ||
556 | <blockquote> | |
557 | <b>Effects:</b> | |
558 | <blockquote><pre> | |
559 | <span class=identifier>insert</span><span class=special>(</span><span class=identifier>end</span><span class=special>(),</span><span class=identifier>x</span><span class=special>);</span> <span class=comment>// lvalue ref version</span> | |
560 | <span class=identifier>insert</span><span class=special>(</span><span class=identifier>end</span><span class=special>(),</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>move</span><span class=special>(</span><span class=identifier>x</span><span class=special>));</span> <span class=comment>// rvalue ref version</span> | |
561 | </pre></blockquote> | |
562 | <b>Returns:</b> The return value is a pair <code>p</code>. <code>p.second</code> | |
563 | is <code>true</code> if and only if insertion took place. On successful | |
564 | insertion, <code>p.first</code> points to the element inserted; otherwise, | |
565 | <code>p.first</code> points to an element that caused the insertion to be banned. | |
566 | Note that more than one element can be causing insertion not to be allowed.<br> | |
567 | </blockquote> | |
568 | ||
569 | <code>template<typename... Args><br> | |
570 | std::pair<iterator,bool> emplace(iterator position,Args&&... args);</code> | |
571 | ||
572 | <blockquote> | |
573 | <b>Requires:</b> <code>value_type</code> is <code>EmplaceConstructible</code> | |
574 | into <code>multi_index_container</code> from <code>args</code>.<br> | |
575 | <b>Effects:</b> Inserts a <code>value_type</code> object constructed with | |
576 | <code>std::forward<Args>(args)...</code> before <code>position</code> if insertion | |
577 | is allowed by all other indices of the <code>multi_index_container</code>.<br> | |
578 | <b>Returns:</b> The return value is a pair <code>p</code>. <code>p.second</code> | |
579 | is <code>true</code> if and only if insertion took place. On successful insertion, | |
580 | <code>p.first</code> points to the element inserted; otherwise, <code>p.first</code> | |
581 | points to an element that caused the insertion to be banned. Note that more than | |
582 | one element can be causing insertion not to be allowed.<br> | |
583 | <b>Complexity:</b> <code>O(I(n))</code>.<br> | |
584 | <b>Exception safety:</b> Strong.<br> | |
585 | </blockquote> | |
586 | ||
587 | <code>std::pair<iterator,bool> insert(iterator position,const value_type& x);</code><br> | |
588 | <code>std::pair<iterator,bool> insert(iterator position,value_type&& x);</code> | |
589 | ||
590 | <blockquote> | |
591 | <b>Requires (first version):</b> <code>value_type</code> is <code>CopyInsertable</code> | |
592 | into <code>multi_index_container</code>. | |
593 | <code>position</code> is a valid iterator of the index.<br> | |
594 | <b>Requires (second version):</b> <code>value_type</code> is <code>MoveInsertable</code> | |
595 | into <code>multi_index_container</code>. | |
596 | <code>position</code> is a valid iterator of the index.<br> | |
597 | <b>Effects:</b> Inserts <code>x</code> before <code>position</code> if insertion | |
598 | is allowed by all other indices of the <code>multi_index_container</code>.<br> | |
599 | <b>Returns:</b> The return value is a pair <code>p</code>. <code>p.second</code> | |
600 | is <code>true</code> if and only if insertion took place. On successful | |
601 | insertion, <code>p.first</code> points to the element inserted; otherwise, | |
602 | <code>p.first</code> points to an element that caused the insertion to be banned. | |
603 | Note that more than one element can be causing insertion not to be allowed.<br> | |
604 | <b>Complexity:</b> <code>O(I(n))</code>.<br> | |
605 | <b>Exception safety:</b> Strong. | |
606 | </blockquote> | |
607 | ||
608 | <code>void insert(iterator position,size_type n,const value_type& x);</code> | |
609 | ||
610 | <blockquote> | |
611 | <b>Effects:</b> | |
612 | <blockquote><pre> | |
613 | <span class=keyword>for</span><span class=special>(</span><span class=identifier>size_type</span> <span class=identifier>i</span><span class=special>=</span><span class=number>0</span><span class=special>;</span><span class=identifier>i</span><span class=special><</span><span class=identifier>n</span><span class=special>;++</span><span class=identifier>i</span><span class=special>)</span><span class=identifier>insert</span><span class=special>(</span><span class=identifier>position</span><span class=special>,</span><span class=identifier>x</span><span class=special>);</span> | |
614 | </pre></blockquote> | |
615 | </blockquote> | |
616 | ||
617 | <code>template<typename InputIterator><br> | |
618 | void insert(iterator position,InputIterator first,InputIterator last);</code> | |
619 | ||
620 | <blockquote> | |
621 | <b>Requires:</b> <code>position</code> is a valid iterator of the index. | |
622 | <code>InputIterator</code> is an input iterator. | |
623 | <code>value_type</code> is | |
624 | <code>EmplaceConstructible</code> into | |
625 | <code>multi_index_container</code> from <code>*first</code>. | |
626 | <code>first</code> and <code>last</code> are not iterators into any | |
627 | index of the <code>multi_index_container</code> to which this index belongs. | |
628 | <code>last</code> is reachable from <code>first</code>.<br> | |
629 | <b>Effects:</b> | |
630 | For each element of [<code>first</code>, <code>last</code>), in this | |
631 | order, inserts it before <code>position</code> if insertion is allowed by all | |
632 | other indices of the <code>multi_index_container</code>.<br> | |
633 | <b>Complexity:</b> <code>O(m*I(n+m))</code>, where <code>m</code> is the | |
634 | number of elements in [<code>first</code>,<code>last</code>).<br> | |
635 | <b>Exception safety:</b> Basic. | |
636 | </blockquote> | |
637 | ||
638 | <code>void insert(iterator position,std::initializer_list<value_type> list);</code> | |
639 | ||
640 | <blockquote> | |
641 | <b>Effects:</b> | |
642 | <blockquote><pre> | |
643 | <span class=identifier>insert</span><span class=special>(</span><span class=identifier>position</span><span class=special>,</span><span class=identifier>list</span><span class=special>.</span><span class=identifier>begin</span><span class=special>(),</span><span class=identifier>list</span><span class=special>.</span><span class=identifier>end</span><span class=special>());</span> | |
644 | </pre></blockquote> | |
645 | </blockquote> | |
646 | ||
647 | <code>iterator erase(iterator position);</code> | |
648 | ||
649 | <blockquote> | |
650 | <b>Requires:</b> <code>position</code> is a valid dereferenceable iterator | |
651 | of the index.<br> | |
652 | <b>Effects:</b> Deletes the element pointed to by <code>position</code>.<br> | |
653 | <b>Returns:</b> An iterator pointing to the element immediately following | |
654 | the one that was deleted, or <code>end()</code> | |
655 | if no such element exists.<br> | |
656 | <b>Complexity:</b> <code>O(D(n))</code>.<br> | |
657 | <b>Exception safety:</b> <code>nothrow</code>.<br> | |
658 | </blockquote> | |
659 | ||
660 | <code>iterator erase(iterator first,iterator last);</code> | |
661 | ||
662 | <blockquote> | |
663 | <b>Requires:</b> [<code>first</code>,<code>last</code>) is a valid | |
664 | range of the index.<br> | |
665 | <b>Effects:</b> Deletes the elements in [<code>first</code>,<code>last</code>).<br> | |
666 | <b>Returns:</b> <code>last</code>.<br> | |
667 | <b>Complexity:</b> <code>O(m*D(n))</code>, where <code>m</code> is | |
668 | the number of elements in [<code>first</code>,<code>last</code>).<br> | |
669 | <b>Exception safety:</b> <code>nothrow</code>.<br> | |
670 | </blockquote> | |
671 | ||
672 | <a name="replace"><code>bool replace(iterator position,const value_type& x);</code></a><br> | |
673 | <code>bool replace(iterator position,value_type&& x);</code> | |
674 | ||
675 | <blockquote> | |
676 | <b>Requires (first version):</b> <code>value_type</code> is <code>CopyAssignable</code>. | |
677 | <code>position</code> is a valid dereferenceable iterator of the index.<br> | |
678 | <b>Requires (second version):</b> <code>value_type</code> is <code>MoveAssignable</code>. | |
679 | <code>position</code> is a valid dereferenceable iterator of the index.<br> | |
680 | <b>Effects:</b> Assigns the value <code>x</code> to the element pointed | |
681 | to by <code>position</code> into the <code>multi_index_container</code> to which | |
682 | the index belongs if replacing is allowed by all other indices of the | |
683 | <code>multi_index_container</code>.<br> | |
684 | <b>Postconditions:</b> Validity of <code>position</code> is preserved | |
685 | in all cases.<br> | |
686 | <b>Returns:</b> <code>true</code> if the replacement took place, | |
687 | <code>false</code> otherwise.<br> | |
688 | <b>Complexity:</b> <code>O(R(n))</code>.<br> | |
689 | <b>Exception safety:</b> Strong. If an exception is thrown by some | |
690 | user-provided operation the <code>multi_index_container</code> to which the index | |
691 | belongs remains in its original state. | |
692 | </blockquote> | |
693 | ||
694 | <a name="modify"> | |
695 | <code>template<typename Modifier> bool modify(iterator position,Modifier mod);</code></a> | |
696 | ||
697 | <blockquote> | |
698 | <b>Requires:</b> <code>mod</code> is a unary function object | |
699 | accepting arguments of type | |
700 | <code>value_type&</code>. <code>position</code> is a valid dereferenceable | |
701 | iterator of the index. | |
702 | The execution of <code>mod(e)</code>, where <code>e</code> is the element | |
703 | pointed to by <code>position</code>, does not invoke any operation of the | |
704 | <code>multi_index_container</code> after <code>e</code> is directly modified | |
705 | or, before modification, if the operation would invalidate <code>position</code>.<br> | |
706 | <b>Effects:</b> Calls <code>mod(e)</code> where <code>e</code> is the element | |
707 | pointed to by <code>position</code> and rearranges <code>*position</code> into | |
708 | all the indices of the <code>multi_index_container</code>. Rearrangement on sequenced | |
709 | indices does not change the position of the element with respect to the index; | |
710 | rearrangement on other indices may or might not succeed. If the rearrangement | |
711 | fails, the element is erased.<br> | |
712 | <b>Postconditions:</b> Validity of <code>position</code> is preserved if the | |
713 | operation succeeds.<br> | |
714 | <b>Returns:</b> <code>true</code> if the operation succeeded, <code>false</code> | |
715 | otherwise.<br> | |
716 | <b>Complexity:</b> <code>O(M(n))</code>.<br> | |
717 | <b>Exception safety:</b> Basic. If an exception is thrown by some | |
718 | user-provided operation (except possibly <code>mod</code>), then | |
719 | the element pointed to by <code>position</code> is erased. | |
720 | </blockquote> | |
721 | ||
722 | <code>template<typename Modifier,typename Rollback><br> | |
723 | bool modify(iterator position,Modifier mod,Rollback back);</code> | |
724 | ||
725 | <blockquote> | |
726 | <b>Requires:</b> <code>mod</code> and <code>back</code> are unary function | |
727 | objects accepting arguments of type | |
728 | <code>value_type&</code>. <code>position</code> is a valid dereferenceable | |
729 | iterator of the index. | |
730 | The execution of <code>mod(e)</code>, where <code>e</code> is the element | |
731 | pointed to by <code>position</code>, does not invoke any operation of the | |
732 | <code>multi_index_container</code> after <code>e</code> is directly modified | |
733 | or, before modification, if the operation would invalidate <code>position</code>. | |
734 | <code>back(e)</code> does not invoke any operation of the | |
735 | <code>multi_index_container</code>. | |
736 | The sequence of operations <code>mod(e)</code>, | |
737 | <code>back(e)</code> restores all keys of the element | |
738 | to their original state.<br> | |
739 | <b>Effects:</b> Calls <code>mod(e)</code> where <code>e</code> is the element | |
740 | pointed to by <code>position</code> and tries to rearrange <code>*position</code> into | |
741 | all the indices of the <code>multi_index_container</code>. Rearrangement on sequenced | |
742 | indices does not change the position of the element with respect to the index; | |
743 | rearrangement on other indices may or might not succeed. If the rearrangement | |
744 | fails, <code>back(e)</code> is invoked and the | |
745 | element is kept at its original position in all indices.<br> | |
746 | <b>Postconditions:</b> Validity of <code>position</code> is preserved except if | |
747 | the element is erased under the conditions described below.<br> | |
748 | <b>Returns:</b> <code>true</code> if the operation succeeded, <code>false</code> | |
749 | otherwise.<br> | |
750 | <b>Complexity:</b> <code>O(M(n))</code>.<br> | |
751 | <b>Exception safety:</b> Strong, except if <code>back</code> throws an | |
752 | exception, in which case the modified element is erased. If <code>back</code> | |
753 | throws inside the handling code executing after some other user-provided | |
754 | operation has thrown, it is the exception generated by <code>back</code> that | |
755 | is rethrown. | |
756 | </blockquote> | |
757 | ||
758 | <h4><a name="list_operations">List operations</a></h4> | |
759 | ||
760 | <p> | |
761 | Sequenced indices provide the full set of list operations found in | |
762 | <code>std::list</code>; the semantics of these member functions, however, | |
763 | differ from that of <code>std::list</code> in some cases as insertions | |
764 | might not succeed due to banning by other indices. Similarly, the complexity | |
765 | of the operations may depend on the other indices belonging to the | |
766 | same <code>multi_index_container</code>. | |
767 | </p> | |
768 | ||
769 | <code>void splice(iterator position,<b>index class name</b>& x);</code> | |
770 | ||
771 | <blockquote> | |
772 | <b>Requires:</b> <code>position</code> is a valid iterator of the index. | |
773 | <code>&x!=this</code>.<br> | |
774 | <b>Effects:</b> Inserts the contents of <code>x</code> before <code>position</code>, | |
775 | in the same order as they were in <code>x</code>. Those elements successfully | |
776 | inserted are erased from <code>x</code>.<br> | |
777 | <b>Complexity:</b> <code>O(x.size()*I(n+x.size()) + x.size()*D(x.size()))</code>.<br> | |
778 | <b>Exception safety:</b> Basic.<br> | |
779 | </blockquote> | |
780 | ||
781 | <code>void splice(iterator position,<b>index class name</b>& x,iterator i);</code> | |
782 | ||
783 | <blockquote> | |
784 | <b>Requires:</b> <code>position</code> is a valid iterator of the index. | |
785 | <code>i</code> is a valid dereferenceable iterator <code>x</code>.<br> | |
786 | <b>Effects:</b> Inserts the element pointed to by <code>i</code> before | |
787 | <code>position</code>: if insertion is successful, the element is erased from | |
788 | <code>x</code>. In the special case <code>&x==this</code>, no copy or | |
789 | deletion is performed, and the operation is always successful. If | |
790 | <code>position==i</code>, no operation is performed.<br> | |
791 | <b>Postconditions:</b> If <code>&x==this</code>, no iterator or reference | |
792 | is invalidated.<br> | |
793 | <b>Complexity:</b> If <code>&x==this</code>, constant; otherwise | |
794 | <code>O(I(n) + D(n))</code>.<br> | |
795 | <b>Exception safety:</b> If <code>&x==this</code>, <code>nothrow</code>; | |
796 | otherwise, strong.<br> | |
797 | </blockquote> | |
798 | ||
799 | <code>void splice(iterator position,<b>index class name&</b> x,iterator first,iterator last);</code> | |
800 | ||
801 | <blockquote> | |
802 | <b>Requires:</b> <code>position</code> is a valid iterator of the index. | |
803 | <code>first</code> and <code>last</code> are valid iterators of <code>x</code>. | |
804 | <code>last</code> is reachable from <code>first</code>. <code>position</code> | |
805 | is not in the range [<code>first</code>,<code>last</code>).<br> | |
806 | <b>Effects:</b> For each element in the range [<code>first</code>,<code>last</code>), | |
807 | insertion is tried before <code>position</code>; if the operation is successful, | |
808 | the element is erased from <code>x</code>. In the special case | |
809 | <code>&x==this</code>, no copy or deletion is performed, and insertions are | |
810 | always successful.<br> | |
811 | <b>Postconditions:</b> If <code>&x==this</code>, no iterator or reference | |
812 | is invalidated.<br> | |
813 | <b>Complexity:</b> If <code>&x==this</code>, constant; otherwise | |
814 | <code>O(m*I(n+m) + m*D(x.size()))</code> where <code>m</code> is the number | |
815 | of elements in [<code>first</code>,<code>last</code>).<br> | |
816 | <b>Exception safety:</b> If <code>&x==this</code>, <code>nothrow</code>; | |
817 | otherwise, basic.<br> | |
818 | </blockquote> | |
819 | ||
820 | <code>void remove(const value_type& value);</code> | |
821 | ||
822 | <blockquote> | |
823 | <b>Effects:</b> Erases all elements of the index which compare equal to | |
824 | <code>value</code>.<br> | |
825 | <b>Complexity:</b> <code>O(n + m*D(n))</code>, where <code>m</code> | |
826 | is the number of elements erased.<br> | |
827 | <b>Exception safety:</b> Basic. | |
828 | </blockquote> | |
829 | ||
830 | <code>template<typename Predicate> void remove_if(Predicate pred);</code> | |
831 | ||
832 | <blockquote> | |
833 | <b>Effects:</b> Erases all elements <code>x</code> of the index for which | |
834 | <code>pred(x)</code> holds.<br> | |
835 | <b>Complexity:</b> <code>O(n + m*D(n))</code>, where <code>m</code> | |
836 | is the number of elements erased.<br> | |
837 | <b>Exception safety:</b> Basic. | |
838 | </blockquote> | |
839 | ||
840 | <code>void unique();</code> | |
841 | ||
842 | <blockquote> | |
843 | <b>Effects:</b> Eliminates all but the first element from every consecutive | |
844 | group of equal elements referred to by the iterator <code>i</code> in the range | |
845 | [<code>first+1</code>,<code>last</code>) for which <code>*i==*(i-1)</code>.<br> | |
846 | <b>Complexity:</b> <code>O(n + m*D(n))</code>, where <code>m</code> | |
847 | is the number of elements erased.<br> | |
848 | <b>Exception safety:</b> Basic. | |
849 | </blockquote> | |
850 | ||
851 | <code>template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);</code> | |
852 | ||
853 | <blockquote> | |
854 | <b>Effects:</b> Eliminates all but the first element from every consecutive | |
855 | group of elements referred to by the iterator <code>i</code> in the range | |
856 | [<code>first+1</code>,<code>last</code>) for which | |
857 | <code>binary_pred(*i,*(i-1))</code> holds.<br> | |
858 | <b>Complexity:</b> <code>O(n + m*D(n))</code>, where <code>m</code> | |
859 | is the number of elements erased.<br> | |
860 | <b>Exception safety:</b> Basic. | |
861 | </blockquote> | |
862 | ||
863 | <code>void merge(index class name& x);</code> | |
864 | ||
865 | <blockquote> | |
866 | <b>Requires:</b> <code>std::less<value_type></code> induces a | |
867 | strict weak ordering over <code>value_type</code>. | |
868 | Both the index and <code>x</code> are sorted according to | |
869 | <code>std::less<value_type></code>.<br> | |
870 | <b>Effects:</b> Attempts to insert every element of <code>x</code> into the | |
871 | corresponding position of the index (according to the order). Elements | |
872 | successfully inserted are erased from <code>x</code>. The resulting sequence | |
873 | is stable, i.e. equivalent elements of either container preserve their | |
874 | relative position. In the special case <code>&x==this</code>, no operation | |
875 | is performed.<br> | |
876 | <b>Postconditions:</b> Elements in the index and remaining elements in | |
877 | <code>x</code> are sorted. | |
878 | Validity of iterators to the index and of non-erased elements of <code>x</code> | |
879 | references is preserved.<br> | |
880 | <b>Complexity:</b> If <code>&x==this</code>, constant; otherwise | |
881 | <code>O(n + x.size()*I(n+x.size()) + x.size()*D(x.size()))</code>.<br> | |
882 | <b>Exception safety:</b> If <code>&x==this</code>, <code>nothrow</code>; | |
883 | otherwise, basic.<br> | |
884 | </blockquote> | |
885 | ||
886 | <code>template <typename Compare> void merge(index class name& x,Compare comp);</code> | |
887 | ||
888 | <blockquote> | |
889 | <b>Requires:</b> <code>Compare</code> induces a | |
890 | strict weak ordering over <code>value_type</code>. | |
891 | Both the index and <code>x</code> are sorted according to <code>comp</code>.<br> | |
892 | <b>Effects:</b> Attempts to insert every element of <code>x</code> into the | |
893 | corresponding position of the index (according to <code>comp</code>). | |
894 | Elements successfully inserted are erased from <code>x</code>. The resulting | |
895 | sequence is stable, i.e. equivalent elements of either container preserve | |
896 | their relative position. In the special case <code>&x==this</code>, no | |
897 | operation is performed.<br> | |
898 | <b>Postconditions:</b> Elements in the index and remaining elements in | |
899 | <code>x</code> are sorted according to <code>comp</code>. | |
900 | Validity of iterators to the index and of non-erased elements of <code>x</code> | |
901 | references is preserved.<br> | |
902 | <b>Complexity:</b> If <code>&x==this</code>, constant; otherwise | |
903 | <code>O(n + x.size()*I(n+x.size()) + x.size()*D(x.size()))</code>.<br> | |
904 | <b>Exception safety:</b> If <code>&x==this</code>, <code>nothrow</code>; | |
905 | otherwise, basic.<br> | |
906 | </blockquote> | |
907 | ||
908 | <code>void sort();</code> | |
909 | ||
910 | <blockquote> | |
911 | <b>Requires:</b> <code>std::less<value_type></code> induces a | |
912 | strict weark ordering over <code>value_type</code>.<br> | |
913 | <b>Effects:</b> Sorts the index according to | |
914 | <code>std::less<value_type></code>. The sorting is stable, i.e. | |
915 | equivalent elements preserve their relative position.<br> | |
916 | <b>Postconditions:</b> Validity of iterators and references is preserved.<br> | |
917 | <b>Complexity:</b> <code>O(n*log(n))</code>.<br> | |
918 | <b>Exception safety:</b> <code>nothrow</code> if | |
919 | <code>std::less<value_type></code> does not throw; otherwise, basic. | |
920 | </blockquote> | |
921 | ||
922 | <code>template <typename Compare> void sort(Compare comp);</code> | |
923 | ||
924 | <blockquote> | |
925 | <b>Requires:</b> <code>Compare</code> induces a | |
926 | strict weak ordering over <code>value_type</code>.<br> | |
927 | <b>Effects:</b> Sorts the index according to <code>comp</code>. The sorting | |
928 | is stable, i.e. equivalent elements preserve their relative position.<br> | |
929 | <b>Postconditions:</b> Validity of iterators and references is preserved.<br> | |
930 | <b>Complexity:</b> <code>O(n*log(n))</code>.<br> | |
931 | <b>Exception safety:</b> <code>nothrow</code> if <code>comp</code> does | |
932 | not throw; otherwise, basic. | |
933 | </blockquote> | |
934 | ||
935 | <code>void reverse()noexcept;</code> | |
936 | ||
937 | <blockquote> | |
938 | <b>Effects:</b> Reverses the order of the elements in the index.<br> | |
939 | <b>Postconditions:</b> Validity of iterators and references is preserved.<br> | |
940 | <b>Complexity:</b> <code>O(n)</code>.<br> | |
941 | </blockquote> | |
942 | ||
943 | <h4><a name="rearrange_operations">Rearrange operations</a></h4> | |
944 | ||
945 | <p> | |
946 | These operations, without counterpart in <code>std::list</code> | |
947 | (although <code>splice</code> provides partially overlapping | |
948 | functionality), perform individual and global repositioning of elements | |
949 | inside the index. | |
950 | </p> | |
951 | ||
952 | <code>void relocate(iterator position,iterator i);</code> | |
953 | ||
954 | <blockquote> | |
955 | <b>Requires:</b> <code>position</code> is a valid iterator of the index. | |
956 | <code>i</code> is a valid dereferenceable iterator of the index.<br> | |
957 | <b>Effects:</b> Inserts the element pointed to by <code>i</code> before | |
958 | <code>position</code>. If <code>position==i</code>, no operation is | |
959 | performed.<br> | |
960 | <b>Postconditions:</b> No iterator or reference is invalidated.<br> | |
961 | <b>Complexity:</b> Constant.<br> | |
962 | <b>Exception safety:</b> <code>nothrow</code>.<br> | |
963 | </blockquote> | |
964 | ||
965 | <code>void relocate(iterator position,iterator first,iterator last);</code> | |
966 | ||
967 | <blockquote> | |
968 | <b>Requires:</b> <code>position</code> is a valid iterator of the index. | |
969 | <code>first</code> and <code>last</code> are valid iterators of the index. | |
970 | <code>last</code> is reachable from <code>first</code>. <code>position</code> | |
971 | is not in the range [<code>first</code>,<code>last</code>).<br> | |
972 | <b>Effects:</b> The range of elements [<code>first</code>,<code>last</code>) | |
973 | is repositioned just before <code>position</code>.<br> | |
974 | <b>Postconditions:</b> No iterator or reference is invalidated.<br> | |
975 | <b>Complexity:</b> Constant.<br> | |
976 | <b>Exception safety:</b> <code>nothrow</code>.<br> | |
977 | </blockquote> | |
978 | ||
979 | <a name="rearrange"><code>template<typename InputIterator> void rearrange(InputIterator first);</code></a> | |
980 | ||
981 | <blockquote> | |
982 | <b>Requires:</b> The range [<code>first</code>, | |
983 | <code>std::advance(first,n)</code>), | |
984 | where <code>n</code> is the size of the index, is a | |
985 | <a href="indices.html#views">free view</a> of the index.<br> | |
986 | <b>Effects:</b> The elements are rearranged so as to match the | |
987 | order of the previously described view.<br> | |
988 | <b>Postconditions:</b> No iterator or reference is invalidated.<br> | |
989 | <b>Complexity:</b> <code>O(n)</code>.<br> | |
990 | <b>Exception safety:</b> Basic.<br> | |
991 | </blockquote> | |
992 | ||
993 | <h4><a name="serialization">Serialization</a></h4> | |
994 | ||
995 | <p> | |
996 | Indices cannot be serialized on their own, but only as part of the | |
997 | <code>multi_index_container</code> into which they are embedded. In describing | |
998 | the additional preconditions and guarantees associated to sequenced indices | |
999 | with respect to serialization of their embedding containers, we | |
1000 | use the concepts defined in the <code>multi_index_container</code> | |
1001 | <a href="multi_index_container.html#serialization">serialization section</a>. | |
1002 | </p> | |
1003 | ||
1004 | Operation: saving of a <code>multi_index_container</code> <code>m</code> to an | |
1005 | output archive (XML archive) <code>ar</code>. | |
1006 | ||
1007 | <blockquote> | |
1008 | <b>Requires:</b> No additional requirements to those imposed by the container. | |
1009 | </blockquote> | |
1010 | ||
1011 | Operation: loading of a <code>multi_index_container</code> <code>m'</code> from an | |
1012 | input archive (XML archive) <code>ar</code>. | |
1013 | ||
1014 | <blockquote> | |
1015 | <b>Requires:</b> No additional requirements to those imposed by the container.<br> | |
1016 | <b>Postconditions:</b> On successful loading, each of the elements of | |
1017 | [<code>begin()</code>, <code>end()</code>) is a restored copy of the corresponding | |
1018 | element in [<code>m.get<i>().begin()</code>, <code>m.get<i>().end()</code>), | |
1019 | where <code>i</code> is the position of the sequenced index in the container. | |
1020 | </blockquote> | |
1021 | ||
1022 | Operation: saving of an <code>iterator</code> or <code>const_iterator</code> | |
1023 | <code>it</code> to an output archive (XML archive) <code>ar</code>. | |
1024 | ||
1025 | <blockquote> | |
1026 | <b>Requires:</b> <code>it</code> is a valid iterator of the index. The associated | |
1027 | <code>multi_index_container</code> has been previously saved. | |
1028 | </blockquote> | |
1029 | ||
1030 | Operation: loading of an <code>iterator</code> or <code>const_iterator</code> | |
1031 | <code>it'</code> from an input archive (XML archive) <code>ar</code>. | |
1032 | ||
1033 | <blockquote> | |
1034 | <b>Postconditions:</b> On successful loading, if <code>it</code> was dereferenceable | |
1035 | then <code>*it'</code> is the restored copy of <code>*it</code>, otherwise | |
1036 | <code>it'==end()</code>.<br> | |
1037 | <b>Note:</b> It is allowed that <code>it</code> be a <code>const_iterator</code> | |
1038 | and the restored <code>it'</code> an <code>iterator</code>, or viceversa. | |
1039 | </blockquote> | |
1040 | ||
1041 | <hr> | |
1042 | ||
1043 | <div class="prev_link"><a href="hash_indices.html"><img src="../prev.gif" alt="hashed indices" border="0"><br> | |
1044 | Hashed indices | |
1045 | </a></div> | |
1046 | <div class="up_link"><a href="index.html"><img src="../up.gif" alt="Boost.MultiIndex reference" border="0"><br> | |
1047 | Boost.MultiIndex reference | |
1048 | </a></div> | |
1049 | <div class="next_link"><a href="rnd_indices.html"><img src="../next.gif" alt="random access indices" border="0"><br> | |
1050 | Random access indices | |
1051 | </a></div><br clear="all" style="clear: all;"> | |
1052 | ||
1053 | <br> | |
1054 | ||
1055 | <p>Revised November 26th 2015</p> | |
1056 | ||
1057 | <p>© Copyright 2003-2015 Joaquín M López Muñoz. | |
1058 | Distributed under the Boost Software | |
1059 | License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt"> | |
1060 | LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> | |
1061 | http://www.boost.org/LICENSE_1_0.txt</a>) | |
1062 | </p> | |
1063 | ||
1064 | </body> | |
1065 | </html> |