Boost logo

Boost :

From: Thomas Witt (witt_at_[hidden])
Date: 2002-01-25 08:51:26


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.

Thomas

-- 
Dipl.-Ing. Thomas Witt
Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover
voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001
http://www.ive.uni-hannover.de

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