| | | | | |

Random Access Iterators

  • Bidirectional iterator with random access:
  • // bracket operator
    T&        operator [] (unsigned int i) const;      // Return reference to Tval
                                                       // at index i
    // "pointer" arithmetic
    long      operator -  (const Iterator& I2) const;  // n  = I - I2
    Iterator  operator +  (long n) const;              // I2 = I + n
    Iterator  operator -  (long n) const;              // I2 = I - n
    Iterator& operator += (long n);                    // I += n same as I = I + n
    Iterator& operator -= (long n);                    // I -= n same as I = I - n
    
    // similar declarations of last three for all other integral types
    

| | Top of Page | 7. Iterators - 5 of 13