|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63410 - in branches/release: boost libs/array/doc libs/array/test
From: marshall_at_[hidden]
Date: 2010-06-28 13:59:24
Author: marshall
Date: 2010-06-28 13:59:21 EDT (Mon, 28 Jun 2010)
New Revision: 63410
URL: http://svn.boost.org/trac/boost/changeset/63410
Log:
Merged Array changes to release
Properties modified:
branches/release/boost/array.hpp (contents, props changed)
branches/release/libs/array/doc/array.xml (props changed)
branches/release/libs/array/test/array2.cpp (contents, props changed)
Text files modified:
branches/release/boost/array.hpp | 42 +++++++++++++++++++++++++++++++++++----
branches/release/libs/array/test/array2.cpp | 5 ++++
2 files changed, 42 insertions(+), 5 deletions(-)
Modified: branches/release/boost/array.hpp
==============================================================================
--- branches/release/boost/array.hpp (original)
+++ branches/release/boost/array.hpp 2010-06-28 13:59:21 EDT (Mon, 28 Jun 2010)
@@ -14,8 +14,8 @@
* http://www.boost.org/LICENSE_1_0.txt)
*
* 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group.
- * See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168
- * Eventually, we should remove "assign" which is now a synonym for "fill" (Marshall Clow)
+ * See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168
+ * Eventually, we should remove "assign" which is now a synonym for "fill" (Marshall Clow)
* 10 Mar 2010 - added workaround for SUNCC and !STLPort [trac #3893] (Marshall Clow)
* 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.
@@ -169,7 +169,7 @@
}
// assign one value to all elements
- void assign (const T& value) { fill ( value ); } // A synonym for fill
+ void assign (const T& value) { fill ( value ); } // A synonym for fill
void fill (const T& value)
{
std::fill_n(begin(),size(),value);
@@ -295,8 +295,8 @@
// assign one value to all elements
void assign (const T& value) { fill ( value ); }
- void fill (const T& ) {}
-
+ void fill (const T& ) {}
+
// check range (may be private because it is static)
static reference failed_rangecheck () {
std::out_of_range e("attempt to access element of an empty array");
@@ -346,6 +346,38 @@
x.swap(y);
}
+ // Specific for boost::array: simply returns its elems data member.
+ template <typename T, std::size_t N>
+ T(&get_c_array(boost::array<T,N>& arg))[N]
+ {
+ return arg.elems;
+ }
+
+ // Const version.
+ template <typename T, std::size_t N>
+ const T(&get_c_array(const boost::array<T,N>& arg))[N]
+ {
+ return arg.elems;
+ }
+
+#if 0
+ // Overload for std::array, assuming that std::array will have
+ // explicit conversion functions as discussed at the WG21 meeting
+ // in Summit, March 2009.
+ template <typename T, std::size_t N>
+ T(&get_c_array(std::array<T,N>& arg))[N]
+ {
+ return static_cast<T(&)[N]>(arg);
+ }
+
+ // Const version.
+ template <typename T, std::size_t N>
+ const T(&get_c_array(const std::array<T,N>& arg))[N]
+ {
+ return static_cast<T(&)[N]>(arg);
+ }
+#endif
+
} /* namespace boost */
Modified: branches/release/libs/array/test/array2.cpp
==============================================================================
--- branches/release/libs/array/test/array2.cpp (original)
+++ branches/release/libs/array/test/array2.cpp 2010-06-28 13:59:21 EDT (Mon, 28 Jun 2010)
@@ -5,6 +5,11 @@
* http://www.boost.org/LICENSE_1_0.txt)
*/
+#ifndef _SCL_SECURE_NO_WARNINGS
+// Suppress warnings from the std lib:
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
#include <algorithm>
#include <functional>
#include <boost/array.hpp>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk