Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58012 - in trunk: boost/iterator libs/iterator/test
From: dave_at_[hidden]
Date: 2009-11-28 13:53:44


Author: dave
Date: 2009-11-28 13:53:43 EST (Sat, 28 Nov 2009)
New Revision: 58012
URL: http://svn.boost.org/trac/boost/changeset/58012

Log:
category of each component iterator is reduced to a known category before we try to find a minimum.
Closes #1517

Text files modified:
   trunk/boost/iterator/zip_iterator.hpp | 2 +-
   trunk/libs/iterator/test/zip_iterator_test.cpp | 24 ++++++++++++++++++++++++
   2 files changed, 25 insertions(+), 1 deletions(-)

Modified: trunk/boost/iterator/zip_iterator.hpp
==============================================================================
--- trunk/boost/iterator/zip_iterator.hpp (original)
+++ trunk/boost/iterator/zip_iterator.hpp 2009-11-28 13:53:43 EST (Sat, 28 Nov 2009)
@@ -357,7 +357,7 @@
     {
       typedef typename tuple_impl_specific::tuple_meta_transform<
           IteratorTuple
- , iterator_traversal<>
+ , pure_traversal_tag<iterator_traversal<> >
>::type tuple_of_traversal_tags;
           
       typedef typename tuple_impl_specific::tuple_meta_accumulate<

Modified: trunk/libs/iterator/test/zip_iterator_test.cpp
==============================================================================
--- trunk/libs/iterator/test/zip_iterator_test.cpp (original)
+++ trunk/libs/iterator/test/zip_iterator_test.cpp 2009-11-28 13:53:43 EST (Sat, 28 Nov 2009)
@@ -46,6 +46,7 @@
 #include <vector>
 #include <list>
 #include <set>
+#include <string>
 #include <functional>
 #include <boost/tuple/tuple.hpp>
 #include <boost/iterator/transform_iterator.hpp>
@@ -60,6 +61,27 @@
         typename boost::iterator_traversal<It>::type
>
 {};
+
+
+/// Tests for https://svn.boost.org/trac/boost/ticket/1517
+int to_value(int const &v)
+{
+ return v;
+}
+
+void category_test()
+{
+ std::list<int> rng1;
+ std::string rng2;
+
+ boost::make_zip_iterator(
+ boost::make_tuple(
+ boost::make_transform_iterator(rng1.begin(), &to_value), // BidirectionalInput
+ rng2.begin() // RandomAccess
+ )
+ );
+}
+///
   
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -70,6 +92,8 @@
 int main( void )
 {
 
+ category_test();
+
   std::cout << "\n"
             << "***********************************************\n"
             << "* *\n"


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