Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2002-11-30 21:30:41


"Julia Donawald" <yg-boost-users_at_[hidden]> writes:

> Hi,
>
> I am trying to write my own iterator - class and using for that the
> boost::iterator_adaptor. I could find on the webpage several examples of how
> to connect an existing iterator like std::string::iterator or a simple array
> as "base-class" for my new iterator, but what can I do if I dont have any
> base-iterator? In the documentation I found the following sentence:
> "The Iterator Adaptor library allows you transform an arbitrary ``base''
> type into a standard-conforming iterator with the behaviors you choose.
> Doing so is especially easy if the ``base'' type is itself an iterator."
> In my situation I dont have any base type which is an iterator, so how
> should I now create such a base-type? Which are the specifications of such a
> base-type? Where can I get information on how to create a new base-type?
>
> I am trying to write an iterator which reads records from a file or a
> database and always when I do the it++ the next record is read from the file
> or database.

You might look at the counting iterator adaptor which can use an int
as a Base type.

-Dave

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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