Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/numeric/ublas/doc/unbounded_array.htm @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 9.8 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
6<link href="ublas.css" type="text/css" />
7<title>Unbounded array</title>
8</head>
9<body>
10<h1><img src="../../../../boost.png" align="middle" />
11Unbounded Array Storage</h1>
12<h2><a name="unbounded_array" id="unbounded_array"></a>Unbounded Array&lt;T,Alloc&gt;</h2>
13<h4>Description</h4>
14<p>The templated class <code>unbounded_array&lt;T, ALLOC&gt;</code> implements a unbounded storage array using an allocator.
15The unbounded array is similar to a <code>std::vector</code> in that in can grow in size beyond any fixed bound.
16However <code>unbounded_array</code> is aimed at optimal performance. Therefore <code>unbounded_array</code> does not model a
17<code>Sequence</code> like <code>std::vector</code> does.
18<p>When resized <code>unbounded_array</code> will reallocate it's storage even if the new size requirement is smaller. It is therefore inefficient to resize a <code>unbounded_array</code></p>
19<h4>Example</h4>
20<pre>
21#include &lt;boost/numeric/ublas/storage.hpp&gt;
22
23int main () {
24    using namespace boost::numeric::ublas;
25    unbounded_array&lt;double&gt; a (3);
26    for (unsigned i = 0; i &lt; a.size (); ++ i) {
27        a [i] = i;
28        std::cout &lt;&lt; a [i] &lt;&lt; std::endl;
29    }
30}
31</pre>
32<h4>Definition</h4>
33<p>Defined in the header storage.hpp.</p>
34<h4>Template parameters</h4>
35<table border="1" summary="parameters">
36<tbody>
37<tr>
38<th>Parameter</th>
39<th>Description</th>
40<th>Default</th>
41</tr>
42<tr>
43<td><code>T</code></td>
44<td>The type of object stored in the array.</td>
45<td></td>
46</tr>
47<tr>
48<td><code>ALLOC</code></td>
49<td>An STL Allocator</td>
50<td>std::allocator</td>
51</tr>
52</tbody>
53</table>
54<h4>Model of</h4>
55<p><a href="storage_concept.htm">Storage</a></p>
56<h4>Type requirements</h4>
57<p>None, except for those imposed by the requirements of Random
58Access Container.</p>
59<h4>Public base classes</h4>
60<p>None.</p>
61<h4>Members</h4>
62Editor's notes:
63<ul>
64<li>The description does not describe what the member actually does, this can be looked up
65in the corresponding concept documentation, but instead contains a remark on the implementation of the
66member inside this model of the concept.</li>
67<li>Type setting:
68<ul>
69<li>Members that currently lack are <font color="red">in red</font>.</li>
70<li>Members that are not part of the implemented concepts are <font color="blue">in blue</font>.</li>
71<li>Differences compared to the concept are in <em>italics</em>.</li>
72</ul>
73</li>
74</ul>
75<table border="1" summary="members">
76<tbody>
77<tr>
78<th>Member</th>
79<th>Where defined</th>
80<th>Description</th>
81</tr>
82<tr><td><code>value_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td></tr>
83<tr><td><code>pointer</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>value_type*</code></td></tr>
84<tr><td><code>const_pointer</code></td><td></td><td>Currently defined as <code>value_type*</code></td></tr>
85<tr><td><code>reference</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>value_type&amp;</code></td></tr>
86<tr><td><code>const_reference</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>const value_type&amp;</code></td></tr>
87<tr><td><code>size_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>Alloc::size_type</code></td></tr>
88<tr><td><code>difference_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>Alloc::difference_type</code></td></tr>
89<tr><td><code>iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>pointer</code></td></tr>
90<tr><td><code>const_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>const_pointer</code></td></tr>
91<tr><td><code>revere_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>std::reverse_iterator&lt;iterator&gt;</code></td></tr>
92<tr><td><code>const_revere_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>std::reverse_iterator&lt;const_iterator&gt;</code></td></tr>
93<tr><td><font color="blue"><code>allocator_type</code></code></td><td></td><td>Defined as ALLOC</td></tr>
94<tr>
95<td><code><em>explicit</em> unbounded_array (<em>ALLOC &amp;a = ALLOC()</em>)</code></td>
96<td><a href="storage_concept.htm">Storage</a></td>
97<td>Creates an <code>unbounded_array</code> that holds at most zero elements, using a specified allocator.</td> 
98</tr>
99<tr>
100<td><code><em>explicit</em> unbounded_array (size_type size<em>, ALLOC &amp;a = ALLOC()</em>)</code></td>
101<td><a href="storage_concept.htm">Storage</a></td>
102<td>Creates a uninitialized <code>unbounded_array</code> that holds at most <code>size</code> elements, using a specified allocator. All the elements are constructed without an initializer. </td>
103</tr>
104<tr>
105<td><code><em>explicit </em>unbounded_array (size_type size, const T&amp; init<em>, ALLOC&amp; a = ALLOC()</em>)</code></td>
106<td><a href="storage_concept.htm">Storage</a></td>
107<td>Creates an initialized <code>unbounded_array</code> that holds at most <code>size</code> elements, using a specified allocator. All the elements are constructed from the <code>init</code> value.</td>
108</tr>
109<tr>
110<td><code>unbounded_array (const unbounded_array &amp;a)</code></td>
111<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
112<td>The copy constructor.</td>
113</tr>
114<tr>
115<td><code>~unbounded_array ()</code></td>
116<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
117<td>Deallocates the <code>unbounded_array</code> itself.</td>
118</tr>
119<tr>
120<td><font color="red"><code>void resize (size_type n <em>, bool preserve = true</em>)</code></font></td>
121<td><a href="storage_concept.htm">Storage</a></td>
122<td>Reallocates an <code>unbounded_array</code> to hold at most <code>n</code> elements. When <code>preserve == false</code> the elements values after resize are undefined.</td>
123</tr>
124<tr>
125<td><code>void resize(size_type n, const T& t)</code></font></td>
126<td><a href="storage_concept.htm">Storage</a></td>
127<td>Reallocates an <code>unbounded_array</code> to hold at most <code>n</code> elements.
128</tr>
129<tr>
130<td><code>size_type size () const</code></td>
131<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
132<td>Returns the size of the <code>unbounded_array</code>.</td>
133</tr>
134<tr>
135<td><code>const_reference operator [] (size_type i) const</code></td>
136<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
137<td>Returns a <code>const</code> reference of the <code>i</code> -th element.</td>
138</tr>
139<tr>
140<td><code>reference operator [] (size_type i)</code></td>
141<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
142<td>Returns a reference of the <code>i</code>-th element.</td>
143</tr>
144<tr>
145<td><code>unbounded_array &amp;operator = (const unbounded_array &amp;a)</code></td>
146<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
147<td>The assignment operator.</td>
148</tr>
149<tr>
150<td><font color="blue"><code>unbounded_array &amp;assign_temporary (unbounded_array &amp;a)</code></font></td>
151<td></td>
152<td>Assigns a temporary. May change the array <code>a</code>.</td>
153</tr>
154<tr>
155<td><code>void swap (unbounded_array &amp;a)</code></td>
156<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
157<td>Swaps the contents of the arrays.</td>
158</tr>
159<tr>
160<td><code>const_iterator begin () const</code></td>
161<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
162<td>Returns a <code>const_iterator</code> pointing to the beginning
163of the <code>unbounded_array</code>.</td>
164</tr>
165<tr>
166<td><code>const_iterator end () const</code></td>
167<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
168<td>Returns a <code>const_iterator</code> pointing to the end of
169the <code>unbounded_array</code>.</td>
170</tr>
171<tr>
172<td><code>iterator begin ()</code></td>
173<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
174<td>Returns a <code>iterator</code> pointing to the beginning of
175the <code>unbounded_array</code>.</td>
176</tr>
177<tr>
178<td><code>iterator end ()</code></td>
179<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
180<td>Returns a <code>iterator</code> pointing to the end of the
181<code>unbounded_array</code>.</td>
182</tr>
183<tr>
184<td><code>const_reverse_iterator rbegin () const</code></td>
185<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
186<td>Returns a <code>const_reverse_iterator</code> pointing to the beginning of the reversed <code>unbounded_array</code>.</td>
187</tr>
188<tr>
189<td><code>const_reverse_iterator rend () const</code></td>
190<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
191<td>Returns a <code>const_reverse_iterator</code> pointing to the end of the reversed <code>unbounded_array</code>.</td>
192</tr>
193<tr>
194<td><code>reverse_iterator rbegin ()</code></td>
195<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
196<td>Returns a <code>reverse_iterator</code> pointing to the beginning of the reversed <code>unbounded_array</code>.</td>
197</tr>
198<tr>
199<td><code>reverse_iterator rend ()</code></td>
200<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
201<td>Returns a <code>reverse_iterator</code> pointing to the end of the reversed <code>unbounded_array</code>.</td>
202</tr>
203</tbody>
204</table>
205</body>
206</html>
Note: See TracBrowser for help on using the repository browser.