Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2005-01-02 16:45:12


David Abrahams wrote:
> Don't forget the test and doc patches!
>

Attached. I also corrected a very small problem I saw in the iterators
documentation while I was in there.

P.S. Happy New Year!

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Index: boost/iterator/iterator_adaptor.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/iterator/iterator_adaptor.hpp,v
retrieving revision 1.14
diff -b -d -u -u -r1.14 iterator_adaptor.hpp
--- boost/iterator/iterator_adaptor.hpp 2 Sep 2004 15:40:40 -0000 1.14
+++ boost/iterator/iterator_adaptor.hpp 2 Jan 2005 21:40:58 -0000
@@ -278,6 +278,8 @@
       {
       }
 
+ typedef Base base_type;
+
       Base const& base() const
         { return m_iterator; }
 
Index: libs/iterator/doc/iterator_adaptor_ref.rst
===================================================================
RCS file: /cvsroot/boost/boost/libs/iterator/doc/iterator_adaptor_ref.rst,v
retrieving revision 1.14
diff -b -d -u -u -r1.14 iterator_adaptor_ref.rst
--- libs/iterator/doc/iterator_adaptor_ref.rst 1 Nov 2004 21:23:47 -0000 1.14
+++ libs/iterator/doc/iterator_adaptor_ref.rst 2 Jan 2005 21:40:58 -0000
@@ -19,7 +19,8 @@
       friend class iterator_core_access;
    public:
       iterator_adaptor();
- explicit iterator_adaptor(Base iter);
+ explicit iterator_adaptor(Base const& iter);
+ typedef Base base_type;
       Base const& base() const;
    protected:
       typedef iterator_adaptor iterator_adaptor\_;
@@ -115,7 +116,7 @@
     ``m_iterator`` default constructed.
 
 
-``explicit iterator_adaptor(Base iter);``
+``explicit iterator_adaptor(Base const& iter);``
 
 :Returns: An instance of ``iterator_adaptor`` with
     ``m_iterator`` copy constructed from ``iter``.
Index: libs/iterator/test/iterator_adaptor_test.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/iterator/test/iterator_adaptor_test.cpp,v
retrieving revision 1.7
diff -b -d -u -u -r1.7 iterator_adaptor_test.cpp
--- libs/iterator/test/iterator_adaptor_test.cpp 19 Aug 2004 15:11:49 -0000 1.7
+++ libs/iterator/test/iterator_adaptor_test.cpp 2 Jan 2005 21:40:58 -0000
@@ -316,6 +316,19 @@
       assert((*i).m_x == i->foo());
   }
 
+ // check that base_type is correct
+ {
+ // Test constant iterator idiom
+ typedef ptr_iterator<int> BaseIter;
+
+ test = static_assert_same<BaseIter::base_type,int*>::value;
+ test = static_assert_same<constant_iterator<BaseIter>::base_type,BaseIter>::value;
+
+ typedef modify_traversal<BaseIter, boost::incrementable_traversal_tag> IncrementableIter;
+
+ test = static_assert_same<IncrementableIter::base_type,BaseIter>::value;
+ }
+
   std::cout << "test successful " << std::endl;
   (void)test;
   return 0;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk