Compare commits

..

1 Commits

Author SHA1 Message Date
96469dc8fe This commit was manufactured by cvs2svn to create branch 'regex-sub'.
[SVN r7754]
2000-09-21 03:34:33 +00:00
10 changed files with 62 additions and 84 deletions

View File

@ -28,7 +28,7 @@
&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*&nbsp;This&nbsp;software&nbsp;is&nbsp;provided&nbsp;"as&nbsp;is"&nbsp;without&nbsp;express&nbsp;or&nbsp;implied</FONT></I><BR> &nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*&nbsp;This&nbsp;software&nbsp;is&nbsp;provided&nbsp;"as&nbsp;is"&nbsp;without&nbsp;express&nbsp;or&nbsp;implied</FONT></I><BR>
&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*&nbsp;warranty,&nbsp;and&nbsp;with&nbsp;no&nbsp;claim&nbsp;as&nbsp;to&nbsp;its&nbsp;suitability&nbsp;for&nbsp;any&nbsp;purpose.</FONT></I><BR> &nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*&nbsp;warranty,&nbsp;and&nbsp;with&nbsp;no&nbsp;claim&nbsp;as&nbsp;to&nbsp;its&nbsp;suitability&nbsp;for&nbsp;any&nbsp;purpose.</FONT></I><BR>
&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*</FONT></I><BR> &nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*</FONT></I><BR>
&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*&nbsp;Sep&nbsp;29,&nbsp;2000</FONT></I><BR> &nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*&nbsp;Jul&nbsp;31,&nbsp;2000</FONT></I><BR>
&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*/</FONT></I><BR> &nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*/</FONT></I><BR>
#ifndef&nbsp;BOOST_ARRAY_HPP<BR> #ifndef&nbsp;BOOST_ARRAY_HPP<BR>
#define&nbsp;BOOST_ARRAY_HPP<BR> #define&nbsp;BOOST_ARRAY_HPP<BR>
@ -38,8 +38,10 @@
#include&nbsp;&lt;iterator&gt;<BR> #include&nbsp;&lt;iterator&gt;<BR>
#include&nbsp;&lt;algorithm&gt;<BR> #include&nbsp;&lt;algorithm&gt;<BR>
<BR> <BR>
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;FIXES&nbsp;for&nbsp;broken&nbsp;compilers</FONT></I><BR> <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;BUG-FIX&nbsp;for&nbsp;compilers&nbsp;that&nbsp;don't&nbsp;support</FONT></I><BR>
#include&nbsp;&lt;<A href="../../boost/config.hpp"><A href="http://www.boost.org/boost/config.hpp">boost/config.hpp</A></A>&gt;<BR> <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;std::size_t&nbsp;and&nbsp;std::ptrdiff_t&nbsp;yet</FONT></I><BR>
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;(such&nbsp;as&nbsp;gcc)</FONT></I><BR>
#include&nbsp;&lt;<A href="./config.hpp.html">boost/config.hpp</A>&gt;<BR>
<BR> <BR>
namespace&nbsp;boost&nbsp;{<BR> namespace&nbsp;boost&nbsp;{<BR>
<BR> <BR>
@ -65,15 +67,8 @@ namespace&nbsp;boost&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const_iterator&nbsp;end()&nbsp;const&nbsp;{&nbsp;return&nbsp;elems+N;&nbsp;}<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const_iterator&nbsp;end()&nbsp;const&nbsp;{&nbsp;return&nbsp;elems+N;&nbsp;}<BR>
<BR> <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;reverse&nbsp;iterator&nbsp;support</FONT></I><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;reverse&nbsp;iterator&nbsp;support</FONT></I><BR>
#if&nbsp;!defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;std::reverse_iterator&lt;iterator&gt;&nbsp;reverse_iterator;<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;std::reverse_iterator&lt;iterator&gt;&nbsp;reverse_iterator;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;std::reverse_iterator&lt;const_iterator&gt;&nbsp;const_reverse_iterator;<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;std::reverse_iterator&lt;const_iterator&gt;&nbsp;const_reverse_iterator;<BR>
#else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;workaround&nbsp;for&nbsp;broken&nbsp;reverse_iterator&nbsp;implementations&nbsp;due&nbsp;to&nbsp;no&nbsp;partial&nbsp;specialization</FONT></I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;std::reverse_iterator&lt;iterator,T&gt;&nbsp;reverse_iterator;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;std::reverse_iterator&lt;const_iterator,T&gt;&nbsp;const_reverse_iterator;<BR>
#endif<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reverse_iterator&nbsp;rbegin()&nbsp;{&nbsp;return&nbsp;reverse_iterator(end());&nbsp;}<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reverse_iterator&nbsp;rbegin()&nbsp;{&nbsp;return&nbsp;reverse_iterator(end());&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const_reverse_iterator&nbsp;rbegin()&nbsp;const&nbsp;{<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const_reverse_iterator&nbsp;rbegin()&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;const_reverse_iterator(end());<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;const_reverse_iterator(end());<BR>
@ -103,6 +98,7 @@ namespace&nbsp;boost&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;size_type&nbsp;max_size()&nbsp;{&nbsp;return&nbsp;N;&nbsp;}<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;size_type&nbsp;max_size()&nbsp;{&nbsp;return&nbsp;N;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enum&nbsp;{&nbsp;static_size&nbsp;=&nbsp;N&nbsp;};<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enum&nbsp;{&nbsp;static_size&nbsp;=&nbsp;N&nbsp;};<BR>
<BR> <BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;swap&nbsp;(note:&nbsp;linear&nbsp;complexity)</FONT></I><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;swap&nbsp;(note:&nbsp;linear&nbsp;complexity)</FONT></I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void&nbsp;swap&nbsp;(array&lt;T,N&gt;&&nbsp;y)&nbsp;{<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void&nbsp;swap&nbsp;(array&lt;T,N&gt;&&nbsp;y)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::swap_ranges(begin(),end(),y.begin());<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::swap_ranges(begin(),end(),y.begin());<BR>
@ -124,9 +120,7 @@ namespace&nbsp;boost&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::fill_n(begin(),size(),value);<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::fill_n(begin(),size(),value);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR> <BR>
#ifndef&nbsp;BOOST_NO_PRIVATE_IN_AGGREGATE<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private:<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private:<BR>
#endif<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;check&nbsp;range&nbsp;(may&nbsp;be&nbsp;private&nbsp;because&nbsp;it&nbsp;is&nbsp;static)</FONT></I><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >//&nbsp;check&nbsp;range&nbsp;(may&nbsp;be&nbsp;private&nbsp;because&nbsp;it&nbsp;is&nbsp;static)</FONT></I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;void&nbsp;rangecheck&nbsp;(size_type&nbsp;i)&nbsp;{<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;void&nbsp;rangecheck&nbsp;(size_type&nbsp;i)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(i&nbsp;&gt;=&nbsp;size())&nbsp;{&nbsp;throw&nbsp;std::range_error("array");&nbsp;}<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(i&nbsp;&gt;=&nbsp;size())&nbsp;{&nbsp;throw&nbsp;std::range_error("array");&nbsp;}<BR>

View File

@ -15,14 +15,11 @@
Wrapper) for Arrays of Constant Size</font></b></td> Wrapper) for Arrays of Constant Size</font></b></td>
</tr> </tr>
</table> </table>
<p><font size="-1" face="Arial, Helvetica, sans-serif">[<a href="#intro">intro</a>] <p><font face="Arial, Helvetica, sans-serif" size="-1">The C++ Standard Template
[<a href="#interface">interface</a>] [<a href="#discussion">discussion</a>] Library STL as part of the C++ Standard Library provides a framework for processing
[<a href="#code">code</a>]</font> algorithms on different kind of containers. However, ordinary arrays don't provide
<p><font face="Arial, Helvetica, sans-serif" size="-1"><a name="intro"></a>The the interface of STL containers (although, they provide the iterator interface
C++ Standard Template Library STL as part of the C++ Standard Library provides of STL containers).</font>
a framework for processing algorithms on different kind of containers. However,
ordinary arrays don't provide the interface of STL containers (although, they
provide the iterator interface of STL containers).</font>
<p><font face="Arial, Helvetica, sans-serif" size="-1">As replacement for ordinary <p><font face="Arial, Helvetica, sans-serif" size="-1">As replacement for ordinary
arrays, the STL provides class <font face="Courier New, Courier, mono">vector&lt;&gt;</font>. arrays, the STL provides class <font face="Courier New, Courier, mono">vector&lt;&gt;</font>.
However, <font face="Courier New, Courier, mono">vector&lt;&gt;</font> provides However, <font face="Courier New, Courier, mono">vector&lt;&gt;</font> provides
@ -41,8 +38,8 @@
the essence of these approaches spiced with many feedback from <a href="http://www.boost.org">boost</a>.</font> the essence of these approaches spiced with many feedback from <a href="http://www.boost.org">boost</a>.</font>
<p><font face="Arial, Helvetica, sans-serif" size="-1">After considering different <p><font face="Arial, Helvetica, sans-serif" size="-1">After considering different
names, we decided to name this class simply <font face="Courier New, Courier, mono"><b>array</b></font>.</font> names, we decided to name this class simply <font face="Courier New, Courier, mono"><b>array</b></font>.</font>
<p><font face="Arial, Helvetica, sans-serif" size="-1"><a name="interface"></a>The <p><font face="Arial, Helvetica, sans-serif" size="-1">The class provides the
class provides the following interface:</font> following interface:</font>
<table border="0"> <table border="0">
<tr> <tr>
<td><font face="Arial, Helvetica, sans-serif" size="-1"><b>Types:</b></font></td> <td><font face="Arial, Helvetica, sans-serif" size="-1"><b>Types:</b></font></td>
@ -130,7 +127,7 @@
<tr> <tr>
<td><font face="Courier New, Courier, mono" size="-1">rend()</font></td> <td><font face="Courier New, Courier, mono" size="-1">rend()</font></td>
<td><font face="Arial, Helvetica, sans-serif" size="-1">returns reverse iterator <td><font face="Arial, Helvetica, sans-serif" size="-1">returns reverse iterator
for position behind last element of reverse iteration </font></td> for posistion behind last element of reverese iteration </font></td>
</tr> </tr>
<tr> <tr>
<td><font face="Courier New, Courier, mono" size="-1">operator[<i>i</i>]</font></td> <td><font face="Courier New, Courier, mono" size="-1">operator[<i>i</i>]</font></td>
@ -200,10 +197,10 @@
time</font></td> time</font></td>
</tr> </tr>
</table> </table>
<p><font face="Arial, Helvetica, sans-serif" size="-1"><a name="discussion"></a>Class <p><font face="Arial, Helvetica, sans-serif" size="-1">Class array fulfills most
array fulfills most but not all of the requirements of &quot;reversible containers&quot; but not all of the requirements of &quot;reversible containers&quot; (see Section
(see Section 23.1, [lib.container.requirements] of the C++ Standard). The reasons 23.1, [lib.container.requirements] of the C++ Standard). The reasons array is
array is not an reversible STL container is because: </font> <font face="Arial, Helvetica, sans-serif" size="-1"><br> not an reversible STL container is because: </font> <font face="Arial, Helvetica, sans-serif" size="-1"><br>
- No constructors are provided<br> - No constructors are provided<br>
- Elements may have an indetermined initial value (see below)<br> - Elements may have an indetermined initial value (see below)<br>
- swap() has no constant complexity<br> - swap() has no constant complexity<br>
@ -239,45 +236,43 @@
<li><font face="Arial, Helvetica, sans-serif" size="-1">It has no virtual functions.</font></li> <li><font face="Arial, Helvetica, sans-serif" size="-1">It has no virtual functions.</font></li>
</ul> </ul>
<p><font face="Arial, Helvetica, sans-serif" size="-1">The current implementation <p><font face="Arial, Helvetica, sans-serif" size="-1">The current implementation
uses this approach. However, being able to have indeterminate initial values useus this approach. However, being able to have indetermined initial values
is a big drawback. So, please give me some feedback, how useful you consider is a big drawback. So, please give me some feedback, how useful you consider
this feature to be. This leads to the list of <b>Open issues:</b></font> this feature to be. This leads to the list of <b>Open issues:</b></font>
<ul> <ul>
<li><font face="Arial, Helvetica, sans-serif" size="-1">Do we want initializer <li><font face="Arial, Helvetica, sans-serif">Do we want initializer list support
list support or would the following be OK?:</font> or would the following be OK?:</font>
<blockquote> <blockquote>
<p><font face="Courier New, Courier, mono" size="-1">int data[] = { 1, 2, <p><font face="Courier New, Courier, mono">int data[] = { 1, 2, 3, 4 }</font></p>
3, 4 }</font></p> <p><font face="Courier New, Courier, mono">array&lt;int,5&gt; x(data); <font face="Arial, Helvetica, sans-serif">or
<p><font face="Courier New, Courier, mono" size="-1">array&lt;int,5&gt; </font>&nbsp;&nbsp;array&lt;int,data&gt; x;</font></p>
x(data); <font face="Arial, Helvetica, sans-serif">or </font>&nbsp;&nbsp;array&lt;int,data&gt;
x;</font></p>
</blockquote> </blockquote>
</li> </li>
<li><font face="Arial, Helvetica, sans-serif" size="-1">Could &quot;<font face="Courier New, Courier, mono">{ <li><font face="Arial, Helvetica, sans-serif">Could &quot;<font face="Courier New, Courier, mono">{
</font>...<font face="Courier New, Courier, mono"> }</font>&quot; be used </font>...<font face="Courier New, Courier, mono"> }</font>&quot; be used
portably instead of &quot;<font face="Courier New, Courier, mono">{ { </font>...<font face="Courier New, Courier, mono"> portably instead of &quot;<font face="Courier New, Courier, mono">{ { </font>...<font face="Courier New, Courier, mono">
} }</font>&quot; to initialize values?</font> </li> } }</font>&quot; to initialize values?</font> </li>
<blockquote> <blockquote>
<p><font face="Arial, Helvetica, sans-serif" size="-1">8.5.1 (11) of the Standard <p><font face="Arial, Helvetica, sans-serif">8.5.1 (11) of the Standard seem
seems to allow it; however, gcc 2.95.2 prints a warning message.</font></p> to allow it; however, gcc 2.95.2 printa warning message.</font></p>
</blockquote> </blockquote>
<li><font face="Arial, Helvetica, sans-serif" size="-1">Any way to have determinate <li><font face="Arial, Helvetica, sans-serif">Any way to have determined initial
initial values and initializer list support?</font></li> values and initializer list support?</font></li>
<li><font face="Arial, Helvetica, sans-serif" size="-1">Static_casts for reverse <li><font face="Arial, Helvetica, sans-serif">Static_casts for reverse iterator
iterator stuff?</font></li> stuff</font><font face="Arial, Helvetica, sans-serif">?</font></li>
</ul> </ul>
<p><font face="Arial, Helvetica, sans-serif" size="-1">I'd appreciate any constructive <p><font face="Arial, Helvetica, sans-serif">I'd appreciate any constructive <a href="mailto:solutions@josuttis.com">feedback</a>.
<a href="mailto:solutions@josuttis.com">feedback</a>. <b>Please note: I don't <b>Please note: I don't have time to read all boost mails. Thus, to make sure
have time to read all boost mails. Thus, to make sure that feedback arrives that feedback arrives me, please send me a copy of each mail regarding this
me, please send me a copy of each mail regarding this class.</b></font> class.</b></font>
<p><font face="Arial, Helvetica, sans-serif"><a name="code"></a>The code is provided <p><font face="Arial, Helvetica, sans-serif">The code is provided "as is" without
"as is" without expressed or implied warranty.</font> expressed or implied warranty.</font>
<p><font face="Arial, Helvetica, sans-serif"><b>array.hpp</b>, the implementation <p><font face="Arial, Helvetica, sans-serif"><b>array.hpp</b>, the implementation
of <font face="Courier New, Courier, mono">array&lt;&gt;</font><b>:</b> </font> of <font face="Courier New, Courier, mono">array&lt;&gt;</font><b>:</b> </font>
<li><font face="Arial, Helvetica, sans-serif"> <li><font face="Arial, Helvetica, sans-serif">
<a href="array.hpp.html">as HTML file</a></font></li> <a href="array.hpp.html">as HTML file</a></font></li>
<li><font face="Arial, Helvetica, sans-serif"> <li><font face="Arial, Helvetica, sans-serif">
<a href="../../boost/array.hpp">as plain file</a></font></li> <a href="array.hpp">as plain file</a></font></li>
<p> <font face="Arial, Helvetica, sans-serif">Simple Example for using <font face="Courier New, Courier, mono">array&lt;&gt;<font face="Arial, Helvetica, sans-serif">:</font></font></font> <p> <font face="Arial, Helvetica, sans-serif">Simple Example for using <font face="Courier New, Courier, mono">array&lt;&gt;<font face="Arial, Helvetica, sans-serif">:</font></font></font>
<li><font face="Arial, Helvetica, sans-serif"> <li><font face="Arial, Helvetica, sans-serif">
<a href="array1.cpp.html">as HTML file</a></font> </li> <a href="array1.cpp.html">as HTML file</a></font> </li>
@ -319,12 +314,7 @@
&nbsp;&nbsp;&nbsp;&nbsp; ISBN 0-201-37926-0</font> <font face="Arial, Helvetica, sans-serif"><br> &nbsp;&nbsp;&nbsp;&nbsp; ISBN 0-201-37926-0</font> <font face="Arial, Helvetica, sans-serif"><br>
</font></li> </font></li>
<p><font face="Arial, Helvetica, sans-serif"><a href="http://www.josuttis.com/" TARGET="_top">Home <p><font face="Arial, Helvetica, sans-serif"><a href="http://www.josuttis.com/" TARGET="_top">Home
Page of Nicolai Josuttis</a></font><font face="Arial, Helvetica, sans-serif"> Page of Nicolai Josuttis</a></font> <font face="Arial, Helvetica, sans-serif"><br>
</font> &nbsp; </font>
<p><font size="-1" face="Arial, Helvetica, sans-serif">[<a href="#intro">intro</a>]
[<a href="#interface">interface</a>] [<a href="#discussion">discussion</a>]
[<a href="#code">code</a>]</font>
<p><font face="Arial, Helvetica, sans-serif" size="-1"></font>
<p><font face="Arial, Helvetica, sans-serif">&nbsp; </font>
</body> </body>
</html> </html>

View File

@ -1,8 +1,4 @@
/* simple example for using class array<> /* simple example for using class array<>
*
* Changelog:
* 20 Jan 2001 - Removed boolalpha use since stock GCC doesn't support it
* (David Abrahams)
*/ */
#include <iostream> #include <iostream>
#include <boost/array.hpp> #include <boost/array.hpp>
@ -22,7 +18,7 @@ int main()
// use some common STL container operations // use some common STL container operations
std::cout << "size: " << a.size() << std::endl; std::cout << "size: " << a.size() << std::endl;
std::cout << "empty: " << (a.empty() ? "true" : "false") << std::endl; std::cout << "empty: " << std::boolalpha << a.empty() << std::endl;
std::cout << "max_size: " << a.max_size() << std::endl; std::cout << "max_size: " << a.max_size() << std::endl;
std::cout << "front: " << a.front() << std::endl; std::cout << "front: " << a.front() << std::endl;
std::cout << "back: " << a.back() << std::endl; std::cout << "back: " << a.back() << std::endl;
@ -43,9 +39,8 @@ int main()
<< std::endl; << std::endl;
} }
else { else {
std::cout << "copy construction and copy assignment FAILED" std::cout << "copy construction and copy assignment are OK"
<< std::endl; << std::endl;
} }
return 0;
} }

View File

@ -56,7 +56,7 @@ int&nbsp;main()<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&nbsp;std::endl;<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&nbsp;std::endl;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR> &nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;{<BR> &nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::cout&nbsp;&lt;&lt;&nbsp;"copy&nbsp;construction&nbsp;and&nbsp;copy&nbsp;assignment&nbsp;FAILED"<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::cout&nbsp;&lt;&lt;&nbsp;"copy&nbsp;construction&nbsp;and&nbsp;copy&nbsp;assignment&nbsp;are&nbsp;OK"<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&nbsp;std::endl;<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&nbsp;std::endl;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR> &nbsp;&nbsp;&nbsp;&nbsp;}<BR>
}<BR> }<BR>

View File

@ -29,6 +29,5 @@ int main()
a.begin(), // destination a.begin(), // destination
negate<int>()); // operation negate<int>()); // operation
PRINT_ELEMENTS(a); PRINT_ELEMENTS(a);
return 0;
} }

View File

@ -35,7 +35,6 @@ int main()
std::cout << " " << *pos; std::cout << " " << *pos;
} }
std::cout << std::endl; std::cout << std::endl;
return 0;
} }
template <class T> template <class T>

View File

@ -32,6 +32,5 @@ int main()
std::cout << "last element of last array: " std::cout << "last element of last array: "
<< seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1] << seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1]
<< std::endl; << std::endl;
return 0;
} }

View File

@ -60,6 +60,5 @@ int main()
DArray da; DArray da;
da = ia; da = ia;
da.assign(42); da.assign(42);
return 0;
} }

View File

@ -11,8 +11,7 @@
* This software is provided "as is" without express or implied * This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose. * warranty, and with no claim as to its suitability for any purpose.
* *
* 20 Jan 2001 - STLport fix (Beman Dawes) * Jul 31, 2000
* 29 Sep 2000 - Initial Revision (Nico Josuttis)
*/ */
#ifndef BOOST_ARRAY_HPP #ifndef BOOST_ARRAY_HPP
#define BOOST_ARRAY_HPP #define BOOST_ARRAY_HPP
@ -22,7 +21,9 @@
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
// FIXES for broken compilers // BUG-FIX for compilers that don't support
// std::size_t and std::ptrdiff_t yet
// (such as gcc)
#include <boost/config.hpp> #include <boost/config.hpp>
namespace boost { namespace boost {
@ -49,14 +50,14 @@ namespace boost {
const_iterator end() const { return elems+N; } const_iterator end() const { return elems+N; }
// reverse iterator support // reverse iterator support
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#else # else
// workaround for broken reverse_iterator implementations // workaround for broken reverse_iterator implementations due to no partial specialization
typedef std::reverse_iterator<iterator,T> reverse_iterator; typedef std::reverse_iterator<iterator,T> reverse_iterator;
typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator; typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
#endif # endif
reverse_iterator rbegin() { return reverse_iterator(end()); } reverse_iterator rbegin() { return reverse_iterator(end()); }
const_reverse_iterator rbegin() const { const_reverse_iterator rbegin() const {
@ -87,6 +88,7 @@ namespace boost {
static size_type max_size() { return N; } static size_type max_size() { return N; }
enum { static_size = N }; enum { static_size = N };
public:
// swap (note: linear complexity) // swap (note: linear complexity)
void swap (array<T,N>& y) { void swap (array<T,N>& y) {
std::swap_ranges(begin(),end(),y.begin()); std::swap_ranges(begin(),end(),y.begin());
@ -108,10 +110,10 @@ namespace boost {
std::fill_n(begin(),size(),value); std::fill_n(begin(),size(),value);
} }
#ifndef BOOST_NO_PRIVATE_IN_AGGREGATE # ifndef BOOST_NO_PRIVATE_IN_AGGREGATE
private: private:
#endif # endif
// check range (may be private because it is static) // private member functions are allowed in aggregates [ISO 8.5.1]
static void rangecheck (size_type i) { static void rangecheck (size_type i) {
if (i >= size()) { throw std::range_error("array"); } if (i >= size()) { throw std::range_error("array"); }
} }

View File

@ -13,8 +13,8 @@
<tr> <tr>
<td bgcolor="#FFFFFF"><img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86"></td> <td bgcolor="#FFFFFF"><img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86"></td>
<td><a href="../../index.htm"><font face="Arial" color="#FFFFFF"><big>Home</big></font></a></td> <td><a href="../../index.htm"><font face="Arial" color="#FFFFFF"><big>Home</big></font></a></td>
<td><a href="../libraries.htm"><font face="Arial" color="#FFFFFF"><big>Libraries</big></font></a></td> <td><a href="../../libraries.htm"><font face="Arial" color="#FFFFFF"><big>Libraries</big></font></a></td>
<td><a href="../../people/people.htm"><font face="Arial" color="#FFFFFF"><big>People</big></font></a></td> <td><a href="../../people.htm"><font face="Arial" color="#FFFFFF"><big>People</big></font></a></td>
<td><a href="../../more/faq.htm"><font face="Arial" color="#FFFFFF"><big>FAQ</big></font></a></td> <td><a href="../../more/faq.htm"><font face="Arial" color="#FFFFFF"><big>FAQ</big></font></a></td>
<td><a href="../../more/index.htm"><font face="Arial" color="#FFFFFF"><big>More</big></font></a></td> <td><a href="../../more/index.htm"><font face="Arial" color="#FFFFFF"><big>More</big></font></a></td>
</tr> </tr>
@ -23,12 +23,13 @@
<p>The header array.hpp provides an STL compliant container wrapper for arrays <p>The header array.hpp provides an STL compliant container wrapper for arrays
of constant size. of constant size.
<ul> <ul>
<li><a href="array.html">Documentation</a> (HTML).</li> <li><a href="array.htm">Documentation</a> (HTML).</li>
<li>Header <a href="../../boost/array.hpp">array.hpp</a></li> <li>Header <a href="../../boost/array.hpp">array.hpp</a></li>
<li>See docs for links to example programs.</li> <li>See docs for links to example programs.</li>
<li>Download <a href="../../boost_all.zip">all of Boost</a> (ZIP format).</li>
<li>Submitted by <a href="http://www.josuttis.com">Nicolai M. Josuttis</a>.</li> <li>Submitted by <a href="http://www.josuttis.com">Nicolai M. Josuttis</a>.</li>
</ul> </ul>
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->14 Mar 2001<!--webbot bot="Timestamp" endspan i-checksum="14885" --></p> <p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->02 Aug 2000<!--webbot bot="Timestamp" endspan i-checksum="14748" --></p>
</body> </body>