]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 rel="stylesheet" href="../../../../boost.css" type="text/css"/> | |
7 | <link rel="stylesheet" href="ublas.css" type="text/css" /> | |
8 | <script type="text/javascript" src="js/jquery-1.3.2.min.js" async="async" ></script> | |
9 | <script type="text/javascript" src="js/jquery.toc-gw.js" async="async" ></script> | |
10 | <title>Bounded Array;</title> | |
11 | </head> | |
12 | <body> | |
13 | <h1><img src="../../../../boost.png" align="middle" />Bounded Array Storage</h1> | |
14 | <div class="toc" id="toc"></div> | |
15 | <h2><a name="bounded_array"></a>Bounded Array</h2> | |
16 | <h4>Description</h4> | |
17 | <p>The templated class <code>bounded_array<T, N, ALLOC></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>. | |
18 | </p> | |
19 | <p>When resized <code>bounded_array</code> never reallocated the storage. It is therefore always efficient to resize a <code>bounded_array</code> but the size bound N must not be exceeded.</p> | |
20 | <h4>Example</h4> | |
21 | <pre> | |
22 | #include <boost/numeric/ublas/storage.hpp> | |
23 | ||
24 | int main () { | |
25 | using namespace boost::numeric::ublas; | |
26 | bounded_array<double, 3> a (3); | |
27 | for (unsigned i = 0; i < a.size (); ++ i) { | |
28 | a [i] = i; | |
29 | std::cout << a [i] << std::endl; | |
30 | } | |
31 | } | |
32 | </pre> | |
33 | <h4>Definition</h4> | |
34 | <p>Defined in the header storage.hpp.</p> | |
35 | <h4>Template parameters</h4> | |
36 | <table border="1" summary="parameters"> | |
37 | <tbody> | |
38 | <tr> | |
39 | <th>Parameter</th> | |
40 | <th>Description</th> | |
41 | <th>Default</th> | |
42 | </tr> | |
43 | <tr> | |
44 | <td><code>T</code></td> | |
45 | <td>The type of object stored in the array.</td> | |
46 | <td></td> | |
47 | </tr> | |
48 | <tr> | |
49 | <td><code>N</code></td> | |
50 | <td>The allocation size of the array.</td> | |
51 | <td></td> | |
52 | </tr> | |
53 | <tr> | |
54 | <td><code>ALLOC</code></td> | |
55 | <td>An STL Allocator</td> | |
56 | <td>std::allocator</td> | |
57 | </tr> | |
58 | </tbody> | |
59 | </table> | |
60 | <h4>Model of</h4> | |
61 | <p><a href="storage_concept.html">Storage</a></p> | |
62 | <h4>Type requirements</h4> | |
63 | <p>None, except for those imposed by the requirements of Storage.</p> | |
64 | <h4>Public base classes</h4> | |
65 | <p>None.</p> | |
66 | <h4>Members</h4> | |
67 | <ul> | |
68 | <li>The description does not describe what the member actually does, this can be looked up | |
69 | in the corresponding concept documentation, but instead contains a remark on the implementation of the | |
70 | member inside this model of the concept.</li> | |
71 | <li>Typography: | |
72 | <ul> | |
73 | <li>Members that are not part of the implemented concepts are <font color="blue">in blue</font>.</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>Defined as <code>value_type*</code></td></tr> | |
86 | <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> | |
87 | <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&</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>Defined as <code>const value_type&</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>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>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>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>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>Defined as <code>std::reverse_iterator<iterator></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>Defined as <code>std::reverse_iterator<const_iterator></code></td></tr> | |
95 | <tr> | |
96 | <td><code>bounded_array ()</code></td> | |
97 | <td><a href="storage_concept.html">Storage</a></td> | |
98 | <td>Creates an <code>unbounded_array</code> that holds <strong>zero</strong> elements.</td> | |
99 | </tr> | |
100 | <tr> | |
101 | <td><code>bounded_array (size_type size)</code></td> | |
102 | <td><a href="storage_concept.html">Storage</a></td> | |
103 | <td>Creates a uninitialized <code>bounded_array</code> that holds <code>size</code> elements. All the elements are default constructed.</td> | |
104 | </tr> | |
105 | <tr> | |
106 | <td><code>bounded_array (size_type size, const T& init)</code></td> | |
107 | <td><a href="storage_concept.html">Storage</a></td> | |
108 | <td>Creates an initialized <code>bounded_array</code> that holds <code>size</code> elements. All the elements are constructed from the <code>init</code> value.</td> | |
109 | </tr> | |
110 | <tr> | |
111 | <td><code>bounded_array (const bounded_array &c)</code></td> | |
112 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> | |
113 | <td>The copy constructor.</td> | |
114 | </tr> | |
115 | <tr> | |
116 | <td><code>~bounded_array ()</code></td> | |
117 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> | |
118 | <td>Deallocates the <code>bounded_array</code> itself.</td> | |
119 | </tr> | |
120 | <tr> | |
121 | <td><code>void resize (size_type size)</code></td> | |
122 | <td><a href="storage_concept.html">Storage</a> | |
123 | <td>Reallocates a <code>bounded_array</code> to hold <code>size</code> elements.</td> | |
124 | </tr> | |
125 | <tr> | |
126 | <td><code>void resize (size_type size, const T& t)</code></td> | |
127 | <td><a href="storage_concept.html">Storage</a> | |
128 | <td>Reallocates a <code>bounded_array</code> to hold <code>size</code> elements.</td> | |
129 | </tr> | |
130 | <tr> | |
131 | <td><code>size_type size () const</code></td> | |
132 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> | |
133 | <td>Returns the size of the <code>bounded_array</code>.</td> | |
134 | </tr> | |
135 | <tr> | |
136 | <td><code>const_reference operator [] (size_type i) const</code></td> | |
137 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> | |
138 | <td>Returns a <code>const</code> reference of the <code>i</code> -th element.</td> | |
139 | </tr> | |
140 | <tr> | |
141 | <td><code>reference operator [] (size_type i)</code></td> | |
142 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> | |
143 | <td>Returns a reference of the <code>i</code>-th element.</td> | |
144 | </tr> | |
145 | <tr> | |
146 | <td><code>bounded_array &operator = (const bounded_array &a)</code></td> | |
147 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> | |
148 | <td>The assignment operator.</td> | |
149 | </tr> | |
150 | <tr> | |
151 | <td><font color="blue"><code>bounded_array &assign_temporary (bounded_array &a)</code></font></td> | |
152 | <td></td> | |
153 | <td>Assigns a temporary. May change the array <code>a</code>.</td> | |
154 | </tr> | |
155 | <tr> | |
156 | <td><code>void swap (bounded_array &a)</code></td> | |
157 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> | |
158 | <td>Swaps the contents of the arrays.</td> | |
159 | </tr> | |
160 | <tr> | |
161 | <td><code>const_iterator begin () const</code></td> | |
162 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> | |
163 | <td>Returns a <code>const_iterator</code> pointing to the beginning of the <code>bounded_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 the <code>bounded_array</code>.</td> | |
169 | </tr> | |
170 | <tr> | |
171 | <td><code>iterator begin ()</code></td> | |
172 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> | |
173 | <td>Returns a <code>iterator</code> pointing to the beginning of the <code>bounded_array</code>.</td> | |
174 | </tr> | |
175 | <tr> | |
176 | <td><code>iterator end ()</code></td> | |
177 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> | |
178 | <td>Returns a <code>iterator</code> pointing to the end of the <code>bounded_array</code>.</td> | |
179 | </tr> | |
180 | <tr> | |
181 | <td><code>const_reverse_iterator rbegin () const</code></td> | |
182 | <td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td> | |
183 | <td>Returns a <code>const_reverse_iterator</code> pointing to the beginning of the reversed <code>bounded_array</code>.</td> | |
184 | </tr> | |
185 | <tr> | |
186 | <td><code>const_reverse_iterator rend () const</code></td> | |
187 | <td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td> | |
188 | <td>Returns a <code>const_reverse_iterator</code> pointing to the end of the reversed <code>bounded_array</code>.</td> | |
189 | </tr> | |
190 | <tr> | |
191 | <td><code>reverse_iterator rbegin ()</code></td> | |
192 | <td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td> | |
193 | <td>Returns a <code>reverse_iterator</code> pointing to the beginning of the reversed <code>bounded_array</code>.</td> | |
194 | </tr> | |
195 | <tr> | |
196 | <td><code>reverse_iterator rend ()</code></td> | |
197 | <td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td> | |
198 | <td>Returns a <code>reverse_iterator</code> pointing to the end of the reversed <code>bounded_array</code>.</td> | |
199 | </tr> | |
200 | </tbody> | |
201 | </table> | |
202 | <hr /> | |
203 | <p> | |
204 | Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, | |
205 | Joerg Walter, Gunter Winkler<br /> | |
206 | Use, modification and distribution are subject to the | |
207 | Boost Software License, Version 1.0. | |
208 | (See accompanying file LICENSE_1_0.txt | |
209 | or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> | |
210 | http://www.boost.org/LICENSE_1_0.txt | |
211 | </a>). | |
212 | </p> | |
213 | <script type="text/javascript"> | |
214 | (function($) { | |
215 | $('#toc').toc(); | |
216 | })(jQuery); | |
217 | </script> | |
218 | </body> | |
219 | </html> |