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">
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>Unbounded array
</title>
13 <h1><img src=
"../../../../boost.png" align=
"middle" />Unbounded Array Storage
</h1>
14 <div class=
"toc" id=
"toc"></div>
15 <h2><a name=
"unbounded_array"></a>Unbounded Array
</h2>
17 <p>The templated class
<code>unbounded_array
<T, ALLOC
></code> implements a unbounded storage array using an allocator.
18 The unbounded array is similar to a
<code>std::vector
</code> in that in can grow in size beyond any fixed bound.
19 However
<code>unbounded_array
</code> is aimed at optimal performance. Therefore
<code>unbounded_array
</code> does not model a
20 <code>Sequence
</code> like
<code>std::vector
</code> does.
21 <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>
24 #include
<boost/numeric/ublas/storage.hpp
>
27 using namespace boost::numeric::ublas;
28 unbounded_array
<double
> a (
3);
29 for (unsigned i =
0; i
< a.size (); ++ i) {
31 std::cout
<< a [i]
<< std::endl;
36 <p>Defined in the header storage.hpp.
</p>
37 <h4>Template parameters
</h4>
38 <table border=
"1" summary=
"parameters">
46 <td><code>T
</code></td>
47 <td>The type of object stored in the array.
</td>
51 <td><code>ALLOC
</code></td>
52 <td>An STL Allocator
</td>
53 <td>std::allocator
</td>
58 <p><a href=
"storage_concept.html">Storage
</a></p>
59 <h4>Type requirements
</h4>
60 <p>None, except for those imposed by the requirements of Storage.
</p>
61 <h4>Public base classes
</h4>
65 <li>The description does not describe what the member actually does, this can be looked up
66 in the corresponding concept documentation, but instead contains a remark on the implementation of the
67 member inside this model of the concept.
</li>
70 <li>Members that are not part of the implemented concepts are
<font color=
"blue">in blue
</font>.
</li>
74 <table border=
"1" summary=
"members">
78 <th>Where defined
</th>
81 <tr><td><code>value_type
</code></td><td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td><td></tr>
82 <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>
83 <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>
84 <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>
85 <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>
86 <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>
87 <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>
88 <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>
89 <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>
90 <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>
91 <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>
92 <tr><td><font color=
"blue">allocator_type
</font></td><td></td><td>Defined as ALLOC
</td></tr>
94 <td><code><em>explicit
</em> unbounded_array (
<em>ALLOC
&a = ALLOC()
</em>)
</code></td>
95 <td><a href=
"storage_concept.html">Storage
</a></td>
96 <td>Creates an
<code>unbounded_array
</code> that holds zero elements, using a specified allocator.
</td>
99 <td><code><em>explicit
</em> unbounded_array (size_type size
<em>, ALLOC
&a = ALLOC()
</em>)
</code></td>
100 <td><a href=
"storage_concept.html">Storage
</a></td>
101 <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>
104 <td><code>unbounded_array (size_type size, const T
& init
<em>, ALLOC
& a = ALLOC()
</em>)
</code></td>
105 <td><a href=
"storage_concept.html">Storage
</a></td>
106 <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>
109 <td><code>unbounded_array (const unbounded_array
&a)
</code></td>
110 <td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td>
111 <td>The copy constructor.
</td>
114 <td><code>~unbounded_array ()
</code></td>
115 <td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td>
116 <td>Deallocates the
<code>unbounded_array
</code> itself.
</td>
119 <td><code>void resize (size_type n)
</code></td>
120 <td><a href=
"storage_concept.html">Storage
</a></td>
121 <td>Reallocates an
<code>unbounded_array
</code> to hold
<code>n
</code> elements. Values are uninitialised.
</td>
124 <td><code>void resize(size_type n, const T
& t)
</code></td>
125 <td><a href=
"storage_concept.html">Storage
</a></td>
126 <td>Reallocates an
<code>unbounded_array
</code> to hold
<code>n
</code> elements. Values are copies of
<code>t
</code>
129 <td><code>size_type size () const
</code></td>
130 <td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td>
131 <td>Returns the size of the
<code>unbounded_array
</code>.
</td>
134 <td><code>const_reference operator [] (size_type i) const
</code></td>
135 <td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td>
136 <td>Returns a
<code>const
</code> reference of the
<code>i
</code> -th element.
</td>
139 <td><code>reference operator [] (size_type i)
</code></td>
140 <td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td>
141 <td>Returns a reference of the
<code>i
</code>-th element.
</td>
144 <td><code>unbounded_array
&operator = (const unbounded_array
&a)
</code></td>
145 <td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td>
146 <td>The assignment operator.
</td>
149 <td><font color=
"blue"><code>unbounded_array
&assign_temporary (unbounded_array
&a)
</code></font></td>
151 <td>Assigns a temporary. May change the array
<code>a
</code>.
</td>
154 <td><code>void swap (unbounded_array
&a)
</code></td>
155 <td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td>
156 <td>Swaps the contents of the arrays.
</td>
159 <td><code>const_iterator begin () const
</code></td>
160 <td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td>
161 <td>Returns a
<code>const_iterator
</code> pointing to the beginning
162 of the
<code>unbounded_array
</code>.
</td>
165 <td><code>const_iterator end () const
</code></td>
166 <td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td>
167 <td>Returns a
<code>const_iterator
</code> pointing to the end of
168 the
<code>unbounded_array
</code>.
</td>
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
174 the
<code>unbounded_array
</code>.
</td>
177 <td><code>iterator end ()
</code></td>
178 <td><a href=
"http://www.sgi.com/tech/stl/Container.html">Container
</a></td>
179 <td>Returns a
<code>iterator
</code> pointing to the end of the
180 <code>unbounded_array
</code>.
</td>
183 <td><code>const_reverse_iterator rbegin () const
</code></td>
184 <td><a href=
"http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container
</a></td>
185 <td>Returns a
<code>const_reverse_iterator
</code> pointing to the beginning of the reversed
<code>unbounded_array
</code>.
</td>
188 <td><code>const_reverse_iterator rend () const
</code></td>
189 <td><a href=
"http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container
</a></td>
190 <td>Returns a
<code>const_reverse_iterator
</code> pointing to the end of the reversed
<code>unbounded_array
</code>.
</td>
193 <td><code>reverse_iterator rbegin ()
</code></td>
194 <td><a href=
"http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container
</a></td>
195 <td>Returns a
<code>reverse_iterator
</code> pointing to the beginning of the reversed
<code>unbounded_array
</code>.
</td>
198 <td><code>reverse_iterator rend ()
</code></td>
199 <td><a href=
"http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container
</a></td>
200 <td>Returns a
<code>reverse_iterator
</code> pointing to the end of the reversed
<code>unbounded_array
</code>.
</td>
205 <p>Copyright (
©)
2000-
2002 Joerg Walter, Mathias Koch
<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
213 <script type=
"text/javascript">