Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added boost

File size: 9.5 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>Bounded Array;</title>
8</head>
9<body>
10<h1><img src="../../../../boost.png" align="middle" />
11Bounded Array Storage</h1>
12<h2><a name="bounded_array" id="bounded_array"></a>Bounded Array&lt;T,N,Alloc&gt;</h2>
13<h4>Description</h4>
14<p>The templated class <code>bounded_array&lt;T, N, ALLOC&gt;</code> implements a bounded storage array. The bounded array is similar to a C++ array type in that its maximum size is bounded by N and is allocated on the stack instead of the heap. Similarly a <code>bounded_array</code> requires no secondary storage and ALLOC is only used to specify<code>size_type</code> and <code>difference_type</code>.
15</p>
16<p>When resized <code>bounded_array</code> uses the same storage with the same bound!. It is therefore efficient to resize a <code>bounded_array</code></p>
17<h4>Example</h4>
18<pre>
19#include &lt;boost/numeric/ublas/storage.hpp&gt;
20
21int main () {
22    using namespace boost::numeric::ublas;
23    bounded_array&lt;double, 3&gt; a (3);
24    for (unsigned i = 0; i &lt; a.size (); ++ i) {
25        a [i] = i;
26        std::cout &lt;&lt; a [i] &lt;&lt; std::endl;
27    }
28}
29</pre>
30<h4>Definition</h4>
31<p>Defined in the header storage.hpp.</p>
32<h4>Template parameters</h4>
33<table border="1" summary="parameters">
34<tbody>
35<tr>
36<th>Parameter</th>
37<th>Description</th>
38<th>Default</th>
39</tr>
40<tr>
41<td><code>T</code></td>
42<td>The type of object stored in the array.</td>
43<td></td>
44</tr>
45<tr>
46<td><code>N</code></td>
47<td>The allocation size of the array.</td>
48<td></td>
49</tr>
50<tr>
51<td><code>ALLOC</code></td>
52<td>An STL Allocator</td>
53<td>std::allocator</td>
54</tr>
55</tbody>
56</table>
57<h4>Model of</h4>
58<p>Random Access Container.</p>
59<h4>Type requirements</h4>
60<p>None, except for those imposed by the requirements of Random Access Container.</p>
61<h4>Public base classes</h4>
62<p>None.</p>
63<h4>Members</h4>
64Editor's notes:
65<ul>
66<li>The description does not describe what the member actually does, this can be looked up
67in the corresponding concept documentation, but instead contains a remark on the implementation of the
68member inside this model of the concept.</li>
69<li>Type setting:
70<ul>
71<li>Members that currently lack are <font color="red">in red</font>.</li>
72<li>Members that are not part of the implemented concepts are <font color="blue">in blue</font>.</li>
73<li>Differences compared to the concept are in <em>italics</em>.</li>
74</ul>
75</li>
76</ul>
77<table border="1" summary="members">
78<tbody>
79<tr>
80<th>Member</th>
81<th>Where defined</th>
82<th>Description</th>
83</tr>
84<tr><td><code>value_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td></tr>
85<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>
86<tr><td><code>const_pointer</code></td><td></td><td>Currently defined as <code>value_type*</code></td></tr>
87<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>
88<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>
89<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>
90<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>
91<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>
92<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>
93<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>
94<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>
95<tr>
96<td><code>bounded_array ()</code></td>
97<td>Creates a <code>bounded_array</code> that holds at most <strong>ZERO</strong> elements.</td>
98</tr>
99<tr>
100<td><code><em>explicit</em> bounded_array (size_type size, const T&amp; = init)</code></td>
101<td><a href="storage_concept.htm">Storage</a>
102<td>Creates an initialized <code>bounded_array</code> that holds at most <code>size</code> elements. All the elements are constructed from the <code>init</code> value.</td> </tr>
103<tr>
104<td><code>bounded_array (size_type size)</code></td>
105<td><a href="storage_concept.htm">Storage</a>
106<td>Creates an uninitialized <code>bounded_array</code> that holds at most <code>size</code> elements. All the elements are default constructed.</td>
107</tr>
108<tr>
109<td><code>bounded_array (size_type size, const T& init)</code></td>
110<td><a href="storage_concept.htm">Storage</a>
111<td>Creates an <code>bounded_array</code> that holds at most <code>size</code> elements. All the elements are copy-constructed from init.</td>
112</tr>
113<tr>
114<td><code>bounded_array (const bounded_array &amp;c)</code></td>
115<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
116<td>The copy constructor.</td>
117</tr>
118<tr>
119<td><code>~bounded_array ()</code></td>
120<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
121<td>Deallocates the <code>bounded_array</code> itself.</td>
122</tr>
123<tr>
124<td><code>void resize (size_type size)</code></td>
125<td><a href="storage_concept.htm">Storage</a>
126<td>Reallocates a <code>bounded_array</code> to hold at most <code>size</code> elements.</td>
127</tr>
128<tr>
129<td><code>void resize (size_type size, const T& t)</code></td>
130<td><a href="storage_concept.htm">Storage</a>
131<td>Reallocates a <code>bounded_array</code> to hold at most <code>size</code> elements.</td>
132</tr>
133<tr>
134<td><code>size_type size () const</code></td>
135<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
136<td>Returns the size of the <code>bounded_array</code>.</td>
137</tr>
138<tr>
139<td><code>const_reference operator [] (size_type i) const</code></td>
140<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
141<td>Returns a <code>const</code> reference of the <code>i</code> -th element.</td>
142</tr>
143<tr>
144<td><code>reference operator [] (size_type i)</code></td>
145<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
146<td>Returns a reference of the <code>i</code>-th element.</td>
147</tr>
148<tr>
149<td><code>bounded_array &amp;operator = (const bounded_array &amp;a)</code></td>
150<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
151<td>The assignment operator.</td>
152</tr>
153<tr>
154<td><font color="blue"><code>bounded_array &amp;assign_temporary (bounded_array &amp;a)</code></font></td>
155<td></td>
156<td>Assigns a temporary. May change the array <code>a</code>.</td>
157</tr>
158<tr>
159<td><code>void swap (bounded_array &amp;a)</code></td>
160<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
161<td>Swaps the contents of the arrays.</td>
162</tr>
163<tr>
164<td><code>const_iterator begin () const</code></td>
165<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
166<td>Returns a <code>const_iterator</code> pointing to the beginning of the <code>bounded_array</code>.</td>
167</tr>
168<tr>
169<td><code>const_iterator end () const</code></td>
170<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
171<td>Returns a <code>const_iterator</code> pointing to the end of the <code>bounded_array</code>.</td> 
172</tr>
173<tr>
174<td><code>iterator begin ()</code></td>
175<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
176<td>Returns a <code>iterator</code> pointing to the beginning of the <code>bounded_array</code>.</td>
177</tr>
178<tr>
179<td><code>iterator end ()</code></td>
180<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
181<td>Returns a <code>iterator</code> pointing to the end of the <code>bounded_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>bounded_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>bounded_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>bounded_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>bounded_array</code>.</td>
202</tr>
203</tbody>
204</table>
205</body>
206</html>
Note: See TracBrowser for help on using the repository browser.