File: RandomAccessIterator.xml

package info (click to toggle)
boost1.67 1.67.0-13%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 489,644 kB
  • sloc: cpp: 2,931,611; xml: 134,662; ansic: 74,483; python: 31,874; sh: 9,996; asm: 3,827; cs: 2,121; makefile: 1,719; perl: 965; yacc: 476; php: 212; pascal: 115; ruby: 94; f90: 55; lisp: 14; sql: 13; csh: 6
file content (313 lines) | stat: -rw-r--r-- 10,289 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<?xml version="1.0"?>
<concept name="RandomAccessIterator" category="Iterator"><!--
Based on concepts from the SGI Standard Template Library documentation:
Copyright (c) 1996-1999
Silicon Graphics Computer Systems, Inc.

Copyright (c) 1994
Hewlett-Packard Company
--><!--
Copyright 2000-2001 University of Notre Dame du Lac.
Copyright 2001-2002 Indiana University.
Some concepts based on versions from the MTL draft manual and Boost Graph
and Property Map documentation:
Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
-->
  <param name="Iter" role="iterator-type"/>

  <use-header name="iterator"/>

  <models-sentence>The iterator type <arg num="1"/> must be a model of <self/>.</models-sentence>

  <description>
  <para>A random access iterator is an iterator that can read through
  a sequence of values.  It can move in either direction through the
  sequence (by any amount in constant time), and can be either mutable
  (data pointed to by it can be changed) or not mutable.</para>

  <para>An iterator represents a position in a sequence.  Therefore,
  the iterator can point into the sequence (returning a value when
  dereferenced and being incrementable), or be off-the-end (and not
  dereferenceable or incrementable).</para>
  </description>

  <associated-type name="value_type">
    <get-member-type name="value_type">
      <apply-template name="std::iterator_traits">
	<type name="Iter"/>
      </apply-template>
    </get-member-type>
    <description><simpara>The value type of the iterator</simpara></description>
  </associated-type>

  <refines const="no" concept="BidirectionalIterator"/>
  <refines const="no" concept="LessThanComparable"/>

  <notation variables="i j">
    <sample-value>
      <type name="Iter"/>
    </sample-value>
  </notation>

  <associated-type name="category">
    <get-member-type name="iterator_category">
      <apply-template name="std::iterator_traits">
	<type name="Iter"/>
      </apply-template>
    </get-member-type>
    <description><simpara>The category of the iterator</simpara></description>
  </associated-type>

  <associated-type name="difference_type">
    <get-member-type name="difference_type">
      <apply-template name="std::iterator_traits">
	<type name="Iter"/>
      </apply-template>
    </get-member-type>
    <description><simpara>The difference type of the iterator (measure of the number
    of steps between two iterators)</simpara></description>
  </associated-type>

  <notation variables="x">
    <sample-value>
      <type name="value_type"/>
    </sample-value>
  </notation>

  <notation variables="n">
    <sample-value>
      <type name="difference_type"/>
    </sample-value>
  </notation>

  <notation variables="int_off">
    <sample-value>
      <type name="int"/>
    </sample-value>
  </notation>

  <valid-type-expression name="Category tag">
    <description/>
    <type name="category"/>
    <return-type>
      <derived-from testable="yes">
	<type name="std::random_access_iterator_tag"/>
      </derived-from>
    </return-type>
  </valid-type-expression>

  <valid-expression name="Motion">
    <add-assign>
      <sample-value><reference-to><type name="Iter"/></reference-to></sample-value>
      <sample-value><type name="difference_type"/></sample-value>
    </add-assign>
    <return-type>
      <require-same-type testable="yes">
	<reference-to><type name="Iter"/></reference-to>
      </require-same-type>
    </return-type>
    <semantics>Equivalent to applying <code>i++</code> <code>n</code> times
    if <code>n</code> is positive, applying <code>i--</code>
    <code>-n</code> times if <code>n</code> is negative, and to a null
    operation if <code>n</code> is zero.</semantics>
  </valid-expression>

  <valid-expression name="Motion (with integer offset)">
    <add-assign>
      <sample-value><reference-to><type name="Iter"/></reference-to></sample-value>
      <sample-value><type name="int"/></sample-value>
    </add-assign>
    <return-type>
      <require-same-type testable="yes">
	<reference-to><type name="Iter"/></reference-to>
      </require-same-type>
    </return-type>
    <semantics>Equivalent to applying <code>i++</code> <code>n</code> times
    if <code>n</code> is positive, applying <code>i--</code>
    <code>-n</code> times if <code>n</code> is negative, and to a null
    operation if <code>n</code> is zero.</semantics>
  </valid-expression>

  <valid-expression name="Subtractive motion">
    <subtract-assign>
      <sample-value><reference-to><type name="Iter"/></reference-to></sample-value>
      <sample-value><type name="difference_type"/></sample-value>
    </subtract-assign>
    <return-type>
      <require-same-type testable="yes">
	<reference-to><type name="Iter"/></reference-to>
      </require-same-type>
    </return-type>
    <semantics>Equivalent to <code>i+=(-n)</code></semantics>
  </valid-expression>

  <valid-expression name="Subtractive motion (with integer offset)">
    <subtract-assign>
      <sample-value><reference-to><type name="Iter"/></reference-to></sample-value>
      <sample-value><type name="int"/></sample-value>
    </subtract-assign>
    <return-type>
      <require-same-type testable="yes">
	<reference-to><type name="Iter"/></reference-to>
      </require-same-type>
    </return-type>
    <semantics>Equivalent to <code>i+=(-n)</code></semantics>
  </valid-expression>

  <valid-expression name="Addition">
    <add>
      <sample-value><type name="Iter"/></sample-value>
      <sample-value><type name="difference_type"/></sample-value>
    </add>
    <return-type>
      <require-same-type testable="yes"><type name="Iter"/></require-same-type>
    </return-type>
    <semantics>Equivalent to <code>{Iter j = i; j += n; return j;}</code></semantics>
  </valid-expression>

  <valid-expression name="Addition with integer">
    <add>
      <sample-value><type name="Iter"/></sample-value>
      <sample-value><type name="int"/></sample-value>
    </add>
    <return-type>
      <require-same-type testable="yes"><type name="Iter"/></require-same-type>
    </return-type>
    <semantics>Equivalent to <code>{Iter j = i; j += n; return j;}</code></semantics>
  </valid-expression>

  <valid-expression name="Addition (count first)">
    <add>
      <sample-value><type name="difference_type"/></sample-value>
      <sample-value><type name="Iter"/></sample-value>
    </add>
    <return-type>
      <require-same-type testable="yes"><type name="Iter"/></require-same-type>
    </return-type>
    <semantics>Equivalent to <code>i + n</code></semantics>
  </valid-expression>

  <valid-expression name="Addition with integer (count first)">
    <add>
      <sample-value><type name="int"/></sample-value>
      <sample-value><type name="Iter"/></sample-value>
    </add>
    <return-type>
      <require-same-type testable="yes"><type name="Iter"/></require-same-type>
    </return-type>
    <semantics>Equivalent to <code>i + n</code></semantics>
  </valid-expression>

  <valid-expression name="Subtraction">
    <subtract>
      <sample-value><type name="Iter"/></sample-value>
      <sample-value><type name="difference_type"/></sample-value>
    </subtract>
    <return-type>
      <require-same-type testable="yes"><type name="Iter"/></require-same-type>
    </return-type>
    <semantics>Equivalent to <code>i + (-n)</code></semantics>
  </valid-expression>

  <valid-expression name="Subtraction with integer">
    <subtract>
      <sample-value><type name="Iter"/></sample-value>
      <sample-value><type name="int"/></sample-value>
    </subtract>
    <return-type>
      <require-same-type testable="yes"><type name="Iter"/></require-same-type>
    </return-type>
    <semantics>Equivalent to <code>i + (-n)</code></semantics>
  </valid-expression>

  <valid-expression name="Distance">
    <subtract>
      <sample-value><type name="Iter"/></sample-value>
      <sample-value><type name="Iter"/></sample-value>
    </subtract>
    <return-type>
      <require-same-type testable="yes"><type name="difference_type"/></require-same-type>
    </return-type>
    <semantics>The number of times <code>i</code> must be incremented (or
    decremented if the result is negative) to reach <code>j</code>.  Not
    defined if <code>j</code> is not reachable from
    <code>i</code>.</semantics>
  </valid-expression>

  <valid-expression name="Element access">
    <subscript>
      <sample-value><type name="Iter"/></sample-value>
      <sample-value><type name="difference_type"/></sample-value>
    </subscript>
    <return-type>
      <require-same-type testable="yes">
	<const-if-not-mutable>
	  <reference-to>
	    <type name="value_type"/>
	  </reference-to>
	</const-if-not-mutable>
      </require-same-type>
    </return-type>
    <semantics>Equivalent to <code>*(i + n)</code></semantics>
  </valid-expression>

  <valid-expression name="Element access with integer index">
    <subscript>
      <sample-value><type name="Iter"/></sample-value>
      <sample-value><type name="int"/></sample-value>
    </subscript>
    <return-type>
      <require-same-type testable="yes">
	<const-if-not-mutable>
	  <reference-to>
	    <type name="value_type"/>
	  </reference-to>
	</const-if-not-mutable>
      </require-same-type>
    </return-type>
    <semantics>Equivalent to <code>*(i + n)</code></semantics>
  </valid-expression>

  <complexity>
  All iterator operations must take amortized constant time.
  </complexity>

  <example-model>
    <pointer-to>
      <type name="T"/>
    </pointer-to>
  </example-model>

  <example-model>
    <get-member-type name="iterator">
      <apply-template name="std::vector">
	<type name="T"/>
      </apply-template>
    </get-member-type>
  </example-model>

  <example-model>
    <get-member-type name="const_iterator">
      <apply-template name="std::vector">
	<type name="T"/>
      </apply-template>
    </get-member-type>
  </example-model>

  <example-model>
    <get-member-type name="iterator">
      <apply-template name="std::deque">
	<type name="T"/>
      </apply-template>
    </get-member-type>
  </example-model>

  <example-model>
    <get-member-type name="const_iterator">
      <apply-template name="std::deque">
	<type name="T"/>
      </apply-template>
    </get-member-type>
  </example-model>

</concept>