mirror of
https://github.com/boostorg/array.git
synced 2025-07-02 23:36:31 +02:00
Installed some updates from Nicolai Josuttis
[SVN r22065]
This commit is contained in:
@ -10,6 +10,9 @@
|
|||||||
|
|
||||||
<copyright>
|
<copyright>
|
||||||
<year>2001</year>
|
<year>2001</year>
|
||||||
|
<year>2002</year>
|
||||||
|
<year>2003</year>
|
||||||
|
<year>2004</year>
|
||||||
<holder>Nicolai M. Josuttis</holder>
|
<holder>Nicolai M. Josuttis</holder>
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
@ -276,6 +279,12 @@
|
|||||||
<returns><simpara><code>elems</code></simpara></returns>
|
<returns><simpara><code>elems</code></simpara></returns>
|
||||||
<throws><simpara>will not throw</simpara></throws>
|
<throws><simpara>will not throw</simpara></throws>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="c_array">
|
||||||
|
<type>T*</type>
|
||||||
|
<returns><simpara><code>elems</code></simpara></returns>
|
||||||
|
<throws><simpara>will not throw</simpara></throws>
|
||||||
|
</method>
|
||||||
</method-group>
|
</method-group>
|
||||||
|
|
||||||
<method-group name="modifiers">
|
<method-group name="modifiers">
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
* See
|
* See
|
||||||
* http://www.josuttis.com/cppcode
|
* http://www.josuttis.com/cppcode
|
||||||
* for details and the latest version.
|
* for details and the latest version.
|
||||||
|
* See
|
||||||
|
* http://www.boost.org/libs/array for Documentation.
|
||||||
|
* for documentation.
|
||||||
*
|
*
|
||||||
* (C) Copyright Nicolai M. Josuttis 2001.
|
* (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
|
||||||
@ -11,14 +14,14 @@
|
|||||||
* 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.
|
||||||
*
|
*
|
||||||
|
* 29 Jan 2004 - c_array() added, BOOST_NO_PRIVATE_IN_AGGREGATE removed (Nico Josuttis)
|
||||||
* 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries.
|
* 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries.
|
||||||
* 05 Aug 2001 - minor update (Nico Josuttis)
|
* 05 Aug 2001 - minor update (Nico Josuttis)
|
||||||
* 20 Jan 2001 - STLport fix (Beman Dawes)
|
* 20 Jan 2001 - STLport fix (Beman Dawes)
|
||||||
* 29 Sep 2000 - Initial Revision (Nico Josuttis)
|
* 29 Sep 2000 - Initial Revision (Nico Josuttis)
|
||||||
|
*
|
||||||
|
* Jan 29, 2004
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// See http://www.boost.org/libs/array for Documentation.
|
|
||||||
|
|
||||||
#ifndef BOOST_ARRAY_HPP
|
#ifndef BOOST_ARRAY_HPP
|
||||||
#define BOOST_ARRAY_HPP
|
#define BOOST_ARRAY_HPP
|
||||||
|
|
||||||
@ -32,6 +35,7 @@
|
|||||||
// FIXES for broken compilers
|
// FIXES for broken compilers
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
template<class T, std::size_t N>
|
template<class T, std::size_t N>
|
||||||
@ -105,9 +109,12 @@ namespace boost {
|
|||||||
std::swap_ranges(begin(),end(),y.begin());
|
std::swap_ranges(begin(),end(),y.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
// direct access to data
|
// direct access to data (read-only)
|
||||||
const T* data() const { return elems; }
|
const T* data() const { return elems; }
|
||||||
|
|
||||||
|
// use array as C array (direct read/write access to data)
|
||||||
|
T* c_array() { return elems; }
|
||||||
|
|
||||||
// assignment with type conversion
|
// assignment with type conversion
|
||||||
template <typename T2>
|
template <typename T2>
|
||||||
array<T,N>& operator= (const array<T2,N>& rhs) {
|
array<T,N>& operator= (const array<T2,N>& rhs) {
|
||||||
@ -121,12 +128,11 @@ namespace boost {
|
|||||||
std::fill_n(begin(),size(),value);
|
std::fill_n(begin(),size(),value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_NO_PRIVATE_IN_AGGREGATE
|
|
||||||
private:
|
|
||||||
#endif
|
|
||||||
// check range (may be private because it is static)
|
// 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<>: index out of range");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -166,10 +172,3 @@ namespace boost {
|
|||||||
} /* namespace boost */
|
} /* namespace boost */
|
||||||
|
|
||||||
#endif /*BOOST_ARRAY_HPP*/
|
#endif /*BOOST_ARRAY_HPP*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user