mirror of
https://github.com/boostorg/array.git
synced 2025-06-26 12:31:41 +02:00
Compare commits
6 Commits
svn-branch
...
boost-1.18
Author | SHA1 | Date | |
---|---|---|---|
79056d1c51 | |||
52dadb9764 | |||
b62e1aa4e7 | |||
8c5daba6b3 | |||
6533fa4606 | |||
e3d87e942c |
@ -28,7 +28,7 @@
|
|||||||
<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" >* Jul 31, 2000</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" >*/</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>
|
||||||
@ -38,10 +38,8 @@
|
|||||||
#include <iterator><BR>
|
#include <iterator><BR>
|
||||||
#include <algorithm><BR>
|
#include <algorithm><BR>
|
||||||
<BR>
|
<BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// BUG-FIX for compilers that don't support</FONT></I><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" >// std::size_t and std::ptrdiff_t yet</FONT></I><BR>
|
#include <<A href="../../boost/config.hpp"><A href="http://www.boost.org/boost/config.hpp">boost/config.hpp</A></A>><BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// (such as gcc)</FONT></I><BR>
|
|
||||||
#include <<A href="./config.hpp.html">boost/config.hpp</A>><BR>
|
|
||||||
<BR>
|
<BR>
|
||||||
namespace boost {<BR>
|
namespace boost {<BR>
|
||||||
<BR>
|
<BR>
|
||||||
@ -67,8 +65,15 @@ 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>
|
||||||
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>
|
||||||
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// workaround for broken reverse_iterator implementations due to no partial specialization</FONT></I><BR>
|
||||||
|
typedef std::reverse_iterator<iterator,T> reverse_iterator;<BR>
|
||||||
|
typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;<BR>
|
||||||
|
#endif<BR>
|
||||||
|
<BR>
|
||||||
reverse_iterator rbegin() { return reverse_iterator(end()); }<BR>
|
reverse_iterator rbegin() { return reverse_iterator(end()); }<BR>
|
||||||
const_reverse_iterator rbegin() const {<BR>
|
const_reverse_iterator rbegin() const {<BR>
|
||||||
return const_reverse_iterator(end());<BR>
|
return const_reverse_iterator(end());<BR>
|
||||||
@ -98,7 +103,6 @@ namespace boost {<BR>
|
|||||||
static size_type max_size() { return N; }<BR>
|
static size_type max_size() { return N; }<BR>
|
||||||
enum { static_size = N };<BR>
|
enum { static_size = N };<BR>
|
||||||
<BR>
|
<BR>
|
||||||
public:<BR>
|
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// swap (note: linear complexity)</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// swap (note: linear complexity)</FONT></I><BR>
|
||||||
void swap (array<T,N>& y) {<BR>
|
void swap (array<T,N>& y) {<BR>
|
||||||
std::swap_ranges(begin(),end(),y.begin());<BR>
|
std::swap_ranges(begin(),end(),y.begin());<BR>
|
||||||
@ -120,7 +124,9 @@ namespace boost {<BR>
|
|||||||
std::fill_n(begin(),size(),value);<BR>
|
std::fill_n(begin(),size(),value);<BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
<BR>
|
<BR>
|
||||||
|
#ifndef BOOST_NO_PRIVATE_IN_AGGREGATE<BR>
|
||||||
private:<BR>
|
private:<BR>
|
||||||
|
#endif<BR>
|
||||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// check range (may be private because it is static)</FONT></I><BR>
|
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// check range (may be private because it is static)</FONT></I><BR>
|
||||||
static void rangecheck (size_type i) {<BR>
|
static void rangecheck (size_type i) {<BR>
|
||||||
if (i >= size()) { throw std::range_error("array"); }<BR>
|
if (i >= size()) { throw std::range_error("array"); }<BR>
|
||||||
|
11
array.html
11
array.html
@ -272,7 +272,7 @@
|
|||||||
<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="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">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>
|
||||||
@ -298,12 +298,7 @@
|
|||||||
<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><b><font face="Arial, Helvetica, sans-serif">All files</font></b>
|
<p><font face="Arial, Helvetica, sans-serif">
|
||||||
<li><font face="Arial, Helvetica, sans-serif"> <a href="array.zip">as ZIP file
|
|
||||||
(24KB)</a></font></li>
|
|
||||||
<li><font face="Arial, Helvetica, sans-serif"> <a href="array.tgz">as TGZ file
|
|
||||||
(13KB)</a><br>
|
|
||||||
<br>
|
|
||||||
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++
|
||||||
@ -312,7 +307,7 @@
|
|||||||
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></li>
|
</font>
|
||||||
<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"><br>
|
||||||
</font>
|
</font>
|
||||||
|
@ -39,7 +39,7 @@ int main()
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "copy construction and copy assignment are OK"
|
std::cout << "copy construction and copy assignment FAILED"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ int main()<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 FAILED"<BR>
|
||||||
<< std::endl;<BR>
|
<< std::endl;<BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
}<BR>
|
}<BR>
|
||||||
|
@ -11,7 +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.
|
||||||
*
|
*
|
||||||
* Jul 31, 2000
|
* Sep 29, 2000
|
||||||
*/
|
*/
|
||||||
#ifndef BOOST_ARRAY_HPP
|
#ifndef BOOST_ARRAY_HPP
|
||||||
#define BOOST_ARRAY_HPP
|
#define BOOST_ARRAY_HPP
|
||||||
@ -21,9 +21,7 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
// BUG-FIX for compilers that don't support
|
// FIXES for broken compilers
|
||||||
// std::size_t and std::ptrdiff_t yet
|
|
||||||
// (such as gcc)
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
@ -50,14 +48,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)
|
#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 due to no partial specialization
|
// 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 {
|
||||||
@ -88,7 +86,6 @@ 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());
|
||||||
@ -110,10 +107,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
|
||||||
// private member functions are allowed in aggregates [ISO 8.5.1]
|
// check range (may be private because it is static)
|
||||||
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"); }
|
||||||
}
|
}
|
||||||
|
@ -23,13 +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.htm">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>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 -->02 Aug 2000<!--webbot bot="Timestamp" endspan i-checksum="14748" --></p>
|
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->27 Sep 2000<!--webbot bot="Timestamp" endspan i-checksum="14936" --></p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user