| 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" /> |
|---|
| 11 | Unbounded Array Storage</h1> |
|---|
| 12 | <h2><a name="unbounded_array" id="unbounded_array"></a>Unbounded Array</h2> |
|---|
| 13 | <h4>Description</h4> |
|---|
| 14 | <p>The templated class <code>unbounded_array<T, ALLOC></code> implements a unbounded storage array using an allocator. |
|---|
| 15 | The unbounded array is similar to a <code>std::vector</code> in that in can grow in size beyond any fixed bound. |
|---|
| 16 | However <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 <boost/numeric/ublas/storage.hpp> |
|---|
| 22 | |
|---|
| 23 | int main () { |
|---|
| 24 | using namespace boost::numeric::ublas; |
|---|
| 25 | unbounded_array<double> a (3); |
|---|
| 26 | for (unsigned i = 0; i < a.size (); ++ i) { |
|---|
| 27 | a [i] = i; |
|---|
| 28 | std::cout << a [i] << 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 Storage.</p> |
|---|
| 58 | <h4>Public base classes</h4> |
|---|
| 59 | <p>None.</p> |
|---|
| 60 | <h4>Members</h4> |
|---|
| 61 | <ul> |
|---|
| 62 | <li>The description does not describe what the member actually does, this can be looked up |
|---|
| 63 | in the corresponding concept documentation, but instead contains a remark on the implementation of the |
|---|
| 64 | member inside this model of the concept.</li> |
|---|
| 65 | <li>Typography: |
|---|
| 66 | <ul> |
|---|
| 67 | <li>Members that are not part of the implemented concepts are <font color="blue">in blue</font>.</li> |
|---|
| 68 | </ul> |
|---|
| 69 | </li> |
|---|
| 70 | </ul> |
|---|
| 71 | <table border="1" summary="members"> |
|---|
| 72 | <tbody> |
|---|
| 73 | <tr> |
|---|
| 74 | <th>Member</th> |
|---|
| 75 | <th>Where defined</th> |
|---|
| 76 | <th>Description</th> |
|---|
| 77 | </tr> |
|---|
| 78 | <tr><td><code>value_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td></tr> |
|---|
| 79 | <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> |
|---|
| 80 | <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> |
|---|
| 81 | <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> |
|---|
| 82 | <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> |
|---|
| 83 | <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> |
|---|
| 84 | <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> |
|---|
| 85 | <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> |
|---|
| 86 | <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> |
|---|
| 87 | <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> |
|---|
| 88 | <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> |
|---|
| 89 | <tr><td><font color="blue">allocator_type</font></td><td></td><td>Defined as ALLOC</td></tr> |
|---|
| 90 | <tr> |
|---|
| 91 | <td><code><em>explicit</em> unbounded_array (<em>ALLOC &a = ALLOC()</em>)</code></td> |
|---|
| 92 | <td><a href="storage_concept.htm">Storage</a></td> |
|---|
| 93 | <td>Creates an <code>unbounded_array</code> that holds zero elements, using a specified allocator.</td> |
|---|
| 94 | </tr> |
|---|
| 95 | <tr> |
|---|
| 96 | <td><code><em>explicit</em> unbounded_array (size_type size<em>, ALLOC &a = ALLOC()</em>)</code></td> |
|---|
| 97 | <td><a href="storage_concept.htm">Storage</a></td> |
|---|
| 98 | <td>Creates a uninitialized <code>unbounded_array</code> that holds <code>size</code> elements, using a specified allocator. All the elements are default constructed.</td> |
|---|
| 99 | </tr> |
|---|
| 100 | <tr> |
|---|
| 101 | <td><code>unbounded_array (size_type size, const T& init<em>, ALLOC& a = ALLOC()</em>)</code></td> |
|---|
| 102 | <td><a href="storage_concept.htm">Storage</a></td> |
|---|
| 103 | <td>Creates an initialized <code>unbounded_array</code> that holds <code>size</code> elements, using a specified allocator. All the elements are constructed from the <code>init</code> value.</td> |
|---|
| 104 | </tr> |
|---|
| 105 | <tr> |
|---|
| 106 | <td><code>unbounded_array (const unbounded_array &a)</code></td> |
|---|
| 107 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> |
|---|
| 108 | <td>The copy constructor.</td> |
|---|
| 109 | </tr> |
|---|
| 110 | <tr> |
|---|
| 111 | <td><code>~unbounded_array ()</code></td> |
|---|
| 112 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> |
|---|
| 113 | <td>Deallocates the <code>unbounded_array</code> itself.</td> |
|---|
| 114 | </tr> |
|---|
| 115 | <tr> |
|---|
| 116 | <td><code>void resize (size_type n)</code></td> |
|---|
| 117 | <td><a href="storage_concept.htm">Storage</a></td> |
|---|
| 118 | <td>Reallocates an <code>unbounded_array</code> to hold <code>n</code> elements. Values are uninitialised.</td> |
|---|
| 119 | </tr> |
|---|
| 120 | <tr> |
|---|
| 121 | <td><code>void resize(size_type n, const T& t)</code></td> |
|---|
| 122 | <td><a href="storage_concept.htm">Storage</a></td> |
|---|
| 123 | <td>Reallocates an <code>unbounded_array</code> to hold <code>n</code> elements. Values are copies of <code>t</code> |
|---|
| 124 | </tr> |
|---|
| 125 | <tr> |
|---|
| 126 | <td><code>size_type size () const</code></td> |
|---|
| 127 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> |
|---|
| 128 | <td>Returns the size of the <code>unbounded_array</code>.</td> |
|---|
| 129 | </tr> |
|---|
| 130 | <tr> |
|---|
| 131 | <td><code>const_reference operator [] (size_type i) const</code></td> |
|---|
| 132 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> |
|---|
| 133 | <td>Returns a <code>const</code> reference of the <code>i</code> -th element.</td> |
|---|
| 134 | </tr> |
|---|
| 135 | <tr> |
|---|
| 136 | <td><code>reference operator [] (size_type i)</code></td> |
|---|
| 137 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> |
|---|
| 138 | <td>Returns a reference of the <code>i</code>-th element.</td> |
|---|
| 139 | </tr> |
|---|
| 140 | <tr> |
|---|
| 141 | <td><code>unbounded_array &operator = (const unbounded_array &a)</code></td> |
|---|
| 142 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> |
|---|
| 143 | <td>The assignment operator.</td> |
|---|
| 144 | </tr> |
|---|
| 145 | <tr> |
|---|
| 146 | <td><font color="blue"><code>unbounded_array &assign_temporary (unbounded_array &a)</code></font></td> |
|---|
| 147 | <td></td> |
|---|
| 148 | <td>Assigns a temporary. May change the array <code>a</code>.</td> |
|---|
| 149 | </tr> |
|---|
| 150 | <tr> |
|---|
| 151 | <td><code>void swap (unbounded_array &a)</code></td> |
|---|
| 152 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> |
|---|
| 153 | <td>Swaps the contents of the arrays.</td> |
|---|
| 154 | </tr> |
|---|
| 155 | <tr> |
|---|
| 156 | <td><code>const_iterator begin () const</code></td> |
|---|
| 157 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> |
|---|
| 158 | <td>Returns a <code>const_iterator</code> pointing to the beginning |
|---|
| 159 | of the <code>unbounded_array</code>.</td> |
|---|
| 160 | </tr> |
|---|
| 161 | <tr> |
|---|
| 162 | <td><code>const_iterator end () const</code></td> |
|---|
| 163 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> |
|---|
| 164 | <td>Returns a <code>const_iterator</code> pointing to the end of |
|---|
| 165 | the <code>unbounded_array</code>.</td> |
|---|
| 166 | </tr> |
|---|
| 167 | <tr> |
|---|
| 168 | <td><code>iterator begin ()</code></td> |
|---|
| 169 | <td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td> |
|---|
| 170 | <td>Returns a <code>iterator</code> pointing to the beginning of |
|---|
| 171 | the <code>unbounded_array</code>.</td> |
|---|
| 172 | </tr> |
|---|
| 173 | <tr> |
|---|
| 174 | <td><code>iterator end ()</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 end of the |
|---|
| 177 | <code>unbounded_array</code>.</td> |
|---|
| 178 | </tr> |
|---|
| 179 | <tr> |
|---|
| 180 | <td><code>const_reverse_iterator rbegin () const</code></td> |
|---|
| 181 | <td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td> |
|---|
| 182 | <td>Returns a <code>const_reverse_iterator</code> pointing to the beginning of the reversed <code>unbounded_array</code>.</td> |
|---|
| 183 | </tr> |
|---|
| 184 | <tr> |
|---|
| 185 | <td><code>const_reverse_iterator rend () const</code></td> |
|---|
| 186 | <td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td> |
|---|
| 187 | <td>Returns a <code>const_reverse_iterator</code> pointing to the end of the reversed <code>unbounded_array</code>.</td> |
|---|
| 188 | </tr> |
|---|
| 189 | <tr> |
|---|
| 190 | <td><code>reverse_iterator rbegin ()</code></td> |
|---|
| 191 | <td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td> |
|---|
| 192 | <td>Returns a <code>reverse_iterator</code> pointing to the beginning of the reversed <code>unbounded_array</code>.</td> |
|---|
| 193 | </tr> |
|---|
| 194 | <tr> |
|---|
| 195 | <td><code>reverse_iterator rend ()</code></td> |
|---|
| 196 | <td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td> |
|---|
| 197 | <td>Returns a <code>reverse_iterator</code> pointing to the end of the reversed <code>unbounded_array</code>.</td> |
|---|
| 198 | </tr> |
|---|
| 199 | </tbody> |
|---|
| 200 | </table> |
|---|
| 201 | </body> |
|---|
| 202 | </html> |
|---|