File: array_adaptor.htm

package info (click to toggle)
boost 1.34.1-14
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 116,412 kB
  • ctags: 259,566
  • sloc: cpp: 642,395; xml: 56,450; python: 17,612; ansic: 14,520; sh: 2,265; yacc: 858; perl: 481; makefile: 478; lex: 94; sql: 74; csh: 6
file content (215 lines) | stat: -rw-r--r-- 10,425 bytes parent folder | download
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<link href="ublas.css" type="text/css" />
<title>Bounded Array;</title>
</head>
<body>
<h1><img src="../../../../boost.png" align="middle" />
Array Storage</h1>
<h2><a name="array_adaptor" id="array_adaptor"></a>Array Adaptor</h2>
<h4>Description</h4>
<p>The templated class <code>carray_adaptor&lt;T&gt;</code> implements a storage array using a pointer to an existing memory buffer (a C array for example). The storage specified array size must never exceed the size of the memory buffer.</p>
<p><code>carray_adaptor</code> defines <code>size_type</code> as <code>size_t</code> and <code>difference_type</code> as <code>std::ptrdiff_t</code>.
</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/storage.hpp&gt;

int main () {
    using namespace boost::numeric::ublas;
    double aarray[10];
    carray_adaptor&lt;double&gt; a (aarray, 3);
    for (unsigned i = 0; i &lt; a.size (); ++ i) {
        a [i] = i;
        std::cout &lt;&lt; a [i] &lt;&lt; std::endl;
    }
}
</pre>
<h4>Definition</h4>
<p>Defined in the header storage.hpp.</p>
<h4>Template parameters</h4>
<table border="1" summary="parameters">
<tbody>
<tr>
<th>Parameter</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><code>T</code></td>
<td>The type of object stored in the array.</td>
<td></td>
</tr>
</tbody>
</table>
<h4>Model of</h4>
<p><a href="storage_concept.htm">Storage</a> but NOT Copy Constructable</p>
<h4>Type requirements</h4>
<p>None, except for those imposed by the requirements of Storage.</p>
<h4>Public base classes</h4>
<p>None.</p>
<h4>Members</h4>
<ul>
<li>The description does not describe what the member actually does, this can be looked up
in the corresponding concept documentation, but instead contains a remark on the implementation of the
member inside this model of the concept.</li>
<li>Typography:
<ul>
<li>Members that are not part of the implemented concepts are <font color="blue">in blue</font>.</li>
<li>Differences compared to the concept are <font color="red">in red</font>.</li>
</ul>
</li>
</ul>
<table border="1" summary="members">
<tbody>
<tr>
<th>Member</th>
<th>Where defined</th>
<th>Description</th>
</tr>
<tr><td><code>value_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td></tr>
<tr><td><code>pointer</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Defined as <code>value_type*</code></td></tr>
<tr><td><code>const_pointer</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Defined as <code>const value_type*</code></td></tr>
<tr><td><code>reference</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Defined as <code>value_type&amp;</code></td></tr>
<tr><td><code>const_reference</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Defined as <code>const value_type&amp;</code></td></tr>
<tr><td><code>size_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Defined as <code>Alloc::size_type</code></td></tr>
<tr><td><code>difference_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Defined as <code>Alloc::difference_type</code></td></tr>
<tr><td><code>iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Defined as <code>pointer</code></td></tr>
<tr><td><code>const_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Defined as <code>const_pointer</code></td></tr>
<tr><td><code>revere_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Defined as <code>std::reverse_iterator&lt;iterator&gt;</code></td></tr>
<tr><td><code>const_revere_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Defined as <code>std::reverse_iterator&lt;const_iterator&gt;</code></td></tr>
<tr>
<td><code>carray_adaptor ()</code></td>
<td><a href="storage_concept.htm">Storage</a></td>
<td>Creates an <code>carray_adaptor</code> that holds <strong>zero</strong> elements.</td> 
</tr>
<tr>
<td><font color="Red"><code>carray_adaptor (size_type size)</code></font></td>
<td><a href="storage_concept.htm">Storage</a>
<td>The size-constructor is undefined. A <code>carray_adaptor</code> cannot be constructed like this as a memory buffer cannot
be specifed in this context.</td>
</tr>
<tr>
<td><font color="Red"><code>carray_adaptor (size_type size, const T&amp; init)</code></font></td>
<td><a href="storage_concept.htm">Storage</a>
<td>The fill-constructor is undefined. A <code>carray_adaptor</code> cannot be constructed like this as a memory buffer cannot
be specifed in this context.</td>
</tr>
<tr>
<td><code>bounded_array (size_type size, pointer data)</code></td>
<td><a href="storage_concept.htm">Storage</a></td>
<td>Creates a uninitialized <code>bounded_array</code> that holds <code>size</code> elements from the memory buffer <code>data</code>. All the elements are default constructed.</td>
</tr>
<tr>
<td><code>bounded_array (size_type size, pointer data, const T&amp; init)</code></td>
<td><a href="storage_concept.htm">Storage</a></td>
<td>Creates an initialized <code>bounded_array</code> that holds <code>size</code> elements from the memory buffer <code>data</code>. All the elements are constructed from the <code>init</code> value.</td>
</tr>
<tr>
<td><font color="Red"><code>carray_adaptor (const carray_adaptor &amp;c)</code></font></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>The copy constructor is private and undefined. A <code>carray_adaptor</code> cannot be constructed like this as a memory buffer cannot
be specifed in this context.</td>
</tr>
<tr>
<td><code>~carray_adaptor ()</code></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>Deallocates the <code>carray_adaptor</code> itself.</td>
</tr>
<tr>
<td><code>void resize (size_type size)</code></td>
<td><a href="storage_concept.htm">Storage</a>
<td>Reallocates a <code>carray_adaptor</code> to hold <code>size</code> elements.</td>
</tr>
<tr>
<td><code>void resize (size_type size, const T&amp; t)</code></td>
<td><a href="storage_concept.htm">Storage</a>
<td>Reallocates a <code>carray_adaptor</code> to hold <code>size</code> elements.</td>
</tr>
<tr>
<td><code>void resize (size_type size pointer data)</code></td>
<td><a href="storage_concept.htm">Storage</a>
<td>Reallocates a <code>carray_adaptor</code> to hold <code>size</code> elements.</td>
</tr>
<tr>
<td><code>void resize (size_type size pointer data, const T&amp; t)</code></td>
<td><a href="storage_concept.htm">Storage</a>
<td>Reallocates a <code>carray_adaptor</code> to hold <code>size</code> elements.</td>
</tr>
<tr>
<td><code>size_type size () const</code></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>Returns the size of the <code>carray_adaptor</code>.</td>
</tr>
<tr>
<td><code>const_reference operator [] (size_type i) const</code></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>Returns a <code>const</code> reference of the <code>i</code> -th element.</td>
</tr>
<tr>
<td><code>reference operator [] (size_type i)</code></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>Returns a reference of the <code>i</code>-th element.</td>
</tr>
<tr>
<td><code>carray_adaptor &amp;operator = (const carray_adaptor &amp;a)</code></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>The assignment operator.</td>
</tr>
<tr>
<td><font color="blue"><code>carray_adaptor &amp;assign_temporary (carray_adaptor &amp;a)</code></font></td>
<td></td>
<td>Assigns a temporary. May change the array <code>a</code>.</td>
</tr>
<tr>
<td><code>void swap (carray_adaptor &amp;a)</code></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>Swaps the contents of the arrays.</td>
</tr>
<tr>
<td><code>const_iterator begin () const</code></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>Returns a <code>const_iterator</code> pointing to the beginning of the <code>carray_adaptor</code>.</td>
</tr>
<tr>
<td><code>const_iterator end () const</code></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>Returns a <code>const_iterator</code> pointing to the end of the <code>carray_adaptor</code>.</td> 
</tr>
<tr>
<td><code>iterator begin ()</code></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>Returns a <code>iterator</code> pointing to the beginning of the <code>carray_adaptor</code>.</td>
</tr>
<tr>
<td><code>iterator end ()</code></td>
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
<td>Returns a <code>iterator</code> pointing to the end of the <code>carray_adaptor</code>.</td>
</tr>
<tr>
<td><code>const_reverse_iterator rbegin () const</code></td>
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
<td>Returns a <code>const_reverse_iterator</code> pointing to the beginning of the reversed <code>carray_adaptor</code>.</td>
</tr>
<tr>
<td><code>const_reverse_iterator rend () const</code></td>
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
<td>Returns a <code>const_reverse_iterator</code> pointing to the end of the reversed <code>carray_adaptor</code>.</td>
</tr>
<tr>
<td><code>reverse_iterator rbegin ()</code></td>
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
<td>Returns a <code>reverse_iterator</code> pointing to the beginning of the reversed <code>carray_adaptor</code>.</td>
</tr>
<tr>
<td><code>reverse_iterator rend ()</code></td>
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
<td>Returns a <code>reverse_iterator</code> pointing to the end of the reversed <code>carray_adaptor</code>.</td>
</tr>
</tbody>
</table>
</body>
</html>