Boost logo

Boost Users :

From: keithmac66 (keithmac66_at_[hidden])
Date: 2002-06-03 05:38:57


Hi,

I'm struggling to understand how to use Iterator Adaptors, due to a
lack of simple examples. This is disappointing, given that
supposedly "Using iterator_adaptor, you can easily implement an
iterator class" (www.boost.org/libs/utility/iterator_adaptors.htm).
Can anyone help, by explaining how to implement a random access
iterator for a custom collection class? e.g.:

    template <class T> class DumbCollection
    {
    public:
        DumbCollection(T data[10])
            { for (int i = 0; i < 10; i++) m_data[i] = data[i]; }
        iterator begin();
        iterator end();
    private:
        T m_data[10];
    };

Thanks, Keith


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net