Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67481 - in trunk: boost libs/array/test
From: marshall_at_[hidden]
Date: 2010-12-28 14:14:25


Author: marshall
Date: 2010-12-28 14:14:23 EST (Tue, 28 Dec 2010)
New Revision: 67481
URL: http://svn.boost.org/trac/boost/changeset/67481

Log:
Added crbegin and crend to Boost.Array; refs #4761. Will close ticket when merged to release branch
Text files modified:
   trunk/boost/array.hpp | 16 +++++++++++++++-
   trunk/libs/array/test/array3.cpp | 7 +++++++
   2 files changed, 22 insertions(+), 1 deletions(-)

Modified: trunk/boost/array.hpp
==============================================================================
--- trunk/boost/array.hpp (original)
+++ trunk/boost/array.hpp 2010-12-28 14:14:23 EST (Tue, 28 Dec 2010)
@@ -13,7 +13,7 @@
  * accompanying file LICENSE_1_0.txt or copy at
  * http://www.boost.org/LICENSE_1_0.txt)
  *
- * 28 Dec 2010 - (mtc) Added cbegin and cend for C++Ox compatibility.
+ * 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility.
  * 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)
@@ -103,10 +103,17 @@
         const_reverse_iterator rbegin() const {
             return const_reverse_iterator(end());
         }
+ const_reverse_iterator crbegin() const {
+ return const_reverse_iterator(end());
+ }
+
         reverse_iterator rend() { return reverse_iterator(begin()); }
         const_reverse_iterator rend() const {
             return const_reverse_iterator(begin());
         }
+ const_reverse_iterator crend() const {
+ return const_reverse_iterator(begin());
+ }
 
         // operator[]
         reference operator[](size_type i)
@@ -237,10 +244,17 @@
         const_reverse_iterator rbegin() const {
             return const_reverse_iterator(end());
         }
+ const_reverse_iterator crbegin() const {
+ return const_reverse_iterator(end());
+ }
+
         reverse_iterator rend() { return reverse_iterator(begin()); }
         const_reverse_iterator rend() const {
             return const_reverse_iterator(begin());
         }
+ const_reverse_iterator crend() const {
+ return const_reverse_iterator(begin());
+ }
 
         // operator[]
         reference operator[](size_type /*i*/)

Modified: trunk/libs/array/test/array3.cpp
==============================================================================
--- trunk/libs/array/test/array3.cpp (original)
+++ trunk/libs/array/test/array3.cpp 2010-12-28 14:14:23 EST (Tue, 28 Dec 2010)
@@ -39,6 +39,13 @@
            =seasons.rbegin(); pos<seasons.rend(); ++pos) {
         std::cout << " " << *pos;
     }
+
+ // try constant reverse iterators
+ std::cout << "reverse: ";
+ for (boost::array<std::string,4>::const_reverse_iterator pos
+ =seasons.crbegin(); pos<seasons.crend(); ++pos) {
+ std::cout << " " << *pos;
+ }
     std::cout << std::endl;
 
     return 0; // makes Visual-C++ compiler happy


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