OSDN Git Service

2010-08-05 Paolo Carlini <paolo.carlini@oracle.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / include / bits / stl_iterator.h
index eb72900..105469a 100644 (file)
@@ -1,6 +1,6 @@
 // Iterators -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
+  /**
+   * @addtogroup iterators
+   * @{
+   */
+
   // 24.4.1 Reverse iterators
   /**
-   *  "Bidirectional and random access iterators have corresponding reverse
+   *  Bidirectional and random access iterators have corresponding reverse
    *  %iterator adaptors that iterate through the data structure in the
    *  opposite direction.  They have the same signatures as the corresponding
    *  iterators.  The fundamental relation between a reverse %iterator and its
@@ -78,9 +83,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *      &*(reverse_iterator(i)) == &*(i - 1)
    *  @endcode
    *
-   *  This mapping is dictated by the fact that while there is always a
+   *  <em>This mapping is dictated by the fact that while there is always a
    *  pointer past the end of an array, there might not be a valid pointer
-   *  before the beginning of an array." [24.4.1]/1,2
+   *  before the beginning of an array.</em> [24.4.1]/1,2
    *
    *  Reverse iterators can be tricky and surprising at first.  Their
    *  semantics make sense, however, and the trickiness is a side effect of
@@ -97,14 +102,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     protected:
       _Iterator current;
 
-    public:
-      typedef _Iterator                                               iterator_type;
-      typedef typename iterator_traits<_Iterator>::difference_type
-                                                              difference_type;
-      typedef typename iterator_traits<_Iterator>::reference   reference;
-      typedef typename iterator_traits<_Iterator>::pointer     pointer;
+      typedef iterator_traits<_Iterator>               __traits_type;
 
     public:
+      typedef _Iterator                                        iterator_type;
+      typedef typename __traits_type::difference_type  difference_type;
+      typedef typename __traits_type::pointer          pointer;
+      typedef typename __traits_type::reference                reference;
+
       /**
        *  The default constructor default-initializes member @p current.
        *  If it is a pointer, that means it is zero-initialized.
@@ -406,7 +411,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *                 reference-to-const T for container<T>.
        *  @return  This %iterator, for chained operations.
        *
-       *  This kind of %iterator doesn't really have a "position" in the
+       *  This kind of %iterator doesn't really have a @a position in the
        *  container (you can think of the position as being permanently at
        *  the end, if you like).  Assigning a value to the %iterator will
        *  always append the value to the end of the container.
@@ -432,12 +437,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       operator*()
       { return *this; }
 
-      /// Simply returns *this.  (This %iterator does not "move".)
+      /// Simply returns *this.  (This %iterator does not @a move.)
       back_insert_iterator&
       operator++()
       { return *this; }
 
-      /// Simply returns *this.  (This %iterator does not "move".)
+      /// Simply returns *this.  (This %iterator does not @a move.)
       back_insert_iterator
       operator++(int)
       { return *this; }
@@ -489,7 +494,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *                 reference-to-const T for container<T>.
        *  @return  This %iterator, for chained operations.
        *
-       *  This kind of %iterator doesn't really have a "position" in the
+       *  This kind of %iterator doesn't really have a @a position in the
        *  container (you can think of the position as being permanently at
        *  the front, if you like).  Assigning a value to the %iterator will
        *  always prepend the value to the front of the container.
@@ -515,12 +520,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       operator*()
       { return *this; }
 
-      /// Simply returns *this.  (This %iterator does not "move".)
+      /// Simply returns *this.  (This %iterator does not @a move.)
       front_insert_iterator&
       operator++()
       { return *this; }
 
-      /// Simply returns *this.  (This %iterator does not "move".)
+      /// Simply returns *this.  (This %iterator does not @a move.)
       front_insert_iterator
       operator++(int)
       { return *this; }
@@ -621,12 +626,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       operator*()
       { return *this; }
 
-      /// Simply returns *this.  (This %iterator does not "move".)
+      /// Simply returns *this.  (This %iterator does not @a move.)
       insert_iterator&
       operator++()
       { return *this; }
 
-      /// Simply returns *this.  (This %iterator does not "move".)
+      /// Simply returns *this.  (This %iterator does not @a move.)
       insert_iterator&
       operator++(int)
       { return *this; }
@@ -651,11 +656,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
                                         typename _Container::iterator(__i));
     }
 
+  // @} group iterators
+
 _GLIBCXX_END_NAMESPACE
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
-  // This iterator adapter is 'normal' in the sense that it does not
+  // This iterator adapter is @a normal in the sense that it does not
   // change the semantics of any of the operators of its iterator
   // parameter.  Its primary purpose is to convert an iterator that is
   // not a class, e.g. a pointer, into an iterator that is a class.
@@ -670,15 +677,15 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
     protected:
       _Iterator _M_current;
 
+      typedef iterator_traits<_Iterator>               __traits_type;
+
     public:
-      typedef _Iterator                                             iterator_type;
-      typedef typename iterator_traits<_Iterator>::iterator_category
-                                                             iterator_category;
-      typedef typename iterator_traits<_Iterator>::value_type  value_type;
-      typedef typename iterator_traits<_Iterator>::difference_type
-                                                             difference_type;
-      typedef typename iterator_traits<_Iterator>::reference reference;
-      typedef typename iterator_traits<_Iterator>::pointer   pointer;
+      typedef _Iterator                                        iterator_type;
+      typedef typename __traits_type::iterator_category iterator_category;
+      typedef typename __traits_type::value_type       value_type;
+      typedef typename __traits_type::difference_type  difference_type;
+      typedef typename __traits_type::reference        reference;
+      typedef typename __traits_type::pointer          pointer;
 
       __normal_iterator() : _M_current(_Iterator()) { }
 
@@ -869,6 +876,11 @@ _GLIBCXX_END_NAMESPACE
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
+  /**
+   * @addtogroup iterators
+   * @{
+   */
+
   // 24.4.3  Move iterators
   /**
    *  Class template move_iterator is an iterator adapter with the same
@@ -884,18 +896,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     protected:
       _Iterator _M_current;
 
+      typedef iterator_traits<_Iterator>               __traits_type;
+
     public:
-      typedef _Iterator                                        iterator_type;
-      typedef typename iterator_traits<_Iterator>::difference_type
-                                                               difference_type;
+      typedef _Iterator                                        iterator_type;
+      typedef typename __traits_type::iterator_category iterator_category;
+      typedef typename __traits_type::value_type       value_type;
+      typedef typename __traits_type::difference_type  difference_type;
       // NB: DR 680.
-      typedef _Iterator                                        pointer;
-      typedef typename iterator_traits<_Iterator>::value_type  value_type;
-      typedef typename iterator_traits<_Iterator>::iterator_category
-                                                               iterator_category;
-      typedef value_type&&                                     reference;
+      typedef _Iterator                                        pointer;
+      typedef value_type&&                             reference;
 
-    public:
       move_iterator()
       : _M_current() { }
 
@@ -1031,6 +1042,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     make_move_iterator(const _Iterator& __i)
     { return move_iterator<_Iterator>(__i); }
 
+  // @} group iterators
+
 _GLIBCXX_END_NAMESPACE
 
 #define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) std::make_move_iterator(_Iter)