You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/06/16 23:15:59 UTC

svn commit: r414916 - /incubator/stdcxx/trunk/tests/include/alg_test.h

Author: sebor
Date: Fri Jun 16 14:15:59 2006
New Revision: 414916

URL: http://svn.apache.org/viewvc?rev=414916&view=rev
Log:
2006-06-16  Martin Sebor  <se...@roguewave.com>

	* alg_test.h (InputIter ctor): Asserted a precondition.
	(InputIter, OutputIter, ...): Changed the actual type
	of difference_type from plain int to ptrdiff_t.
	(make_iter): Made the type of the first argument const T*
	for const iterator overloads of the function template.

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

Modified: incubator/stdcxx/trunk/tests/include/alg_test.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/include/alg_test.h?rev=414916&r1=414915&r2=414916&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/include/alg_test.h (original)
+++ incubator/stdcxx/trunk/tests/include/alg_test.h Fri Jun 16 14:15:59 2006
@@ -601,7 +601,7 @@
     typedef T                       value_type;
     typedef value_type*             pointer;
     typedef value_type&             reference;
-    typedef int                     difference_type;
+    typedef _RWSTD_PTRDIFF_T        difference_type;
     typedef std::input_iterator_tag iterator_category;
 
     // body shared by all copies of the same InputIter specialization
@@ -616,7 +616,9 @@
         Shared (const value_type *cur,
                 const value_type *beg,
                 const value_type *end)
-            : cur_ (cur), beg_ (beg), end_ (end), ref_ (1) { }
+            : cur_ (cur), beg_ (beg), end_ (end), ref_ (1) {
+            RW_ASSERT (beg_ <= cur_ && cur_ <= end_);
+        }
 
         ~Shared () {
             cur_ = beg_ = end_ = 0;
@@ -723,7 +725,7 @@
     typedef T                        value_type;
     typedef value_type*              pointer;
     typedef value_type&              reference;
-    typedef int                      difference_type;
+    typedef _RWSTD_PTRDIFF_T         difference_type;
     typedef std::output_iterator_tag iterator_category;
 
     // body shared by all copies of the same OutputIter specialization
@@ -850,7 +852,7 @@
     typedef T                         value_type;
     typedef value_type*               pointer;
     typedef value_type&               reference;
-    typedef int                       difference_type;
+    typedef _RWSTD_PTRDIFF_T          difference_type;
     typedef std::forward_iterator_tag iterator_category;
 
     FwdIter (): cur_ (0), end_ (0) { }
@@ -934,7 +936,7 @@
     typedef T                               value_type;
     typedef value_type*                     pointer;
     typedef value_type&                     reference;
-    typedef int                             difference_type;
+    typedef _RWSTD_PTRDIFF_T                difference_type;
     typedef std::bidirectional_iterator_tag iterator_category;
 
     BidirIter (): cur_ (0), begin_ (0), end_ (0) { }
@@ -1030,7 +1032,7 @@
     typedef T                               value_type;
     typedef value_type*                     pointer;
     typedef value_type&                     reference;
-    typedef int                             difference_type;
+    typedef _RWSTD_PTRDIFF_T                difference_type;
     typedef std::random_access_iterator_tag iterator_category;
 
     RandomAccessIter (): cur_ (0), begin_ (0), end_ (0) { }
@@ -1247,7 +1249,7 @@
 
 template <class T>
 inline ConstFwdIter<T>
-make_iter (T *cur, const T *begin, const T *end, ConstFwdIter<T>)
+make_iter (const T *cur, const T *begin, const T *end, ConstFwdIter<T>)
 {
     return ConstFwdIter<T>(cur, begin, end);
 }
@@ -1285,7 +1287,7 @@
 
 template <class T>
 inline ConstBidirIter<T>
-make_iter (T *cur, const T *begin, const T *end, ConstBidirIter<T>)
+make_iter (const T *cur, const T *begin, const T *end, ConstBidirIter<T>)
 {
     return ConstBidirIter<T>(cur, begin, end);
 }
@@ -1323,7 +1325,7 @@
 
 template <class T>
 inline ConstRandomAccessIter<T>
-make_iter (T *cur, const T *begin, const T *end, ConstRandomAccessIter<T>)
+make_iter (const T *cur, const T *begin, const T *end, ConstRandomAccessIter<T>)
 {
     return ConstRandomAccessIter<T>(cur, begin, end);
 }