Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / numeric / ublas / doc / storage_concept.html
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 name="generator" content=
6 "HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
7 <meta http-equiv="Content-Type" content=
8 "text/html; charset=us-ascii" />
9 <link rel="stylesheet" href="../../../../boost.css" type="text/css"/>
10 <link rel="stylesheet" href="ublas.css" type="text/css" />
11 <script type="text/javascript" src="js/jquery-1.3.2.min.js" async="async" ></script>
12 <script type="text/javascript" src="js/jquery.toc-gw.js" async="async" ></script>
13 <title>Storage concept</title>
14 </head>
15 <body>
16 <h1><img src="../../../../boost.png" align="middle" />Storage concept</h1>
17 <div class="toc" id="toc"></div>
18 <h2><a name="range"></a>Storage concept</h2>
19 <h4>Description</h4>
20 <p>Storage is a variable-size container whose elements are arranged in a strict linear order.
21 <p>Storage extends the STL Container concept with some STL Sequence-like functionality. The main difference with
22 the Sequence concept however is that the Storage concept does not require default-initialisation of its
23 elements.
24 <h4>Refinement of</h4>
25 <a href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random Access Container</a>
26 and 
27 <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">Default Constructible</a>
28 <h4>Associated types</h4>
29 No additional types beyond those defined by 
30 <a href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random Access Container</a>
31 <h4>Notation</h4>
32 <table summary="storage types">
33 <tr><td><tt>X</tt></td><td>A type that is model of Storage</td></tr>
34 <tr><td><tt>T</tt></td><td>The value_type of <tt>X</tt></td></tr>
35 <tr><td><tt>t</tt></td><td>An object of type <tt>T</tt></td></tr>
36 <tr><td><tt>n</tt></td><td>object of type convertible to <tt>X::size_type</tt></td></tr>
37 </table>
38 <h4>Definitions</h4>
39 <h4>Valid expressions</h4>
40 In addition to the expressions defined in 
41 <a href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random Access Container</a>,
42 and 
43 <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">Default Constructible</a>
44 the following expressions must be valid:
45 <table border="1" summary="type requirements">
46 <TR><TH>Name</TH><TH>Expression</TH><TH>Type requirements</TH><TH>Return type</TH></TR>
47 <TR>
48 <td>Size constructor</td>
49 <td><tt>X(n)</tt></td>
50 <td>T is <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">DefaultConstructible</a></td>
51 <td><tt>X</tt></td>
52 </TR>
53 <TR>
54 <td>Fill constructor</td>
55 <td><tt>X(n,t)</tt></td>
56 <td></td>
57 <td><tt>X</tt></td>
58 </TR>
59 <TR>
60 <TD>Range constructor</TD>
61 <TD><tt>X(i, j)</tt></TD>
62 <TD><tt>i</tt> and <tt>j</tt> are <A href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterators</A> whose value type is convertible to <tt>T</tt> </TD>
63 <TD><tt>X</tt> </TD>
64 </TR>
65 <TR>
66 <TD>Resize</TD>
67 <TD><tt>a.resize(n, t)</tt></TD>
68 <TD><tt>a</tt> is mutable</TD>
69 <TD><tt>void</tt></TD>
70 </TR>
71 <TR>
72 <TD>Resize</TD>
73 <TD><tt>a.resize(n)</tt></TD>
74 <TD><tt>a</tt> is mutable</TD>
75 <TD><tt>void</tt></TD>
76 </tr>
77 </table>
78 <h3>Expression semantics</h3>
79 <table border="1" summary="expresisons">
80 <tr><th>Name<th>Expression<th>Precondition<th>Semantics<th>Postcondition
81 <tr>
82 <td>Default-constructor</td>
83 <td><tt>X()</tt>
84 <td></td>
85 <td>Creates 0 elements. 
86 </td>
87 <td><tt>size()==0</tt></td>
88 </tr>
89 <tr>
90 <td>Size-constructor</td>
91 <td><tt>X(n)</tt>
92 <td><tt>n>=0</tt></td>
93 <td>Creates n elements. Elements are constructed without an initializer. That is
94 if T is a (possibly cv-qualified) non-POD class type (or array thereof), the object is default
95 initialized. Otherwise, the object created has indeterminate value. See the sentance
96 "If new initializer is omitted" in section 5.3.4 paragraph 15 of the ISO C++ standard.
97 </td>
98 <td><tt>size()==n</tt></td>
99 </tr>
100 <tr>
101 <td>Fill-constructor</td>
102 <td><tt>X(n,t)</tt>
103 <td><tt>n>=0</tt></td>
104 <td>Creates n initialised element with copies of <code>t</code></td>
105 <td><tt>size()==n</tt></td>
106 </tr>
107 <TR>
108 <TD>Range constructor</TD>
109 <TD><tt>X(i, j)</tt></TD>
110 <TD><tt>[i,j)</tt> is a valid range.</TD>
111 <TD>copies the range <tt>[i,j) to the storage</tt></TD>
112 <TD><tt>size()</tt> is equal to the distance from <tt>i</tt> to <tt>j</tt>.  Each element is a copy of the corresponding element in the range <tt>[i,j)</tt>.</TD>
113 </TR>
114 <TR>
115 <TD>Resize</TD>
116 <TD><tt>a.resize(n, t)</tt></TD>
117 <TD><tt>n &lt;= a.max_size()</tt></TD>
118 <td>Modified the container so that it has exactly <tt>n</tt> elements.<br />
119 The container may be reallocated if its size changes.
120 Existing element values are preserved, additional elements are copies of <code>t</code>.</td>
121 <TD><tt>a.size() == n</tt></TD>
122 </TR>
123 <TR>
124 <TD>Resize</TD>
125 <TD><tt>a.resize(n)</tt></TD>
126 <TD><tt>n &lt;= a.max_size()</tt></TD>
127 <TD>Modified the container so that it has exactly <tt>n</tt> elements.<br />
128 The container may be reallocated if its size changes. Element values are uninitialised. That is,
129 each element value may be a previously assigned value or default construced value for <code>T</code>.</TD>
130 <TD><tt>a.size() == n</tt></TD>
131 </tr>
132 </table>
133 <h4>Complexity guarantees</h4>
134 <h4>Invariants</h4>
135 <h4>Models</h4>
136 <ul>
137 <li><a href="unbounded_array.html">unbounded_array</a>
138 <li><a href="bounded_array.html">bounded_array</a>
139 </ul>
140 <h4>Notes</h4>
141 <hr />
142 <p>Copyright (&copy;) 2000-2002 Joerg Walter, Mathias Koch<br />
143    Use, modification and distribution are subject to the
144    Boost Software License, Version 1.0.
145    (See accompanying file LICENSE_1_0.txt
146    or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
147       http://www.boost.org/LICENSE_1_0.txt
148    </a>).
149 </p>
150
151 <script type="text/javascript">
152 (function($) {
153     $('#toc').toc();
154 })(jQuery);
155 </script>
156 </body>
157 </html>