FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
April 01, 2004

STL Sequences & the View Concept

(Page 3 of 5)
April 04:

Listing 1: Excerpt from the view's iterator interface.

template <typename RawIterator>
class view_iterator
{
public:
    // note the additional dereference in the following methods
    reference operator*()
    {
        return **raw_iterator_;
    }
    pointer operator->()
    {
        return *raw_iterator_;
    }
    reference operator[](int n)
    {
        return *(raw_iterator_[n]);
    }
    // "normal" iterator interface
    view_iterator & operator++()
    {
        ++raw_iterator_;
        return *this;
    }
    view_iterator & operator--()
    {
        --raw_iterator_;
        return *this;
    }
    // ...
private:
    RawIterator raw_iterator_;
};




    
    
      
    
    
Previous Page | 1 | 2 | 3 | 4 | 5 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK