V3 PATCH: Fixes ill-formed constructs in stl_iterator.h

Gabriel Dos Reis gdr@codesourcery.com
Mon Jun 25 23:41:00 GMT 2001


This patchlet corrects some ill-formed constructs in stl_iterator.h.
I can't imagine how those could be working before.  This patch is a
good candidate for branch.

Bootstrapped and tested on i686-pc-linux.

-- Gaby

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/ChangeLog,v
retrieving revision 1.682
diff -p -r1.682 ChangeLog
*** ChangeLog	2001/06/25 20:57:48	1.682
--- ChangeLog	2001/06/26 06:35:42
***************
*** 1,3 ****
--- 1,9 ----
+ 2001-06-26  Gabriel Dos Reis  <gdr@merlin.codesourcery.com>
+ 
+ 	* include/bits/stl_iterator.h (__normal_iterator<>): Qualify
+ 	dependent names with `typename'.  Bring in various required
+ 	iterator_traits members.  Can't imagine why that used to work.
+ 
  2001-06-25  Phil Edwards  <pme@sources.redhat.com>
              Kurt Garloff <garloff@suse.de>
  
Index: include/bits/stl_iterator.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/stl_iterator.h,v
retrieving revision 1.5
diff -p -r1.5 stl_iterator.h
*** stl_iterator.h	2001/06/23 00:08:46	1.5
--- stl_iterator.h	2001/06/26 06:35:42
*************** private:
*** 443,460 ****
  // _Iterator parameter is the same.
  template<typename _Iterator, typename _Container>
  class __normal_iterator
!   : public iterator<iterator_traits<_Iterator>::iterator_category,
!                     iterator_traits<_Iterator>::value_type,
!                     iterator_traits<_Iterator>::difference_type,
!                     iterator_traits<_Iterator>::pointer,
!                     iterator_traits<_Iterator>::reference>
  {
! 
  protected:
    _Iterator _M_current;
  
  public:
    typedef __normal_iterator<_Iterator, _Container> normal_iterator_type;
  
    __normal_iterator() : _M_current(_Iterator()) { }
  
--- 443,466 ----
  // _Iterator parameter is the same.
  template<typename _Iterator, typename _Container>
  class __normal_iterator
!   : public iterator<typename iterator_traits<_Iterator>::iterator_category,
!                     typename iterator_traits<_Iterator>::value_type,
!                     typename iterator_traits<_Iterator>::difference_type,
!                     typename iterator_traits<_Iterator>::pointer,
!                     typename iterator_traits<_Iterator>::reference>
  {
!   typedef iterator_traits<_Iterator> _Traits;
!   
  protected:
    _Iterator _M_current;
  
  public:
    typedef __normal_iterator<_Iterator, _Container> normal_iterator_type;
+   typedef typename _Traits::iterator_category iterator_category;
+   typedef typename _Traits::value_type value_type;
+   typedef typename _Traits::difference_type difference_type;
+   typedef typename _Traits::pointer pointer;
+   typedef typename _Traits::reference reference;
  
    __normal_iterator() : _M_current(_Iterator()) { }
  



More information about the Libstdc++ mailing list