| 1 | <html> |
|---|
| 2 | <head> |
|---|
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|---|
| 4 | <title>Class template array</title> |
|---|
| 5 | <link rel="stylesheet" href="../boostbook.css" type="text/css"> |
|---|
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.68.1"> |
|---|
| 7 | <link rel="start" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> |
|---|
| 8 | <link rel="up" href="../array/reference.html#header.boost.array.hpp" title="Header <boost/array.hpp>"> |
|---|
| 9 | <link rel="prev" href="../array/reference.html" title="Reference"> |
|---|
| 10 | <link rel="next" href="../array/rationale.html" title="Design Rationale"> |
|---|
| 11 | </head> |
|---|
| 12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
|---|
| 13 | <table cellpadding="2" width="100%"> |
|---|
| 14 | <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td> |
|---|
| 15 | <td align="center"><a href="../../../index.htm">Home</a></td> |
|---|
| 16 | <td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td> |
|---|
| 17 | <td align="center"><a href="../../../people/people.htm">People</a></td> |
|---|
| 18 | <td align="center"><a href="../../../more/faq.htm">FAQ</a></td> |
|---|
| 19 | <td align="center"><a href="../../../more/index.htm">More</a></td> |
|---|
| 20 | </table> |
|---|
| 21 | <hr> |
|---|
| 22 | <div class="spirit-nav"> |
|---|
| 23 | <a accesskey="p" href="../array/reference.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../array/reference.html#header.boost.array.hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../array/rationale.html"><img src="../images/next.png" alt="Next"></a> |
|---|
| 24 | </div> |
|---|
| 25 | <div class="refentry" lang="en"> |
|---|
| 26 | <a name="boost.array"></a><div class="titlepage"></div> |
|---|
| 27 | <div class="refnamediv"> |
|---|
| 28 | <h2><span class="refentrytitle">Class template array</span></h2> |
|---|
| 29 | <p>boost::array — <p>STL compliant container wrapper for arrays of constant size</p></p> |
|---|
| 30 | </div> |
|---|
| 31 | <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> |
|---|
| 32 | <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 33 | <span class="bold"><strong>class</strong></span> array { |
|---|
| 34 | <span class="bold"><strong>public</strong></span>: |
|---|
| 35 | <span class="emphasis"><em>// types</em></span> |
|---|
| 36 | <span class="bold"><strong>typedef</strong></span> T value_type; |
|---|
| 37 | <span class="bold"><strong>typedef</strong></span> T* iterator; |
|---|
| 38 | <span class="bold"><strong>typedef</strong></span> <span class="bold"><strong>const</strong></span> T* const_iterator; |
|---|
| 39 | <span class="bold"><strong>typedef</strong></span> std::reverse_iterator<iterator> reverse_iterator; |
|---|
| 40 | <span class="bold"><strong>typedef</strong></span> std::reverse_iterator<const_iterator> const_reverse_iterator; |
|---|
| 41 | <span class="bold"><strong>typedef</strong></span> T& reference; |
|---|
| 42 | <span class="bold"><strong>typedef</strong></span> <span class="bold"><strong>const</strong></span> T& const_reference; |
|---|
| 43 | <span class="bold"><strong>typedef</strong></span> std::size_t size_type; |
|---|
| 44 | <span class="bold"><strong>typedef</strong></span> std::ptrdiff_t difference_type; |
|---|
| 45 | |
|---|
| 46 | <span class="emphasis"><em>// static constants</em></span> |
|---|
| 47 | <span class="bold"><strong>static</strong></span> <span class="bold"><strong>const</strong></span> size_type static_size = N; |
|---|
| 48 | |
|---|
| 49 | <span class="emphasis"><em>// <a href="array.html#boost.arrayconstruct-copy-destruct">construct/copy/destruct</a></em></span> |
|---|
| 50 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> U> array& <a href="array.html#id718718-bb"><span class="bold"><strong>operator</strong></span>=</a>(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><U, N>&); |
|---|
| 51 | |
|---|
| 52 | <span class="emphasis"><em>// <a href="array.html#id718755-bb">iterator support</a></em></span> |
|---|
| 53 | <span class="type">iterator</span> <a href="array.html#id718763-bb">begin</a>(); |
|---|
| 54 | <span class="type">const_iterator</span> <a href="array.html#id718770-bb">begin</a>() <span class="bold"><strong>const</strong></span>; |
|---|
| 55 | <span class="type">iterator</span> <a href="array.html#id718792-bb">end</a>(); |
|---|
| 56 | <span class="type">const_iterator</span> <a href="array.html#id718798-bb">end</a>() <span class="bold"><strong>const</strong></span>; |
|---|
| 57 | |
|---|
| 58 | <span class="emphasis"><em>// <a href="array.html#id718818-bb">reverse iterator support</a></em></span> |
|---|
| 59 | <span class="type">reverse_iterator</span> <a href="array.html#id718826-bb">rbegin</a>(); |
|---|
| 60 | <span class="type">const_reverse_iterator</span> <a href="array.html#id718832-bb">rbegin</a>() <span class="bold"><strong>const</strong></span>; |
|---|
| 61 | <span class="type">reverse_iterator</span> <a href="array.html#id718851-bb">rend</a>(); |
|---|
| 62 | <span class="type">const_reverse_iterator</span> <a href="array.html#id718857-bb">rend</a>() <span class="bold"><strong>const</strong></span>; |
|---|
| 63 | |
|---|
| 64 | <span class="emphasis"><em>// <a href="array.html#id718873-bb">capacity</a></em></span> |
|---|
| 65 | <span class="type">size_type</span> <a href="array.html#id718877-bb">size</a>(); |
|---|
| 66 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="array.html#id718891-bb">empty</a>(); |
|---|
| 67 | <span class="type">size_type</span> <a href="array.html#id718909-bb">max_size</a>(); |
|---|
| 68 | |
|---|
| 69 | <span class="emphasis"><em>// <a href="array.html#id718928-bb">element access</a></em></span> |
|---|
| 70 | <span class="type">reference</span> <a href="array.html#id718936-bb"><span class="bold"><strong>operator</strong></span>[]</a>(size_type); |
|---|
| 71 | <span class="type">const_reference</span> <a href="array.html#id718950-bb"><span class="bold"><strong>operator</strong></span>[]</a>(size_type) <span class="bold"><strong>const</strong></span>; |
|---|
| 72 | <span class="type">reference</span> <a href="array.html#id718988-bb">at</a>(size_type); |
|---|
| 73 | <span class="type">const_reference</span> <a href="array.html#id719002-bb">at</a>(size_type) <span class="bold"><strong>const</strong></span>; |
|---|
| 74 | <span class="type">reference</span> <a href="array.html#id719040-bb">front</a>(); |
|---|
| 75 | <span class="type">const_reference</span> <a href="array.html#id719046-bb">front</a>() <span class="bold"><strong>const</strong></span>; |
|---|
| 76 | <span class="type">reference</span> <a href="array.html#id719074-bb">back</a>(); |
|---|
| 77 | <span class="type">const_reference</span> <a href="array.html#id719080-bb">back</a>() <span class="bold"><strong>const</strong></span>; |
|---|
| 78 | <span class="type"><span class="bold"><strong>const</strong></span> T*</span> <a href="array.html#id719103-bb">data</a>() <span class="bold"><strong>const</strong></span>; |
|---|
| 79 | <span class="type">T*</span> <a href="array.html#id719123-bb">c_array</a>(); |
|---|
| 80 | |
|---|
| 81 | <span class="emphasis"><em>// <a href="array.html#id719142-bb">modifiers</a></em></span> |
|---|
| 82 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="array.html#id719146-bb">swap</a>(<a href="array.html" title="Class template array">array</a><T, N>&); |
|---|
| 83 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="array.html#id719186-bb">assign</a>(<span class="bold"><strong>const</strong></span> T&); |
|---|
| 84 | |
|---|
| 85 | T elems[N]; |
|---|
| 86 | }; |
|---|
| 87 | |
|---|
| 88 | <span class="emphasis"><em>// <a href="array.html#id719222-bb">specialized algorithms</a></em></span> |
|---|
| 89 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="array.html#id719226-bb">swap</a>(<a href="array.html" title="Class template array">array</a><T, N>&, <a href="array.html" title="Class template array">array</a><T, N>&); |
|---|
| 90 | |
|---|
| 91 | <span class="emphasis"><em>// <a href="array.html#id719285-bb">comparisons</a></em></span> |
|---|
| 92 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 93 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="array.html#id719289-bb"><span class="bold"><strong>operator</strong></span>==</a>(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&); |
|---|
| 94 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 95 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="array.html#id719352-bb"><span class="bold"><strong>operator</strong></span>!=</a>(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&); |
|---|
| 96 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 97 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="array.html#id719405-bb"><span class="bold"><strong>operator</strong></span><</a>(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&); |
|---|
| 98 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 99 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="array.html#id719470-bb"><span class="bold"><strong>operator</strong></span>></a>(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&); |
|---|
| 100 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 101 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="array.html#id719522-bb"><span class="bold"><strong>operator</strong></span><=</a>(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&); |
|---|
| 102 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 103 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="array.html#id719574-bb"><span class="bold"><strong>operator</strong></span>>=</a>(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>&);</pre></div> |
|---|
| 104 | <div class="refsect1" lang="en"> |
|---|
| 105 | <a name="id940357"></a><h2>Description</h2> |
|---|
| 106 | <div class="refsect2" lang="en"> |
|---|
| 107 | <a name="id940361"></a><h3> |
|---|
| 108 | <a name="boost.arrayconstruct-copy-destruct"></a><code class="computeroutput">array</code> construct/copy/destruct</h3> |
|---|
| 109 | <div class="orderedlist"><ol type="1"><li> |
|---|
| 110 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> U> array& <a name="id718718-bb"></a><span class="bold"><strong>operator</strong></span>=(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><U, N>& other);</pre> |
|---|
| 111 | <div class="variablelist"><table border="0"> |
|---|
| 112 | <col align="left" valign="top"> |
|---|
| 113 | <tbody><tr> |
|---|
| 114 | <td> |
|---|
| 115 | <span class="term">Effects:</span></td> |
|---|
| 116 | <td><code class="computeroutput">std::copy(rhs.<a href="array.html#id718759-bb">begin</a>(),rhs.<a href="array.html#id718788-bb">end</a>(), <a href="array.html#id718759-bb">begin</a>())</code></td> |
|---|
| 117 | </tr></tbody> |
|---|
| 118 | </table></div> |
|---|
| 119 | </li></ol></div> |
|---|
| 120 | </div> |
|---|
| 121 | <div class="refsect2" lang="en"> |
|---|
| 122 | <a name="id940459"></a><h3> |
|---|
| 123 | <a name="id718755-bb"></a><code class="computeroutput">array</code> iterator support</h3> |
|---|
| 124 | <div class="orderedlist"><ol type="1"> |
|---|
| 125 | <li> |
|---|
| 126 | <p><a name="id718759-bb"></a></p> |
|---|
| 127 | <pre class="literallayout"><span class="type">iterator</span> <a name="id718763-bb"></a>begin(); |
|---|
| 128 | <span class="type">const_iterator</span> <a name="id718770-bb"></a>begin() <span class="bold"><strong>const</strong></span>;</pre> |
|---|
| 129 | <div class="variablelist"><table border="0"> |
|---|
| 130 | <col align="left" valign="top"> |
|---|
| 131 | <tbody> |
|---|
| 132 | <tr> |
|---|
| 133 | <td> |
|---|
| 134 | <span class="term">Returns:</span></td> |
|---|
| 135 | <td>iterator for the first element</td> |
|---|
| 136 | </tr> |
|---|
| 137 | <tr> |
|---|
| 138 | <td> |
|---|
| 139 | <span class="term">Throws:</span></td> |
|---|
| 140 | <td>will not throw</td> |
|---|
| 141 | </tr> |
|---|
| 142 | </tbody> |
|---|
| 143 | </table></div> |
|---|
| 144 | </li> |
|---|
| 145 | <li> |
|---|
| 146 | <p><a name="id718788-bb"></a></p> |
|---|
| 147 | <pre class="literallayout"><span class="type">iterator</span> <a name="id718792-bb"></a>end(); |
|---|
| 148 | <span class="type">const_iterator</span> <a name="id718798-bb"></a>end() <span class="bold"><strong>const</strong></span>;</pre> |
|---|
| 149 | <div class="variablelist"><table border="0"> |
|---|
| 150 | <col align="left" valign="top"> |
|---|
| 151 | <tbody> |
|---|
| 152 | <tr> |
|---|
| 153 | <td> |
|---|
| 154 | <span class="term">Returns:</span></td> |
|---|
| 155 | <td>iterator for position after the last element</td> |
|---|
| 156 | </tr> |
|---|
| 157 | <tr> |
|---|
| 158 | <td> |
|---|
| 159 | <span class="term">Throws:</span></td> |
|---|
| 160 | <td>will not throw</td> |
|---|
| 161 | </tr> |
|---|
| 162 | </tbody> |
|---|
| 163 | </table></div> |
|---|
| 164 | </li> |
|---|
| 165 | </ol></div> |
|---|
| 166 | </div> |
|---|
| 167 | <div class="refsect2" lang="en"> |
|---|
| 168 | <a name="id940584"></a><h3> |
|---|
| 169 | <a name="id718818-bb"></a><code class="computeroutput">array</code> reverse iterator support</h3> |
|---|
| 170 | <div class="orderedlist"><ol type="1"> |
|---|
| 171 | <li> |
|---|
| 172 | <p><a name="id718822-bb"></a></p> |
|---|
| 173 | <pre class="literallayout"><span class="type">reverse_iterator</span> <a name="id718826-bb"></a>rbegin(); |
|---|
| 174 | <span class="type">const_reverse_iterator</span> <a name="id718832-bb"></a>rbegin() <span class="bold"><strong>const</strong></span>;</pre> |
|---|
| 175 | <div class="variablelist"><table border="0"> |
|---|
| 176 | <col align="left" valign="top"> |
|---|
| 177 | <tbody><tr> |
|---|
| 178 | <td> |
|---|
| 179 | <span class="term">Returns:</span></td> |
|---|
| 180 | <td>reverse iterator for the first element of reverse iteration</td> |
|---|
| 181 | </tr></tbody> |
|---|
| 182 | </table></div> |
|---|
| 183 | </li> |
|---|
| 184 | <li> |
|---|
| 185 | <p><a name="id718847-bb"></a></p> |
|---|
| 186 | <pre class="literallayout"><span class="type">reverse_iterator</span> <a name="id718851-bb"></a>rend(); |
|---|
| 187 | <span class="type">const_reverse_iterator</span> <a name="id718857-bb"></a>rend() <span class="bold"><strong>const</strong></span>;</pre> |
|---|
| 188 | <div class="variablelist"><table border="0"> |
|---|
| 189 | <col align="left" valign="top"> |
|---|
| 190 | <tbody><tr> |
|---|
| 191 | <td> |
|---|
| 192 | <span class="term">Returns:</span></td> |
|---|
| 193 | <td>reverse iterator for position after the last element in reverse iteration</td> |
|---|
| 194 | </tr></tbody> |
|---|
| 195 | </table></div> |
|---|
| 196 | </li> |
|---|
| 197 | </ol></div> |
|---|
| 198 | </div> |
|---|
| 199 | <div class="refsect2" lang="en"> |
|---|
| 200 | <a name="id940697"></a><h3> |
|---|
| 201 | <a name="id718873-bb"></a><code class="computeroutput">array</code> capacity</h3> |
|---|
| 202 | <div class="orderedlist"><ol type="1"> |
|---|
| 203 | <li> |
|---|
| 204 | <pre class="literallayout"><span class="type">size_type</span> <a name="id718877-bb"></a>size();</pre> |
|---|
| 205 | <div class="variablelist"><table border="0"> |
|---|
| 206 | <col align="left" valign="top"> |
|---|
| 207 | <tbody><tr> |
|---|
| 208 | <td> |
|---|
| 209 | <span class="term">Returns:</span></td> |
|---|
| 210 | <td><code class="computeroutput">N</code></td> |
|---|
| 211 | </tr></tbody> |
|---|
| 212 | </table></div> |
|---|
| 213 | </li> |
|---|
| 214 | <li> |
|---|
| 215 | <pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id718891-bb"></a>empty();</pre> |
|---|
| 216 | <div class="variablelist"><table border="0"> |
|---|
| 217 | <col align="left" valign="top"> |
|---|
| 218 | <tbody> |
|---|
| 219 | <tr> |
|---|
| 220 | <td> |
|---|
| 221 | <span class="term">Returns:</span></td> |
|---|
| 222 | <td><code class="computeroutput">N==0</code></td> |
|---|
| 223 | </tr> |
|---|
| 224 | <tr> |
|---|
| 225 | <td> |
|---|
| 226 | <span class="term">Throws:</span></td> |
|---|
| 227 | <td>will not throw</td> |
|---|
| 228 | </tr> |
|---|
| 229 | </tbody> |
|---|
| 230 | </table></div> |
|---|
| 231 | </li> |
|---|
| 232 | <li> |
|---|
| 233 | <pre class="literallayout"><span class="type">size_type</span> <a name="id718909-bb"></a>max_size();</pre> |
|---|
| 234 | <div class="variablelist"><table border="0"> |
|---|
| 235 | <col align="left" valign="top"> |
|---|
| 236 | <tbody> |
|---|
| 237 | <tr> |
|---|
| 238 | <td> |
|---|
| 239 | <span class="term">Returns:</span></td> |
|---|
| 240 | <td><code class="computeroutput">N</code></td> |
|---|
| 241 | </tr> |
|---|
| 242 | <tr> |
|---|
| 243 | <td> |
|---|
| 244 | <span class="term">Throws:</span></td> |
|---|
| 245 | <td>will not throw</td> |
|---|
| 246 | </tr> |
|---|
| 247 | </tbody> |
|---|
| 248 | </table></div> |
|---|
| 249 | </li> |
|---|
| 250 | </ol></div> |
|---|
| 251 | </div> |
|---|
| 252 | <div class="refsect2" lang="en"> |
|---|
| 253 | <a name="id940826"></a><h3> |
|---|
| 254 | <a name="id718928-bb"></a><code class="computeroutput">array</code> element access</h3> |
|---|
| 255 | <div class="orderedlist"><ol type="1"> |
|---|
| 256 | <li> |
|---|
| 257 | <p><a name="id718932-bb"></a></p> |
|---|
| 258 | <pre class="literallayout"><span class="type">reference</span> <a name="id718936-bb"></a><span class="bold"><strong>operator</strong></span>[](size_type i); |
|---|
| 259 | <span class="type">const_reference</span> <a name="id718950-bb"></a><span class="bold"><strong>operator</strong></span>[](size_type i) <span class="bold"><strong>const</strong></span>;</pre> |
|---|
| 260 | <div class="variablelist"><table border="0"> |
|---|
| 261 | <col align="left" valign="top"> |
|---|
| 262 | <tbody> |
|---|
| 263 | <tr> |
|---|
| 264 | <td> |
|---|
| 265 | <span class="term">Requires:</span></td> |
|---|
| 266 | <td><code class="computeroutput">i < N</code></td> |
|---|
| 267 | </tr> |
|---|
| 268 | <tr> |
|---|
| 269 | <td> |
|---|
| 270 | <span class="term">Returns:</span></td> |
|---|
| 271 | <td>element with index <code class="computeroutput">i</code> |
|---|
| 272 | </td> |
|---|
| 273 | </tr> |
|---|
| 274 | <tr> |
|---|
| 275 | <td> |
|---|
| 276 | <span class="term">Throws:</span></td> |
|---|
| 277 | <td>will not throw.</td> |
|---|
| 278 | </tr> |
|---|
| 279 | </tbody> |
|---|
| 280 | </table></div> |
|---|
| 281 | </li> |
|---|
| 282 | <li> |
|---|
| 283 | <p><a name="id718984-bb"></a></p> |
|---|
| 284 | <pre class="literallayout"><span class="type">reference</span> <a name="id718988-bb"></a>at(size_type i); |
|---|
| 285 | <span class="type">const_reference</span> <a name="id719002-bb"></a>at(size_type i) <span class="bold"><strong>const</strong></span>;</pre> |
|---|
| 286 | <div class="variablelist"><table border="0"> |
|---|
| 287 | <col align="left" valign="top"> |
|---|
| 288 | <tbody> |
|---|
| 289 | <tr> |
|---|
| 290 | <td> |
|---|
| 291 | <span class="term">Returns:</span></td> |
|---|
| 292 | <td>element with index <code class="computeroutput">i</code> |
|---|
| 293 | </td> |
|---|
| 294 | </tr> |
|---|
| 295 | <tr> |
|---|
| 296 | <td> |
|---|
| 297 | <span class="term">Throws:</span></td> |
|---|
| 298 | <td> |
|---|
| 299 | <code class="computeroutput">std::range_error</code> if <code class="computeroutput">i >= N</code> |
|---|
| 300 | </td> |
|---|
| 301 | </tr> |
|---|
| 302 | </tbody> |
|---|
| 303 | </table></div> |
|---|
| 304 | </li> |
|---|
| 305 | <li> |
|---|
| 306 | <p><a name="id719036-bb"></a></p> |
|---|
| 307 | <pre class="literallayout"><span class="type">reference</span> <a name="id719040-bb"></a>front(); |
|---|
| 308 | <span class="type">const_reference</span> <a name="id719046-bb"></a>front() <span class="bold"><strong>const</strong></span>;</pre> |
|---|
| 309 | <div class="variablelist"><table border="0"> |
|---|
| 310 | <col align="left" valign="top"> |
|---|
| 311 | <tbody> |
|---|
| 312 | <tr> |
|---|
| 313 | <td> |
|---|
| 314 | <span class="term">Requires:</span></td> |
|---|
| 315 | <td><code class="computeroutput">N > 0</code></td> |
|---|
| 316 | </tr> |
|---|
| 317 | <tr> |
|---|
| 318 | <td> |
|---|
| 319 | <span class="term">Returns:</span></td> |
|---|
| 320 | <td>the first element</td> |
|---|
| 321 | </tr> |
|---|
| 322 | <tr> |
|---|
| 323 | <td> |
|---|
| 324 | <span class="term">Throws:</span></td> |
|---|
| 325 | <td>will not throw</td> |
|---|
| 326 | </tr> |
|---|
| 327 | </tbody> |
|---|
| 328 | </table></div> |
|---|
| 329 | </li> |
|---|
| 330 | <li> |
|---|
| 331 | <p><a name="id719070-bb"></a></p> |
|---|
| 332 | <pre class="literallayout"><span class="type">reference</span> <a name="id719074-bb"></a>back(); |
|---|
| 333 | <span class="type">const_reference</span> <a name="id719080-bb"></a>back() <span class="bold"><strong>const</strong></span>;</pre> |
|---|
| 334 | <div class="variablelist"><table border="0"> |
|---|
| 335 | <col align="left" valign="top"> |
|---|
| 336 | <tbody> |
|---|
| 337 | <tr> |
|---|
| 338 | <td> |
|---|
| 339 | <span class="term">Requires:</span></td> |
|---|
| 340 | <td><code class="computeroutput">N > 0</code></td> |
|---|
| 341 | </tr> |
|---|
| 342 | <tr> |
|---|
| 343 | <td> |
|---|
| 344 | <span class="term">Returns:</span></td> |
|---|
| 345 | <td>the last element</td> |
|---|
| 346 | </tr> |
|---|
| 347 | <tr> |
|---|
| 348 | <td> |
|---|
| 349 | <span class="term">Throws:</span></td> |
|---|
| 350 | <td>will not throw</td> |
|---|
| 351 | </tr> |
|---|
| 352 | </tbody> |
|---|
| 353 | </table></div> |
|---|
| 354 | </li> |
|---|
| 355 | <li> |
|---|
| 356 | <pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> T*</span> <a name="id719103-bb"></a>data() <span class="bold"><strong>const</strong></span>;</pre> |
|---|
| 357 | <div class="variablelist"><table border="0"> |
|---|
| 358 | <col align="left" valign="top"> |
|---|
| 359 | <tbody> |
|---|
| 360 | <tr> |
|---|
| 361 | <td> |
|---|
| 362 | <span class="term">Returns:</span></td> |
|---|
| 363 | <td><code class="computeroutput">elems</code></td> |
|---|
| 364 | </tr> |
|---|
| 365 | <tr> |
|---|
| 366 | <td> |
|---|
| 367 | <span class="term">Throws:</span></td> |
|---|
| 368 | <td>will not throw</td> |
|---|
| 369 | </tr> |
|---|
| 370 | </tbody> |
|---|
| 371 | </table></div> |
|---|
| 372 | </li> |
|---|
| 373 | <li> |
|---|
| 374 | <pre class="literallayout"><span class="type">T*</span> <a name="id719123-bb"></a>c_array();</pre> |
|---|
| 375 | <div class="variablelist"><table border="0"> |
|---|
| 376 | <col align="left" valign="top"> |
|---|
| 377 | <tbody> |
|---|
| 378 | <tr> |
|---|
| 379 | <td> |
|---|
| 380 | <span class="term">Returns:</span></td> |
|---|
| 381 | <td><code class="computeroutput">elems</code></td> |
|---|
| 382 | </tr> |
|---|
| 383 | <tr> |
|---|
| 384 | <td> |
|---|
| 385 | <span class="term">Throws:</span></td> |
|---|
| 386 | <td>will not throw</td> |
|---|
| 387 | </tr> |
|---|
| 388 | </tbody> |
|---|
| 389 | </table></div> |
|---|
| 390 | </li> |
|---|
| 391 | </ol></div> |
|---|
| 392 | </div> |
|---|
| 393 | <div class="refsect2" lang="en"> |
|---|
| 394 | <a name="id941201"></a><h3> |
|---|
| 395 | <a name="id719142-bb"></a><code class="computeroutput">array</code> modifiers</h3> |
|---|
| 396 | <div class="orderedlist"><ol type="1"> |
|---|
| 397 | <li> |
|---|
| 398 | <pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id719146-bb"></a>swap(<a href="array.html" title="Class template array">array</a><T, N>& other);</pre> |
|---|
| 399 | <div class="variablelist"><table border="0"> |
|---|
| 400 | <col align="left" valign="top"> |
|---|
| 401 | <tbody> |
|---|
| 402 | <tr> |
|---|
| 403 | <td> |
|---|
| 404 | <span class="term">Effects:</span></td> |
|---|
| 405 | <td><code class="computeroutput">std::swap_ranges(<a href="array.html#id718759-bb">begin</a>(), <a href="array.html#id718788-bb">end</a>(), other.<a href="array.html#id718759-bb">begin</a>())</code></td> |
|---|
| 406 | </tr> |
|---|
| 407 | <tr> |
|---|
| 408 | <td> |
|---|
| 409 | <span class="term">Complexity:</span></td> |
|---|
| 410 | <td>linear in <code class="computeroutput">N</code> |
|---|
| 411 | </td> |
|---|
| 412 | </tr> |
|---|
| 413 | </tbody> |
|---|
| 414 | </table></div> |
|---|
| 415 | </li> |
|---|
| 416 | <li> |
|---|
| 417 | <pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id719186-bb"></a>assign(<span class="bold"><strong>const</strong></span> T& value);</pre> |
|---|
| 418 | <div class="variablelist"><table border="0"> |
|---|
| 419 | <col align="left" valign="top"> |
|---|
| 420 | <tbody><tr> |
|---|
| 421 | <td> |
|---|
| 422 | <span class="term">Effects:</span></td> |
|---|
| 423 | <td><code class="computeroutput">std::fill_n(<a href="array.html#id718759-bb">begin</a>(), N, value)</code></td> |
|---|
| 424 | </tr></tbody> |
|---|
| 425 | </table></div> |
|---|
| 426 | </li> |
|---|
| 427 | </ol></div> |
|---|
| 428 | </div> |
|---|
| 429 | <div class="refsect2" lang="en"> |
|---|
| 430 | <a name="id941339"></a><h3> |
|---|
| 431 | <a name="id719222-bb"></a><code class="computeroutput">array</code> specialized algorithms</h3> |
|---|
| 432 | <div class="orderedlist"><ol type="1"><li> |
|---|
| 433 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> <span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id719226-bb"></a>swap(<a href="array.html" title="Class template array">array</a><T, N>& x, <a href="array.html" title="Class template array">array</a><T, N>& y);</pre> |
|---|
| 434 | <div class="variablelist"><table border="0"> |
|---|
| 435 | <col align="left" valign="top"> |
|---|
| 436 | <tbody> |
|---|
| 437 | <tr> |
|---|
| 438 | <td> |
|---|
| 439 | <span class="term">Effects:</span></td> |
|---|
| 440 | <td><code class="computeroutput">x.<a href="array.html#id719146-bb">swap</a>(y)</code></td> |
|---|
| 441 | </tr> |
|---|
| 442 | <tr> |
|---|
| 443 | <td> |
|---|
| 444 | <span class="term">Throws:</span></td> |
|---|
| 445 | <td>will not throw.</td> |
|---|
| 446 | </tr> |
|---|
| 447 | </tbody> |
|---|
| 448 | </table></div> |
|---|
| 449 | </li></ol></div> |
|---|
| 450 | </div> |
|---|
| 451 | <div class="refsect2" lang="en"> |
|---|
| 452 | <a name="id941430"></a><h3> |
|---|
| 453 | <a name="id719285-bb"></a><code class="computeroutput">array</code> comparisons</h3> |
|---|
| 454 | <div class="orderedlist"><ol type="1"> |
|---|
| 455 | <li> |
|---|
| 456 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 457 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id719289-bb"></a><span class="bold"><strong>operator</strong></span>==(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& x, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& y);</pre> |
|---|
| 458 | <div class="variablelist"><table border="0"> |
|---|
| 459 | <col align="left" valign="top"> |
|---|
| 460 | <tbody><tr> |
|---|
| 461 | <td> |
|---|
| 462 | <span class="term">Returns:</span></td> |
|---|
| 463 | <td><code class="computeroutput">std::equal(x.<a href="array.html#id718759-bb">begin</a>(), x.<a href="array.html#id718788-bb">end</a>(), y.<a href="array.html#id718759-bb">begin</a>())</code></td> |
|---|
| 464 | </tr></tbody> |
|---|
| 465 | </table></div> |
|---|
| 466 | </li> |
|---|
| 467 | <li> |
|---|
| 468 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 469 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id719352-bb"></a><span class="bold"><strong>operator</strong></span>!=(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& x, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& y);</pre> |
|---|
| 470 | <div class="variablelist"><table border="0"> |
|---|
| 471 | <col align="left" valign="top"> |
|---|
| 472 | <tbody><tr> |
|---|
| 473 | <td> |
|---|
| 474 | <span class="term">Returns:</span></td> |
|---|
| 475 | <td><code class="computeroutput">!(x == y)</code></td> |
|---|
| 476 | </tr></tbody> |
|---|
| 477 | </table></div> |
|---|
| 478 | </li> |
|---|
| 479 | <li> |
|---|
| 480 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 481 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id719405-bb"></a><span class="bold"><strong>operator</strong></span><(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& x, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& y);</pre> |
|---|
| 482 | <div class="variablelist"><table border="0"> |
|---|
| 483 | <col align="left" valign="top"> |
|---|
| 484 | <tbody><tr> |
|---|
| 485 | <td> |
|---|
| 486 | <span class="term">Returns:</span></td> |
|---|
| 487 | <td><code class="computeroutput">std::lexicographical_compare(x.<a href="array.html#id718759-bb">begin</a>(), x.<a href="array.html#id718788-bb">end</a>(), y.<a href="array.html#id718759-bb">begin</a>(), y.<a href="array.html#id718788-bb">end</a>())</code></td> |
|---|
| 488 | </tr></tbody> |
|---|
| 489 | </table></div> |
|---|
| 490 | </li> |
|---|
| 491 | <li> |
|---|
| 492 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 493 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id719470-bb"></a><span class="bold"><strong>operator</strong></span>>(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& x, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& y);</pre> |
|---|
| 494 | <div class="variablelist"><table border="0"> |
|---|
| 495 | <col align="left" valign="top"> |
|---|
| 496 | <tbody><tr> |
|---|
| 497 | <td> |
|---|
| 498 | <span class="term">Returns:</span></td> |
|---|
| 499 | <td><code class="computeroutput">y < x</code></td> |
|---|
| 500 | </tr></tbody> |
|---|
| 501 | </table></div> |
|---|
| 502 | </li> |
|---|
| 503 | <li> |
|---|
| 504 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 505 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id719522-bb"></a><span class="bold"><strong>operator</strong></span><=(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& x, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& y);</pre> |
|---|
| 506 | <div class="variablelist"><table border="0"> |
|---|
| 507 | <col align="left" valign="top"> |
|---|
| 508 | <tbody><tr> |
|---|
| 509 | <td> |
|---|
| 510 | <span class="term">Returns:</span></td> |
|---|
| 511 | <td><code class="computeroutput">!(y < x)</code></td> |
|---|
| 512 | </tr></tbody> |
|---|
| 513 | </table></div> |
|---|
| 514 | </li> |
|---|
| 515 | <li> |
|---|
| 516 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, std::size_t N> |
|---|
| 517 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id719574-bb"></a><span class="bold"><strong>operator</strong></span>>=(<span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& x, <span class="bold"><strong>const</strong></span> <a href="array.html" title="Class template array">array</a><T, N>& y);</pre> |
|---|
| 518 | <div class="variablelist"><table border="0"> |
|---|
| 519 | <col align="left" valign="top"> |
|---|
| 520 | <tbody><tr> |
|---|
| 521 | <td> |
|---|
| 522 | <span class="term">Returns:</span></td> |
|---|
| 523 | <td><code class="computeroutput">!(x < y)</code></td> |
|---|
| 524 | </tr></tbody> |
|---|
| 525 | </table></div> |
|---|
| 526 | </li> |
|---|
| 527 | </ol></div> |
|---|
| 528 | </div> |
|---|
| 529 | </div> |
|---|
| 530 | </div> |
|---|
| 531 | <table width="100%"><tr> |
|---|
| 532 | <td align="left"></td> |
|---|
| 533 | <td align="right"><small>Copyright © 2001-2004 Nicolai M. Josuttis</small></td> |
|---|
| 534 | </tr></table> |
|---|
| 535 | <hr> |
|---|
| 536 | <div class="spirit-nav"> |
|---|
| 537 | <a accesskey="p" href="../array/reference.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../array/reference.html#header.boost.array.hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../array/rationale.html"><img src="../images/next.png" alt="Next"></a> |
|---|
| 538 | </div> |
|---|
| 539 | </body> |
|---|
| 540 | </html> |
|---|