mirror of
https://github.com/boostorg/array.git
synced 2025-06-26 12:31:41 +02:00
Compare commits
14 Commits
boost-1.19
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
f18070dc23 | |||
b87433497e | |||
09c271cf34 | |||
f5699ae164 | |||
f96ac657dd | |||
7f73413eed | |||
640d1434bf | |||
624bd0e218 | |||
ad82e2b25c | |||
44887bfe59 | |||
fd76085150 | |||
aac83e6667 | |||
a673bc6e82 | |||
a91e96a8ab |
@ -19,16 +19,16 @@
|
|||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* an STL container (as wrapper) for arrays of constant size.</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* an STL container (as wrapper) for arrays of constant size.</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* See</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* See</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* http://www.josuttis.com/cppcode</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* <a href="http://www.josuttis.com/cppcode">http://www.josuttis.com/cppcode</a></FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* for details and the latest version.</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* for details and the latest version.</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* (C) Copyright Nicolai M. Josuttis 1999.</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* (C) Copyright Nicolai M. Josuttis 2001.</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* Permission to copy, use, modify, sell and distribute this software</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* Permission to copy, use, modify, sell and distribute this software</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* is granted provided this copyright notice appears in all copies.</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* is granted provided this copyright notice appears in all copies.</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* This software is provided "as is" without express or implied</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* This software is provided "as is" without express or implied</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* warranty, and with no claim as to its suitability for any purpose.</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* warranty, and with no claim as to its suitability for any purpose.</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* Sep 29, 2000</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* Aug 05, 2001</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*/</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*/</FONT></I><BR>
|
||||||
#ifndef BOOST_ARRAY_HPP<BR>
|
#ifndef BOOST_ARRAY_HPP<BR>
|
||||||
#define BOOST_ARRAY_HPP<BR>
|
#define BOOST_ARRAY_HPP<BR>
|
||||||
@ -39,7 +39,7 @@
|
|||||||
#include <algorithm><BR>
|
#include <algorithm><BR>
|
||||||
<BR>
|
<BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// FIXES for broken compilers</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// FIXES for broken compilers</FONT></I><BR>
|
||||||
#include <<A href="../../boost/config.hpp"><A href="http://www.boost.org/boost/config.hpp">boost/config.hpp</A></A>><BR>
|
#include <<A href="../../boost/config.hpp">boost/config.hpp</A>><BR>
|
||||||
<BR>
|
<BR>
|
||||||
namespace boost {<BR>
|
namespace boost {<BR>
|
||||||
<BR>
|
<BR>
|
||||||
@ -65,11 +65,11 @@ namespace boost {<BR>
|
|||||||
const_iterator end() const { return elems+N; }<BR>
|
const_iterator end() const { return elems+N; }<BR>
|
||||||
<BR>
|
<BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// reverse iterator support</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// reverse iterator support</FONT></I><BR>
|
||||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)<BR>
|
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)<BR>
|
||||||
typedef std::reverse_iterator<iterator> reverse_iterator;<BR>
|
typedef std::reverse_iterator<iterator> reverse_iterator;<BR>
|
||||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;<BR>
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;<BR>
|
||||||
#else<BR>
|
#else<BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// workaround for broken reverse_iterator implementations due to no partial specialization</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// workaround for broken reverse_iterator implementations</FONT></I><BR>
|
||||||
typedef std::reverse_iterator<iterator,T> reverse_iterator;<BR>
|
typedef std::reverse_iterator<iterator,T> reverse_iterator;<BR>
|
||||||
typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;<BR>
|
typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;<BR>
|
||||||
#endif<BR>
|
#endif<BR>
|
||||||
|
105
array.html
105
array.html
@ -15,11 +15,14 @@
|
|||||||
Wrapper) for Arrays of Constant Size</font></b></td>
|
Wrapper) for Arrays of Constant Size</font></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p><font face="Arial, Helvetica, sans-serif" size="-1">The C++ Standard Template
|
<p><font size="-1" face="Arial, Helvetica, sans-serif">[<a href="#intro">intro</a>]
|
||||||
Library STL as part of the C++ Standard Library provides a framework for processing
|
[<a href="#interface">interface</a>] [<a href="#discussion">discussion</a>]
|
||||||
algorithms on different kind of containers. However, ordinary arrays don't provide
|
[<a href="#code">code</a>]</font>
|
||||||
the interface of STL containers (although, they provide the iterator interface
|
<p><font face="Arial, Helvetica, sans-serif" size="-1"><a name="intro"></a>The
|
||||||
of STL containers).</font>
|
C++ Standard Template Library STL as part of the C++ Standard Library provides
|
||||||
|
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<></font>.
|
arrays, the STL provides class <font face="Courier New, Courier, mono">vector<></font>.
|
||||||
However, <font face="Courier New, Courier, mono">vector<></font> provides
|
However, <font face="Courier New, Courier, mono">vector<></font> provides
|
||||||
@ -38,8 +41,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">The class provides the
|
<p><font face="Arial, Helvetica, sans-serif" size="-1"><a name="interface"></a>The
|
||||||
following interface:</font>
|
class provides the 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>
|
||||||
@ -127,7 +130,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 posistion behind last element of reverese iteration </font></td>
|
for position behind last element of reverse 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>
|
||||||
@ -197,15 +200,15 @@
|
|||||||
time</font></td>
|
time</font></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p><font face="Arial, Helvetica, sans-serif" size="-1">Class array fulfills most
|
<p><font face="Arial, Helvetica, sans-serif" size="-1"><a name="discussion"></a>Class
|
||||||
but not all of the requirements of "reversible containers" (see Section
|
array fulfills most but not all of the requirements of "reversible containers"
|
||||||
23.1, [lib.container.requirements] of the C++ Standard). The reasons array is
|
(see Section 23.1, [lib.container.requirements] of the C++ Standard). The reasons
|
||||||
not an reversible STL container is because: </font> <font face="Arial, Helvetica, sans-serif" size="-1"><br>
|
array is 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 undetermined initial value (see below)<br>
|
||||||
- swap() has no constant complexity<br>
|
- swap() has no constant complexity<br>
|
||||||
- size() is always constant, based on the second template argument of the type<br>
|
- size() is always constant, based on the second template argument of the type<br>
|
||||||
- The container provides no allocator support</font>
|
- The container provides no allocator support</font>
|
||||||
<p><font face="Arial, Helvetica, sans-serif" size="-1">It doesn't fulfill the
|
<p><font face="Arial, Helvetica, sans-serif" size="-1">It doesn't fulfill the
|
||||||
requirements of a "sequence" (see Section 23.1.1, [lib.sequence.reqmts]
|
requirements of a "sequence" (see Section 23.1.1, [lib.sequence.reqmts]
|
||||||
of the C++ Standard), except that</font> <font face="Arial, Helvetica, sans-serif" size="-1"><br>
|
of the C++ Standard), except that</font> <font face="Arial, Helvetica, sans-serif" size="-1"><br>
|
||||||
@ -236,69 +239,76 @@
|
|||||||
<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
|
||||||
useus this approach. However, being able to have indetermined initial values
|
uses this approach. However, being able to have indeterminate 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">Do we want initializer list support
|
<li><font face="Arial, Helvetica, sans-serif" size="-1">Do we want initializer
|
||||||
or would the following be OK?:</font>
|
list support or would the following be OK?:</font>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><font face="Courier New, Courier, mono">int data[] = { 1, 2, 3, 4 }</font></p>
|
<p><font face="Courier New, Courier, mono" size="-1">int data[] = { 1, 2,
|
||||||
<p><font face="Courier New, Courier, mono">array<int,5> x(data); <font face="Arial, Helvetica, sans-serif">or
|
3, 4 }</font></p>
|
||||||
</font> array<int,data> x;</font></p>
|
<p><font face="Courier New, Courier, mono" size="-1">array<int,5>
|
||||||
|
x(data); <font face="Arial, Helvetica, sans-serif">or </font> array<int,data>
|
||||||
|
x;</font></p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</li>
|
</li>
|
||||||
<li><font face="Arial, Helvetica, sans-serif">Could "<font face="Courier New, Courier, mono">{
|
<li><font face="Arial, Helvetica, sans-serif" size="-1">Could "<font face="Courier New, Courier, mono">{
|
||||||
</font>...<font face="Courier New, Courier, mono"> }</font>" be used
|
</font>...<font face="Courier New, Courier, mono"> }</font>" be used
|
||||||
portably instead of "<font face="Courier New, Courier, mono">{ { </font>...<font face="Courier New, Courier, mono">
|
portably instead of "<font face="Courier New, Courier, mono">{ { </font>...<font face="Courier New, Courier, mono">
|
||||||
} }</font>" to initialize values?</font> </li>
|
} }</font>" to initialize values?</font> </li>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><font face="Arial, Helvetica, sans-serif">8.5.1 (11) of the Standard seem
|
<p><font face="Arial, Helvetica, sans-serif" size="-1">8.5.1 (11) of the Standard
|
||||||
to allow it; however, gcc 2.95.2 printa warning message.</font></p>
|
seems to allow it; however, gcc 2.95.2 prints a warning message.</font></p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<li><font face="Arial, Helvetica, sans-serif">Any way to have determined initial
|
<li><font face="Arial, Helvetica, sans-serif" size="-1">Any way to have determinate
|
||||||
values and initializer list support?</font></li>
|
initial values and initializer list support?</font></li>
|
||||||
<li><font face="Arial, Helvetica, sans-serif">Static_casts for reverse iterator
|
<li><font face="Arial, Helvetica, sans-serif" size="-1">Static_casts for reverse
|
||||||
stuff</font><font face="Arial, Helvetica, sans-serif">?</font></li>
|
iterator stuff?</font></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p><font face="Arial, Helvetica, sans-serif">I'd appreciate any constructive <a href="mailto:solutions@josuttis.com">feedback</a>.
|
<p><font face="Arial, Helvetica, sans-serif" size="-1">I'd appreciate any constructive
|
||||||
<b>Please note: I don't have time to read all boost mails. Thus, to make sure
|
<a href="mailto:solutions@josuttis.com">feedback</a>. <b>Please note: I don't
|
||||||
that feedback arrives me, please send me a copy of each mail regarding this
|
have time to read all boost mails. Thus, to make sure that feedback arrives
|
||||||
class.</b></font>
|
me, please send me a copy of each mail regarding this class.</b></font>
|
||||||
<p><font face="Arial, Helvetica, sans-serif">The code is provided "as is" without
|
<p><font face="Arial, Helvetica, sans-serif"><a name="code"></a>The code is provided
|
||||||
expressed or implied warranty.</font>
|
"as is" without 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<></font><b>:</b> </font>
|
of <font face="Courier New, Courier, mono">array<></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="../../boost/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<><font face="Arial, Helvetica, sans-serif">:</font></font></font>
|
<p> <font face="Arial, Helvetica, sans-serif"><b>array1.cpp</b>, a simple example
|
||||||
|
for using <font face="Courier New, Courier, mono">array<><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>
|
||||||
<li><font face="Arial, Helvetica, sans-serif">
|
<li><font face="Arial, Helvetica, sans-serif">
|
||||||
<a href="array1.cpp">as plain file</a></font></li>
|
<a href="array1.cpp">as plain file</a></font></li>
|
||||||
<p> <font face="Arial, Helvetica, sans-serif">Another Example for using <font face="Courier New, Courier, mono">array<><font face="Arial, Helvetica, sans-serif">:</font></font></font>
|
<p> <font face="Arial, Helvetica, sans-serif"><b>array2.cpp</b>, another example
|
||||||
|
for using <font face="Courier New, Courier, mono">array<><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="array2.cpp.html">as HTML file</a></font></li>
|
<a href="array2.cpp.html">as HTML file</a></font></li>
|
||||||
<li><font face="Arial, Helvetica, sans-serif">
|
<li><font face="Arial, Helvetica, sans-serif">
|
||||||
<a href="array2.cpp">as plain file</a></font></li>
|
<a href="array2.cpp">as plain file</a></font></li>
|
||||||
<p> <font face="Arial, Helvetica, sans-serif">A third Example for using <font face="Courier New, Courier, mono">array<><font face="Arial, Helvetica, sans-serif">:</font></font></font>
|
<p> <font face="Arial, Helvetica, sans-serif"><b>array3.cpp</b>, a third example
|
||||||
|
for using <font face="Courier New, Courier, mono">array<><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="array3.cpp.html">as HTML file</a></font></li>
|
<a href="array3.cpp.html">as HTML file</a></font></li>
|
||||||
<li><font face="Arial, Helvetica, sans-serif">
|
<li><font face="Arial, Helvetica, sans-serif">
|
||||||
<a href="array3.cpp">as plain file</a></font></li>
|
<a href="array3.cpp">as plain file</a></font></li>
|
||||||
<p> <font face="Arial, Helvetica, sans-serif">An Example for using <font face="Courier New, Courier, mono">array</font>s
|
<p> <font face="Arial, Helvetica, sans-serif"><b>array4.cpp</b>, an example for
|
||||||
of <font face="Courier New, Courier, mono">array</font>s<font face="Courier New, Courier, mono"><font face="Arial, Helvetica, sans-serif">:</font></font></font>
|
using <font face="Courier New, Courier, mono">array</font>s of <font face="Courier New, Courier, mono">array</font>s<font face="Courier New, Courier, mono"><font face="Arial, Helvetica, sans-serif">:</font></font></font>
|
||||||
<li><font face="Arial, Helvetica, sans-serif"> <a href="array4.cpp.html">as HTML
|
<li><font face="Arial, Helvetica, sans-serif"> <a href="array4.cpp.html">as HTML
|
||||||
file</a></font></li>
|
file</a></font></li>
|
||||||
<li><font face="Arial, Helvetica, sans-serif"> <a href="array4.cpp">as plain file</a></font></li>
|
<li><font face="Arial, Helvetica, sans-serif"> <a href="array4.cpp">as plain file</a></font></li>
|
||||||
<p><font face="Arial, Helvetica, sans-serif">An Example for testing other operations
|
<p><font face="Arial, Helvetica, sans-serif"><b>array5.cpp</b>, an example for
|
||||||
of <font face="Courier New, Courier, mono">array<></font><font face="Courier New, Courier, mono"><font face="Arial, Helvetica, sans-serif">:</font></font></font>
|
testing other operations of <font face="Courier New, Courier, mono">array<><font face="Arial, Helvetica, sans-serif">:</font></font></font>
|
||||||
<li><font face="Arial, Helvetica, sans-serif"> <a href="array5.cpp.html">as HTML
|
<li><font face="Arial, Helvetica, sans-serif"> <a href="array5.cpp.html">as HTML
|
||||||
file</a></font></li>
|
file</a></font></li>
|
||||||
<li><font face="Arial, Helvetica, sans-serif"> <a href="array5.cpp">as plain file</a></font></li>
|
<li><font face="Arial, Helvetica, sans-serif"> <a href="array5.cpp">as plain file</a></font></li>
|
||||||
<p><font face="Arial, Helvetica, sans-serif">
|
<br>
|
||||||
|
<br>
|
||||||
|
<font face="Arial, Helvetica, sans-serif">
|
||||||
To find more details about using ordinary arrays in C++ and the framework of
|
To find more details about using ordinary arrays in C++ and the framework of
|
||||||
the STL, see e.g.</font> <font face="Arial, Helvetica, sans-serif"><br>
|
the STL, see e.g.</font> <font face="Arial, Helvetica, sans-serif"><br>
|
||||||
<i> <a href="http://www.josuttis.com/libbook/">The C++
|
<i> <a href="http://www.josuttis.com/libbook/">The C++
|
||||||
@ -307,9 +317,14 @@
|
|||||||
M. Josuttis</a></font> <font face="Arial, Helvetica, sans-serif"><br>
|
M. Josuttis</a></font> <font face="Arial, Helvetica, sans-serif"><br>
|
||||||
Addison Wesley Longman, 1999</font> <font face="Arial, Helvetica, sans-serif"><br>
|
Addison Wesley Longman, 1999</font> <font face="Arial, Helvetica, sans-serif"><br>
|
||||||
ISBN 0-201-37926-0</font> <font face="Arial, Helvetica, sans-serif"><br>
|
ISBN 0-201-37926-0</font> <font face="Arial, Helvetica, sans-serif"><br>
|
||||||
</font>
|
</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"><br>
|
Page of Nicolai Josuttis</a></font><font face="Arial, Helvetica, sans-serif">
|
||||||
</font>
|
</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"> </font>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
12
array1.cpp
12
array1.cpp
@ -1,4 +1,8 @@
|
|||||||
/* 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>
|
||||||
@ -18,7 +22,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: " << std::boolalpha << a.empty() << std::endl;
|
std::cout << "empty: " << (a.empty() ? "true" : "false") << 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;
|
||||||
@ -36,11 +40,13 @@ int main()
|
|||||||
c = a;
|
c = a;
|
||||||
if (a==b && a==c) {
|
if (a==b && a==c) {
|
||||||
std::cout << "copy construction and copy assignment are OK"
|
std::cout << "copy construction and copy assignment are OK"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "copy construction and copy assignment FAILED"
|
std::cout << "copy construction and copy assignment FAILED"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0; // makes Visual-C++ compiler happy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,12 +53,14 @@ int main()<BR>
|
|||||||
c = a;<BR>
|
c = a;<BR>
|
||||||
if (a==b && a==c) {<BR>
|
if (a==b && a==c) {<BR>
|
||||||
std::cout << "copy construction and copy assignment are OK"<BR>
|
std::cout << "copy construction and copy assignment are OK"<BR>
|
||||||
<< std::endl;<BR>
|
<< std::endl;<BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
else {<BR>
|
else {<BR>
|
||||||
std::cout << "copy construction and copy assignment FAILED"<BR>
|
std::cout << "copy construction and copy assignment FAILED"<BR>
|
||||||
<< std::endl;<BR>
|
<< std::endl;<BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
|
<BR>
|
||||||
|
return 0; <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// makes Visual-C++ compiler happy</FONT></I><BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
<BR>
|
<BR>
|
||||||
</SPAN>
|
</SPAN>
|
||||||
|
10
array2.cpp
10
array2.cpp
@ -12,22 +12,24 @@ int main()
|
|||||||
// create and initialize array
|
// create and initialize array
|
||||||
array<int,10> a = { { 1, 2, 3, 4, 5 } };
|
array<int,10> a = { { 1, 2, 3, 4, 5 } };
|
||||||
|
|
||||||
PRINT_ELEMENTS(a);
|
print_elements(a);
|
||||||
|
|
||||||
// modify elements directly
|
// modify elements directly
|
||||||
for (unsigned i=0; i<a.size(); ++i) {
|
for (unsigned i=0; i<a.size(); ++i) {
|
||||||
++a[i];
|
++a[i];
|
||||||
}
|
}
|
||||||
PRINT_ELEMENTS(a);
|
print_elements(a);
|
||||||
|
|
||||||
// change order using an STL algorithm
|
// change order using an STL algorithm
|
||||||
reverse(a.begin(),a.end());
|
reverse(a.begin(),a.end());
|
||||||
PRINT_ELEMENTS(a);
|
print_elements(a);
|
||||||
|
|
||||||
// negate elements using STL framework
|
// negate elements using STL framework
|
||||||
transform(a.begin(),a.end(), // source
|
transform(a.begin(),a.end(), // source
|
||||||
a.begin(), // destination
|
a.begin(), // destination
|
||||||
negate<int>()); // operation
|
negate<int>()); // operation
|
||||||
PRINT_ELEMENTS(a);
|
print_elements(a);
|
||||||
|
|
||||||
|
return 0; // makes Visual-C++ compiler happy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,23 +29,25 @@ int main()<BR>
|
|||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// create and initialize array</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// create and initialize array</FONT></I><BR>
|
||||||
array<int,10> a = { { 1, 2, 3, 4, 5 } };<BR>
|
array<int,10> a = { { 1, 2, 3, 4, 5 } };<BR>
|
||||||
<BR>
|
<BR>
|
||||||
PRINT_ELEMENTS(a);<BR>
|
print_elements(a);<BR>
|
||||||
<BR>
|
<BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// modify elements directly</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// modify elements directly</FONT></I><BR>
|
||||||
for (unsigned i=0; i<a.size(); ++i) {<BR>
|
for (unsigned i=0; i<a.size(); ++i) {<BR>
|
||||||
++a[i];<BR>
|
++a[i];<BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
PRINT_ELEMENTS(a);<BR>
|
print_elements(a);<BR>
|
||||||
<BR>
|
<BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// change order using an STL algorithm</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// change order using an STL algorithm</FONT></I><BR>
|
||||||
reverse(a.begin(),a.end());<BR>
|
reverse(a.begin(),a.end());<BR>
|
||||||
PRINT_ELEMENTS(a);<BR>
|
print_elements(a);<BR>
|
||||||
<BR>
|
<BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// negate elements using STL framework</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// negate elements using STL framework</FONT></I><BR>
|
||||||
transform(a.begin(),a.end(), <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// source</FONT></I><BR>
|
transform(a.begin(),a.end(), <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// source</FONT></I><BR>
|
||||||
a.begin(), <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// destination</FONT></I><BR>
|
a.begin(), <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// destination</FONT></I><BR>
|
||||||
negate<int>()); <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// operation</FONT></I><BR>
|
negate<int>()); <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// operation</FONT></I><BR>
|
||||||
PRINT_ELEMENTS(a);<BR>
|
print_elements(a);<BR>
|
||||||
|
<BR>
|
||||||
|
return 0; <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// makes Visual-C++ compiler happy</FONT></I><BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
<BR>
|
<BR>
|
||||||
</SPAN>
|
</SPAN>
|
||||||
|
@ -17,7 +17,7 @@ int main()
|
|||||||
// copy and change order
|
// copy and change order
|
||||||
boost::array<std::string,4> seasons_orig = seasons;
|
boost::array<std::string,4> seasons_orig = seasons;
|
||||||
for (unsigned i=seasons.size()-1; i>0; --i) {
|
for (unsigned i=seasons.size()-1; i>0; --i) {
|
||||||
swap(seasons.at(i),seasons.at((i+1)%seasons.size()));
|
std::swap(seasons.at(i),seasons.at((i+1)%seasons.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "one way: ";
|
std::cout << "one way: ";
|
||||||
@ -25,7 +25,7 @@ int main()
|
|||||||
|
|
||||||
// try swap()
|
// try swap()
|
||||||
std::cout << "other way: ";
|
std::cout << "other way: ";
|
||||||
swap(seasons,seasons_orig);
|
std::swap(seasons,seasons_orig);
|
||||||
print_elements(seasons);
|
print_elements(seasons);
|
||||||
|
|
||||||
// try reverse iterators
|
// try reverse iterators
|
||||||
@ -35,6 +35,8 @@ int main()
|
|||||||
std::cout << " " << *pos;
|
std::cout << " " << *pos;
|
||||||
}
|
}
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
|
return 0; // makes Visual-C++ compiler happy
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -52,6 +52,8 @@ int main()<BR>
|
|||||||
std::cout << " " << *pos;<BR>
|
std::cout << " " << *pos;<BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
std::cout << std::endl;<BR>
|
std::cout << std::endl;<BR>
|
||||||
|
<BR>
|
||||||
|
return 0; <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// makes Visual-C++ compiler happy</FONT></I><BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
<BR>
|
<BR>
|
||||||
template <class T><BR>
|
template <class T><BR>
|
||||||
|
@ -31,6 +31,8 @@ int main()
|
|||||||
// print last element of last array
|
// print last element of last array
|
||||||
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; // makes Visual-C++ compiler happy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,9 @@ int main()<BR>
|
|||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// print last element of last array</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// print last element of last array</FONT></I><BR>
|
||||||
std::cout << "last element of last array: "<BR>
|
std::cout << "last element of last array: "<BR>
|
||||||
<< seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1]<BR>
|
<< seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1]<BR>
|
||||||
<< std::endl;<BR>
|
<< std::endl;<BR>
|
||||||
|
<BR>
|
||||||
|
return 0; <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// makes Visual-C++ compiler happy</FONT></I><BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
<BR>
|
<BR>
|
||||||
</SPAN>
|
</SPAN>
|
||||||
|
13
array5.cpp
13
array5.cpp
@ -27,7 +27,8 @@ int main()
|
|||||||
// use some common STL container operations
|
// use some common STL container operations
|
||||||
std::cout << "static_size: " << a.size() << std::endl;
|
std::cout << "static_size: " << a.size() << std::endl;
|
||||||
std::cout << "size: " << a.size() << std::endl;
|
std::cout << "size: " << a.size() << std::endl;
|
||||||
std::cout << "empty: " << std::boolalpha << a.empty() << std::endl;
|
// Can't use std::boolalpha because it isn't portable
|
||||||
|
std::cout << "empty: " << (a.empty()? "true" : "false") << 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;
|
||||||
@ -47,18 +48,20 @@ int main()
|
|||||||
c = a;
|
c = a;
|
||||||
if (a==b && a==c) {
|
if (a==b && a==c) {
|
||||||
std::cout << "copy construction and copy assignment are OK"
|
std::cout << "copy construction and copy assignment are OK"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "copy construction and copy assignment are OK"
|
std::cout << "copy construction and copy assignment are BROKEN"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef boost::array<double,6> DArray;
|
typedef boost::array<double,6> DArray;
|
||||||
typedef boost::array<int,6> IArray;
|
typedef boost::array<int,6> IArray;
|
||||||
IArray ia = { 1, 2, 3, 4, 5, 6 };
|
IArray ia = { { 1, 2, 3, 4, 5, 6 } } ; // extra braces silence GCC warning
|
||||||
DArray da;
|
DArray da;
|
||||||
da = ia;
|
da = ia;
|
||||||
da.assign(42);
|
da.assign(42);
|
||||||
|
|
||||||
|
return 0; // makes Visual-C++ compiler happy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,11 +64,11 @@ int main()<BR>
|
|||||||
c = a;<BR>
|
c = a;<BR>
|
||||||
if (a==b && a==c) {<BR>
|
if (a==b && a==c) {<BR>
|
||||||
std::cout << "copy construction and copy assignment are OK"<BR>
|
std::cout << "copy construction and copy assignment are OK"<BR>
|
||||||
<< std::endl;<BR>
|
<< std::endl;<BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
else {<BR>
|
else {<BR>
|
||||||
std::cout << "copy construction and copy assignment are OK"<BR>
|
std::cout << "copy construction and copy assignment are BROKEN"<BR>
|
||||||
<< std::endl;<BR>
|
<< std::endl;<BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
<BR>
|
<BR>
|
||||||
typedef boost::array<double,6> DArray;<BR>
|
typedef boost::array<double,6> DArray;<BR>
|
||||||
@ -77,6 +77,8 @@ int main()<BR>
|
|||||||
DArray da;<BR>
|
DArray da;<BR>
|
||||||
da = ia;<BR>
|
da = ia;<BR>
|
||||||
da.assign(42);<BR>
|
da.assign(42);<BR>
|
||||||
|
<BR>
|
||||||
|
return 0; <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// makes Visual-C++ compiler happy</FONT></I><BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
<BR>
|
<BR>
|
||||||
</SPAN>
|
</SPAN>
|
||||||
|
@ -5,13 +5,15 @@
|
|||||||
* http://www.josuttis.com/cppcode
|
* http://www.josuttis.com/cppcode
|
||||||
* for details and the latest version.
|
* for details and the latest version.
|
||||||
*
|
*
|
||||||
* (C) Copyright Nicolai M. Josuttis 1999.
|
* (C) Copyright Nicolai M. Josuttis 2001.
|
||||||
* Permission to copy, use, modify, sell and distribute this software
|
* Permission to copy, use, modify, sell and distribute this software
|
||||||
* is granted provided this copyright notice appears in all copies.
|
* is granted provided this copyright notice appears in all copies.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* Sep 29, 2000
|
* 05 Aug 2001 - minor update (Nico Josuttis)
|
||||||
|
* 20 Jan 2001 - STLport fix (Beman Dawes)
|
||||||
|
* 29 Sep 2000 - Initial Revision (Nico Josuttis)
|
||||||
*/
|
*/
|
||||||
#ifndef BOOST_ARRAY_HPP
|
#ifndef BOOST_ARRAY_HPP
|
||||||
#define BOOST_ARRAY_HPP
|
#define BOOST_ARRAY_HPP
|
||||||
@ -48,11 +50,17 @@ 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)
|
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
|
||||||
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;
|
||||||
|
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
|
||||||
|
// workaround for broken reverse_iterator in VC7
|
||||||
|
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, iterator,
|
||||||
|
reference, iterator, reference> > reverse_iterator;
|
||||||
|
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
|
||||||
|
const_reference, iterator, reference> > const_reverse_iterator;
|
||||||
#else
|
#else
|
||||||
// workaround for broken reverse_iterator implementations due to no partial specialization
|
// workaround for broken reverse_iterator implementations
|
||||||
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
|
||||||
@ -152,3 +160,4 @@ namespace boost {
|
|||||||
} /* namespace boost */
|
} /* namespace boost */
|
||||||
|
|
||||||
#endif /*BOOST_ARRAY_HPP*/
|
#endif /*BOOST_ARRAY_HPP*/
|
||||||
|
|
||||||
|
@ -26,10 +26,9 @@ of constant size.
|
|||||||
<li><a href="array.html">Documentation</a> (HTML).</li>
|
<li><a href="array.html">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 -->10 Nov 2000<!--webbot bot="Timestamp" endspan i-checksum="15233" --></p>
|
<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>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
*/
|
*/
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
/* PRINT_ELEMENTS()
|
/* print_elements()
|
||||||
* - prints optional C-string optcstr followed by
|
* - prints optional C-string optcstr followed by
|
||||||
* - all elements of the collection coll
|
* - all elements of the collection coll
|
||||||
* - separated by spaces
|
* - separated by spaces
|
||||||
*/
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void PRINT_ELEMENTS (const T& coll, const char* optcstr="")
|
inline void print_elements (const T& coll, const char* optcstr="")
|
||||||
{
|
{
|
||||||
typename T::const_iterator pos;
|
typename T::const_iterator pos;
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@
|
|||||||
<SPAN class="Source">
|
<SPAN class="Source">
|
||||||
#include <iostream><BR>
|
#include <iostream><BR>
|
||||||
<BR>
|
<BR>
|
||||||
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* PRINT_ELEMENTS()</FONT></I><BR>
|
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* print_elements()</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* - prints optional C-string optcstr followed by</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* - prints optional C-string optcstr followed by</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* - all elements of the collection coll</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* - all elements of the collection coll</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* - separated by spaces</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >* - separated by spaces</FONT></I><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*/</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >*/</FONT></I><BR>
|
||||||
template <class T><BR>
|
template <class T><BR>
|
||||||
inline void PRINT_ELEMENTS (const T& coll, const char* optcstr="")<BR>
|
inline void print_elements (const T& coll, const char* optcstr="")<BR>
|
||||||
{<BR>
|
{<BR>
|
||||||
typename T::const_iterator pos;<BR>
|
typename T::const_iterator pos;<BR>
|
||||||
<BR>
|
<BR>
|
||||||
|
Reference in New Issue
Block a user