]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libstdc++-v3/contrib/libstdc++-v3-4.1.0/docs/doxygen/tables.html
update
[l4.git] / l4 / pkg / libstdc++-v3 / contrib / libstdc++-v3-4.1.0 / docs / doxygen / tables.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html>
3 <head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
4 <title>Tables</title>
5 <link href="style.css" rel="stylesheet" type="text/css">
6 </head>
7
8 <body bgcolor="#ffffff">
9
10 <h1>Tables</h1>
11
12 <p>Most of the requirements on containers are presented in the ISO standard
13    in the form of tables.  In order to avoid massive duplication of effort
14    while documenting all the classes, we follow the standard's lead and
15    present the base information here.  Individual classes will only document
16    their departures from these tables (removed functions, additional functions,
17    changes, etc).
18 </p>
19
20 <p>We will not try to duplicate all of the surrounding text (footnotes,
21    explanations, etc) from the standard, because that would also entail a
22    duplication of effort.  Some of the surrounding text has been paraphrased
23    here for clarity.  If you are uncertain about the meaning or interpretation
24    of these notes, consult a good textbook, and/or purchase your own copy of
25    the standard (it's cheap, see our FAQ).
26 </p>
27
28 <p>The table numbers are the same as those used in the standard.  Tables can
29    be jumped to using their number, e.g., &quot;tables.html#67&quot;.  Only
30    Tables 65 through 69 are presented.  Some of the active Defect Reports
31    are also noted or incorporated.
32 </p>
33
34 <hr />
35
36 <a name="65"><p>
37 <table cellpadding="3" cellspacing="5" align="center" rules="rows" border="3"
38        cols="5" title="Table 65">
39 <caption><h2>Table 65 --- Container Requirements</h2></caption>
40 <tr><th colspan="5">
41 Anything calling itself a container must meet these minimum requirements.
42 </th></tr>
43 <tr>
44 <td><strong>expression</strong></td>
45 <td><strong>result type</strong></td>
46 <td><strong>operational semantics</strong></td>
47 <td><strong>notes, pre-/post-conditions, assertions</strong></td>
48 <td><strong>complexity</strong></td>
49 </tr>
50
51 <tr>
52 <td>X::value_type</td>
53 <td>T</td>
54 <td>&nbsp;</td>
55 <td>T is Assignable</td>
56 <td>compile time</td>
57 </tr>
58
59 <tr>
60 <td>X::reference</td>
61 <td>lvalue of T</td>
62 <td>&nbsp;</td>
63 <td>&nbsp;</td>
64 <td>compile time</td>
65 </tr>
66
67 <tr>
68 <td>X::const_reference</td>
69 <td>const lvalue of T</td>
70 <td>&nbsp;</td>
71 <td>&nbsp;</td>
72 <td>compile time</td>
73 </tr>
74
75 <tr>
76 <td>X::iterator</td>
77 <td>iterator type pointing to T</td>
78 <td>&nbsp;</td>
79 <td>Any iterator category except output iterator.
80     Convertible to X::const_iterator.</td>
81 <td>compile time</td>
82 </tr>
83
84 <tr>
85 <td>X::const_iterator</td>
86 <td>iterator type pointing to const T</td>
87 <td>&nbsp;</td>
88 <td>Any iterator category except output iterator.</td>
89 <td>compile time</td>
90 </tr>
91
92 <tr>
93 <td>X::difference_type</td>
94 <td>signed integral type</td>
95 <td>&nbsp;</td>
96 <td>identical to the difference type of X::iterator and X::const_iterator</td>
97 <td>compile time</td>
98 </tr>
99
100 <tr>
101 <td>X::size_type</td>
102 <td>unsigned integral type</td>
103 <td>&nbsp;</td>
104 <td>size_type can represent any non-negative value of difference_type</td>
105 <td>compile time</td>
106 </tr>
107
108 <tr>
109 <td>X u;</td>
110 <td>&nbsp;</td>
111 <td>&nbsp;</td>
112 <td>post: u.size() == 0</td>
113 <td>constant</td>
114 </tr>
115
116 <tr>
117 <td>X();</td>
118 <td>&nbsp;</td>
119 <td>&nbsp;</td>
120 <td>X().size == 0</td>
121 <td>constant</td>
122 </tr>
123
124 <tr>
125 <td>X(a);</td>
126 <td>&nbsp;</td>
127 <td>&nbsp;</td>
128 <td>a == X(a)</td>
129 <td>linear</td>
130 </tr>
131
132 <tr>
133 <td>X u(a);<br />X u = a;</td>
134 <td>&nbsp;</td>
135 <td>&nbsp;</td>
136 <td>post: u == a.  Equivalent to: X u; u = a;</td>
137 <td>linear</td>
138 </tr>
139
140 <tr>
141 <td>(&amp;a)-&gt;~X();</td>
142 <td>void</td>
143 <td>&nbsp;</td>
144 <td>dtor is applied to every element of a; all the memory is deallocated</td>
145 <td>linear</td>
146 </tr>
147
148 <tr>
149 <td>a.begin()</td>
150 <td>iterator; const_iterator for constant a</td>
151 <td>&nbsp;</td>
152 <td>&nbsp;</td>
153 <td>constant</td>
154 </tr>
155
156 <tr>
157 <td>a.end()</td>
158 <td>iterator; const_iterator for constant a</td>
159 <td>&nbsp;</td>
160 <td>&nbsp;</td>
161 <td>constant</td>
162 </tr>
163
164 <tr>
165 <td>a == b</td>
166 <td>convertible to bool</td>
167 <td>&nbsp;</td>
168 <td>== is an equivalence relation.  a.size()==b.size() &amp;&amp;
169     equal(a.begin(),a.end(),b.begin())</td>
170 <td>linear</td>
171 </tr>
172
173 <tr>
174 <td>a != b</td>
175 <td>convertible to bool</td>
176 <td>&nbsp;</td>
177 <td>equivalent to !(a==b)</td>
178 <td>linear</td>
179 </tr>
180
181 <tr>
182 <td>a.swap(b)</td>
183 <td>void</td>
184 <td>&nbsp;</td>
185 <td>swap(a,b)</td>
186 <td>may or may not have constant complexity</td>
187 </tr>
188
189 <tr>
190 <td>r = a</td>
191 <td>X&amp;</td>
192 <td>&nbsp;</td>
193 <td>r == a</td>
194 <td>linear</td>
195 </tr>
196
197 <!-- a fifth column, "operation semantics," magically appears in the table
198      at this point... wtf?  -->
199 <tr>
200 <td>a.size()</td>
201 <td>size_type</td>
202 <td>a.end() - a.begin()</td>
203 <td>&nbsp;</td>
204 <td>may or may not have constant complexity</td>
205 </tr>
206
207 <tr>
208 <td>a.max_size()</td>
209 <td>size_type</td>
210 <td>size() of the largest possible container</td>
211 <td>&nbsp;</td>
212 <td>may or may not have constant complexity</td>
213 </tr>
214
215 <tr>
216 <td>a.empty()</td>
217 <td>convertible to bool</td>
218 <td>a.size() == 0</td>
219 <td>&nbsp;</td>
220 <td>constant</td>
221 </tr>
222
223 <tr>
224 <td>a &lt; b</td>
225 <td>convertible to bool</td>
226 <td>lexographical_compare( a.begin, a.end(), b.begin(), b.end())</td>
227 <td>pre: &lt; is defined for T and is a total ordering relation</td>
228 <td>linear</td>
229 </tr>
230
231 <tr>
232 <td>a &gt; b</td>
233 <td>convertible to bool</td>
234 <td>b &lt; a</td>
235 <td>&nbsp;</td>
236 <td>linear</td>
237 </tr>
238
239 <tr>
240 <td>a &lt;= b</td>
241 <td>convertible to bool</td>
242 <td>!(a &gt; b)</td>
243 <td>&nbsp;</td>
244 <td>linear</td>
245 </tr>
246
247 <tr>
248 <td>a &gt;= b</td>
249 <td>convertible to bool</td>
250 <td>!(a &lt; b)</td>
251 <td>&nbsp;</td>
252 <td>linear</td>
253 </tr>
254 </table title="Table 65"></p></a>
255
256
257 <a name="66"><p>
258 <table cellpadding="3" cellspacing="5" align="center" rules="rows" border="3"
259        cols="4" title="Table 66">
260 <caption><h2>Table 66 --- Reversible Container Requirements</h2></caption>
261 <tr><th colspan="4">
262 If a container's iterator is bidirectional or random-access, then the
263 container also meets these requirements.
264 Deque, list, vector, map, multimap, set, and multiset are such containers.
265 </th></tr>
266 <tr>
267 <td><strong>expression</strong></td>
268 <td><strong>result type</strong></td>
269 <td><strong>notes, pre-/post-conditions, assertions</strong></td>
270 <td><strong>complexity</strong></td>
271 </tr>
272
273 <tr>
274 <td>X::reverse_iterator</td>
275 <td>iterator type pointing to T</td>
276 <td>reverse_iterator&lt;iterator&gt;</td>
277 <td>compile time</td>
278 </tr>
279
280 <tr>
281 <td>X::const_reverse_iterator</td>
282 <td>iterator type pointing to const T</td>
283 <td>reverse_iterator&lt;const_iterator&gt;</td>
284 <td>compile time</td>
285 </tr>
286
287 <tr>
288 <td>a.rbegin()</td>
289 <td>reverse_iterator; const_reverse_iterator for constant a</td>
290 <td>reverse_iterator(end())</td>
291 <td>constant</td>
292 </tr>
293
294 <tr>
295 <td>a.rend()</td>
296 <td>reverse_iterator; const_reverse_iterator for constant a</td>
297 <td>reverse_iterator(begin())</td>
298 <td>constant</td>
299 </tr>
300 </table title="Table 66"></p></a>
301
302
303 <a name="67"><p>
304 <table cellpadding="3" cellspacing="5" align="center" rules="rows" border="3"
305        cols="3" title="Table 67">
306 <caption><h2>Table 67 --- Sequence Requirements</h2></caption>
307 <tr><th colspan="3">
308 These are in addition to the requirements of <a href="#65">containers</a>.
309 Deque, list, and vector are such containers.
310 </th></tr>
311 <tr>
312 <td><strong>expression</strong></td>
313 <td><strong>result type</strong></td>
314 <td><strong>notes, pre-/post-conditions, assertions</strong></td>
315 </tr>
316
317 <tr>
318 <td>X(n,t)<br />X a(n,t)</td>
319 <td>&nbsp;</td>
320 <td>constructs a sequence with n copies of t<br />post: size() == n</td>
321 </tr>
322
323 <tr>
324 <td>X(i,j)<br />X a(i,j)</td>
325 <td>&nbsp;</td>
326 <td>constructs a sequence equal to the range [i,j)<br />
327     post: size() == distance(i,j)</td>
328 </tr>
329
330 <tr>
331 <td>a.insert(p,t)</td>
332 <td>iterator (points to the inserted copy of t)</td>
333 <td>inserts a copy of t before p</td>
334 </tr>
335
336 <tr>
337 <td>a.insert(p,n,t)</td>
338 <td>void</td>
339 <td>inserts n copies of t before p</td>
340 </tr>
341
342 <tr>
343 <td>a.insert(p,i,j)</td>
344 <td>void</td>
345 <td>inserts copies of elements in [i,j) before p<br />
346     pre: i, j are not iterators into a</td>
347 </tr>
348
349 <tr>
350 <td>a.erase(q)</td>
351 <td>iterator (points to the element following q (prior to erasure))</td>
352 <td>erases the element pointed to by q</td>
353 </tr>
354
355 <tr>
356 <td>a.erase(q1,q1)</td>
357 <td>iterator (points to the element pointed to by q2 (prior to erasure))</td>
358 <td>erases the elements in the range [q1,q2)</td>
359 </tr>
360
361 <tr>
362 <td>a.clear()</td>
363 <td>void</td>
364 <td>erase(begin(),end())<br />post: size() == 0</td>
365 </tr>
366 </table title="Table 67"></p></a>
367
368
369 <a name="68"><p>
370 <table cellpadding="3" cellspacing="5" align="center" rules="rows" border="3"
371        cols="4" title="Table 68">
372 <caption><h2>Table 68 --- Optional Sequence Operations</h2></caption>
373 <tr><th colspan="4">
374 These operations are only included in containers when the operation can be
375 done in constant time.
376 </th></tr>
377 <tr>
378 <td><strong>expression</strong></td>
379 <td><strong>result type</strong></td>
380 <td><strong>operational semantics</strong></td>
381 <td><strong>container</strong></td>
382 </tr>
383
384 <tr>
385 <td>a.front()</td>
386 <td>reference; const_reference for constant a</td>
387 <td>*a.begin()</td>
388 <td>vector, list, deque</td>
389 </tr>
390
391 <tr>
392 <td>a.back()</td>
393 <td>reference; const_reference for constant a</td>
394 <td>*--a.end()</td>
395 <td>vector, list, deque</td>
396 </tr>
397
398 <tr>
399 <td>a.push_front(x)</td>
400 <td>void</td>
401 <td>a.insert(a.begin(),x)</td>
402 <td>list, deque</td>
403 </tr>
404
405 <tr>
406 <td>a.push_back(x)</td>
407 <td>void</td>
408 <td>a.insert(a.end(),x)</td>
409 <td>vector, list, deque</td>
410 </tr>
411
412 <tr>
413 <td>a.pop_front()</td>
414 <td>void</td>
415 <td>a.erase(a.begin())</td>
416 <td>list, deque</td>
417 </tr>
418
419 <tr>
420 <td>a.pop_back()</td>
421 <td>void</td>
422 <td>a.erase(--a.end())</td>
423 <td>vector, list, deque</td>
424 </tr>
425
426 <tr>
427 <td>a[n]</td>
428 <td>reference; const_reference for constant a</td>
429 <td>*(a.begin() + n)</td>
430 <td>vector, deque</td>
431 </tr>
432
433 <tr>
434 <td>a.at(n)</td>
435 <td>reference; const_reference for constant a</td>
436 <td>*(a.begin() + n)<br />throws out_of_range if n&gt;=a.size()</td>
437 <td>vector, deque</td>
438 </tr>
439 </table title="Table 68"></p></a>
440
441
442 <a name="69"><p>
443 <table cellpadding="3" cellspacing="5" align="center" rules="rows" border="3"
444        cols="4" title="Table 69">
445 <caption><h2>Table 69 --- Associative Container Requirements</h2></caption>
446 <tr><th colspan="4">
447 These are in addition to the requirements of <a href="#65">containers</a>.
448 Map, multimap, set, and multiset are such containers.  An associative
449 container supports <em>unique keys</em> (and is written as
450 <code>a_uniq</code> instead of <code>a</code>) if it may contain at most
451 one element for each key.  Otherwise it supports <em>equivalent keys</em>
452 (and is written <code>a_eq</code>).  Examples of the former are set and map,
453 examples of the latter are multiset and multimap.
454 </th></tr>
455 <tr>
456 <td><strong>expression</strong></td>
457 <td><strong>result type</strong></td>
458 <td><strong>notes, pre-/post-conditions, assertions</strong></td>
459 <td><strong>complexity</strong></td>
460 </tr>
461
462 <tr>
463 <td>X::key_type</td>
464 <td>Key</td>
465 <td>Key is Assignable</td>
466 <td>compile time</td>
467 </tr>
468
469 <tr>
470 <td>X::key_compare</td>
471 <td>Compare</td>
472 <td>defaults to less&lt;key_type&gt;</td>
473 <td>compile time</td>
474 </tr>
475
476 <tr>
477 <td>X::value_compare</td>
478 <td>a binary predicate type</td>
479 <td>same as key_compare for set and multiset; an ordering relation on
480     pairs induced by the first component (Key) for map and multimap</td>
481 <td>compile time</td>
482 </tr>
483
484 <tr>
485 <td>X(c)<br />X a(c)</td>
486 <td>&nbsp;</td>
487 <td>constructs an empty container which uses c as a comparison object</td>
488 <td>constant</td>
489 </tr>
490
491 <tr>
492 <td>X()<br />X a</td>
493 <td>&nbsp;</td>
494 <td>constructs an empty container using Compare() as a comparison object</td>
495 <td>constant</td>
496 </tr>
497
498 <tr>
499 <td>X(i,j,c)<br />X a(i,j,c)</td>
500 <td>&nbsp;</td>
501 <td>constructs an empty container and inserts elements from the range [i,j)
502     into it; uses c as a comparison object</td>
503 <td>NlogN in general where N is distance(i,j); linear if [i,j) is
504     sorted with value_comp()</td>
505 </tr>
506
507 <tr>
508 <td>X(i,j)<br />X a(i,j)</td>
509 <td>&nbsp;</td>
510 <td>same as previous, but uses Compare() as a comparison object</td>
511 <td>same as previous</td>
512 </tr>
513
514 <tr>
515 <td>a.key_comp()</td>
516 <td>X::key_compare</td>
517 <td>returns the comparison object out of which a was constructed</td>
518 <td>constant</td>
519 </tr>
520
521 <tr>
522 <td>a.value_comp()</td>
523 <td>X::value_compare</td>
524 <td>returns an object constructed out of the comparison object</td>
525 <td>constant</td>
526 </tr>
527
528 <tr>
529 <td>a_uniq.insert(t)</td>
530 <td>pair&lt;iterator,bool&gt;</td>
531 <td>&quot;Inserts t if and only if there is no element in the container with
532     key equivalent to the key of t. The bool component of the returned pair
533     is true -iff- the insertion took place, and the iterator component of
534     the pair points to the element with key equivalent to the key of
535     t.&quot;</td> <!-- DR 316 -->
536 <td>logarithmic</td>
537 </tr>
538
539 <tr>
540 <td>a_eq.insert(t)</td>
541 <td>iterator</td>
542 <td>inserts t, returns the iterator pointing to the inserted element</td>
543 <td>logarithmic</td>
544 </tr>
545
546 <tr>
547 <td>a.insert(p,t)</td>
548 <td>iterator</td>
549 <td>possibly inserts t (depending on whether a_uniq or a_eq); returns iterator
550     pointing to the element with key equivalent to the key of t; iterator p
551     is a hint pointing to where the insert should start to search</td>
552 <td>logarithmic in general, amortized constant if t is inserted right
553     after p<br />
554     <strong>[but see DR 233 and <a href="
555     http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4">our
556     specific notes</a>]</strong></td>
557 </tr>
558
559 <tr>
560 <td>a.insert(i,j)</td>
561 <td>void</td>
562 <td>pre: i, j are not iterators into a.  possibly inserts each element from
563     the range [i,j) (depending on whether a_uniq or a_eq)</td>
564 <td>Nlog(size()+N) where N is distance(i,j) in general</td> <!-- DR 264 -->
565 </tr>
566
567 <tr>
568 <td>a.erase(k)</td>
569 <td>size_type</td>
570 <td>erases all elements with key equivalent to k; returns number of erased
571     elements</td>
572 <td>log(size()) + count(k)</td>
573 </tr>
574
575 <tr>
576 <td>a.erase(q)</td>
577 <td>void</td>
578 <td>erases the element pointed to by q</td>
579 <td>amortized constant</td>
580 </tr>
581
582 <tr>
583 <td>a.erase(q1,q2)</td>
584 <td>void</td>
585 <td>erases all the elements in the range [q1,q2)</td>
586 <td>log(size()) + distance(q1,q2)</td>
587 </tr>
588
589 <tr>
590 <td>a.clear()</td>
591 <td>void</td>
592 <td>erases everthing; post: size() == 0</td>
593 <td>linear</td> <!-- DR 224 -->
594 </tr>
595
596 <tr>
597 <td>a.find(k)</td>
598 <td>iterator; const_iterator for constant a</td>
599 <td>returns iterator pointing to element with key equivalent to k, or
600     a.end() if no such element found</td>
601 <td>logarithmic</td>
602 </tr>
603
604 <tr>
605 <td>a.count(k)</td>
606 <td>size_type</td>
607 <td>returns number of elements with key equivalent to k</td>
608 <td>log(size()) + count(k)</td>
609 </tr>
610
611 <tr>
612 <td>a.lower_bound(k)</td>
613 <td>iterator; const_iterator for constant a</td>
614 <td>returns iterator pointing to the first element with key not less than k</td>
615 <td>logarithmic</td>
616 </tr>
617
618 <tr>
619 <td>a.upper_bound(k)</td>
620 <td>iterator; const_iterator for constant a</td>
621 <td>returns iterator pointing to the first element with key greater than k</td>
622 <td>logarithmic</td>
623 </tr>
624
625 <tr>
626 <td>a.equal_range(k)</td>
627 <td>pair&lt;iterator,iterator&gt;;
628     pair&lt;const_iterator, const_iterator&gt; for constant a</td>
629 <td>equivalent to make_pair(a.lower_bound(k), a.upper_bound(k))</td>
630 <td>logarithmic</td>
631 </tr>
632 </table title="Table 69"></p></a>
633
634
635 <hr />
636 <p class="smallertext"><em>
637 See <a href="mainpage.html">mainpage.html</a> for copying conditions.
638 See <a href="http://gcc.gnu.org/libstdc++/">the libstdc++-v3 homepage</a>
639 for more information.
640 </em></p>
641
642
643 </body>
644 </html>
645