Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60436 - in trunk: boost libs/array/test
From: marshall_at_[hidden]
Date: 2010-03-10 13:03:31


Author: marshall
Date: 2010-03-10 13:03:30 EST (Wed, 10 Mar 2010)
New Revision: 60436
URL: http://svn.boost.org/trac/boost/changeset/60436

Log:
Added support for SunCC and 'fill' operation; tickets #3893 and #3168 respectively
Text files modified:
   trunk/boost/array.hpp | 22 +++++++++++++++++++---
   trunk/libs/array/test/array0.cpp | 2 +-
   2 files changed, 20 insertions(+), 4 deletions(-)

Modified: trunk/boost/array.hpp
==============================================================================
--- trunk/boost/array.hpp (original)
+++ trunk/boost/array.hpp 2010-03-10 13:03:30 EST (Wed, 10 Mar 2010)
@@ -13,6 +13,10 @@
  * accompanying file LICENSE_1_0.txt or copy at
  * 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)
+ * 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.
  * 05 Aug 2001 - minor update (Nico Josuttis)
@@ -80,6 +84,11 @@
                                       reference, iterator, reference> > reverse_iterator;
         typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
                                       const_reference, iterator, reference> > const_reverse_iterator;
+#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
+ typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
+ value_type, reference, iterator, difference_type> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
+ value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
 #else
         // workaround for broken reverse_iterator implementations
         typedef std::reverse_iterator<iterator,T> reverse_iterator;
@@ -160,7 +169,8 @@
         }
 
         // assign one value to all elements
- void assign (const T& value)
+ void assign (const T& value) { fill ( value ); } // A synonym for fill
+ void fill (const T& value)
         {
             std::fill_n(begin(),size(),value);
         }
@@ -205,6 +215,11 @@
                                       reference, iterator, reference> > reverse_iterator;
         typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
                                       const_reference, iterator, reference> > const_reverse_iterator;
+#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
+ typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
+ value_type, reference, iterator, difference_type> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
+ value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
 #else
         // workaround for broken reverse_iterator implementations
         typedef std::reverse_iterator<iterator,T> reverse_iterator;
@@ -279,8 +294,9 @@
         }
 
         // assign one value to all elements
- void assign (const T& ) { }
-
+ void assign (const T& value) { fill ( value ); }
+ 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");

Modified: trunk/libs/array/test/array0.cpp
==============================================================================
--- trunk/libs/array/test/array0.cpp (original)
+++ trunk/libs/array/test/array0.cpp 2010-03-10 13:03:30 EST (Wed, 10 Mar 2010)
@@ -32,7 +32,7 @@
     test_type test_case = {};
     const boost::array< T, 0 > const_test_case = test_type();
 
- test_case.assign( T() );
+ test_case.fill ( T() );
 
     // front/back and operator[] must compile, but calling them is undefined
     // Likewise, all tests below should evaluate to false, avoiding undefined behaviour


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