Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-04-18 06:00:54

Vladimir Prus <ghost_at_[hidden]> writes:

> David Abrahams wrote:
>> > I've a very basic question for now: how to I convert "*rst" files in
>> > documentation to something nice-looking, like hmtl?
>> ReStructuredText:
>> Use the script in the tools/ directory
> Thanks, it worked. I've some initial comments now.
> 1. The documentation seems incomplete.

It is. We were really only advertising the code so far.

> I can't find the description of methods for "Derived" class of
> iterator_facade, for example.

Um, that's private, so it won't be documented (thanks Thomas!)

> 2. What is the relation with "new iterator categories". Am I
> supposed to pass old categories as template parameters to
> facade/adapter.

New or old; either one should work.

> 3. The attached code does not compile with gcc 3.2, saying that:
> /usr/include/c++/3.2/bits/stl_iterator_base_types.h:123: no type named `
> iterator_category' in `class my_old_iterator'
> The message is correct, but... I've explicitly specified iterator category
> when declaring iterator adaptor. Am I doing something wrong?

Yes, lots!

You need to implement at least advance, increment, equal, and
dereference in your derived iterator class in order to make a forward
iterator. Also, since your Base type is not an iterator, you need to
supply a difference_type for your adapted iterator (and there's no
eol at eof ;-)).

Also, for your particular application it looks like you might do
better by just using iterator_facade rather than iterator_adaptor. I

    To automate the repetitive work of constructing iterators, we
    propose ``iterator_facade``, an iterator base class template which
    provides the rich interface of standard iterators and delegates
    its implementation to member functions of the derived class. We
    also propose ``iterator_adaptor``, a base class generator designed
    specifically for creating iterator adaptors. Because iterators
    usually have many of the features of their underlying iterator
    type, the default features of ``iterator_adaptor`` are those of
    its base [#base]_. The user can selectively replace these features
    in a derived iterator class.

    .. [#base] The term "Base" is not meant to imply the use of
       inheritance. We have followed the lead of the standard library,
       which provides a base() function to access the underlying
       iterator object of a reverse - iterator adaptor.

> TIA,
> Volodya
> _______________________________________________
> Unsubscribe & other changes:

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at