stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r349021 - /incubator/stdcxx/trunk/tests/include/alg_test.h
Date Fri, 25 Nov 2005 20:32:31 GMT
Author: sebor
Date: Fri Nov 25 12:32:27 2005
New Revision: 349021

URL: http://svn.apache.org/viewcvs?rev=349021&view=rev
Log:
2005-11-25  Martin Sebor  <sebor@roguewave.com>

	* alg_test.h (ConstRandomAccessIter): Added the correct operator[],
	replacing the one inherited from the base class (which returns
	a non-const reference).

Modified:
    incubator/stdcxx/trunk/tests/include/alg_test.h

Modified: incubator/stdcxx/trunk/tests/include/alg_test.h
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/include/alg_test.h?rev=349021&r1=349020&r2=349021&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/include/alg_test.h (original)
+++ incubator/stdcxx/trunk/tests/include/alg_test.h Fri Nov 25 12:32:27 2005
@@ -1023,11 +1023,11 @@
         return !(*this < rhs);
     }
 
-    reference operator[] (difference_type i) const { 
+    reference operator[] (difference_type inx) const { 
         assert (   cur_ != 0
-                && (!end_ || cur_ + i < end_)
-                && !(begin_ || cur_ + i >= begin_));
-        return cur_ [i];
+                && (!end_ || cur_ + inx < end_)
+                && !(begin_ || cur_ + inx >= begin_));
+        return cur_ [inx];
     }
 
 // private:
@@ -1040,8 +1040,9 @@
 template <class T>
 struct ConstRandomAccessIter: RandomAccessIter<T>
 {
-    typedef T                            value_type;
-    typedef RandomAccessIter<value_type> Base;
+    typedef T                              value_type;
+    typedef RandomAccessIter<value_type>   Base;
+    typedef typename Base::difference_type difference_type;
 
     ConstRandomAccessIter (): Base () { }
 
@@ -1055,6 +1056,10 @@
     }
 
     _RWSTD_OPERATOR_ARROW (const value_type* operator-> () const);
+
+    const value_type& operator[] (difference_type inx) const {
+        return Base::operator[] (inx);
+    }
 };
 
 



Mime
View raw message