Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-25 09:10:06


----- Original Message -----
From: "Thomas Witt" <witt_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, January 25, 2002 8:51 AM
Subject: Re: [boost] Iterator adaptor documentation

>
> Dave,
>
> On Friday 25 January 2002 14:22, you wrote:
> > You're quite correct! Thanks for pointing that out. I can think of two
> > possibilities:
> >
> > 1. Just document that non-const base() is public
> > 2. Make the Policies class a friend of the iterator, and document that
> > non-const base() is private, but available to policies.
> >
> > Hmm, it seems you can't declare a template parameter to be a friend. I
> > guess it's #1. Jeremy, any thoughts?
> >
>
> I think the general problem is that iterator_adaptor has two seperate
classes
> of clients that have different interface requirements. This might indicate
a
> design flaw, though I am not sure.
>
> My personal opinion is that an iterator_adaptor that exposes its base
> iterator is dangerous and error prone. Thank of an cyclic iterator that
wraps
> around when it encounters the end iterator of the sequence. You can safely
> assume that this iterator is always dereferencable unless somebody fiddles
> with base(). The same problem applies to any adaptor that modifies the
> sequencing behaviour.

Yes, I understand the problem.

However, since so few compilers support friend templates, I don't see an
easy solution to that other than saying "don't touch". Do you?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk