Boost logo

Boost :

From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2002-10-17 18:28:57


At Thursday 2002/10/17 09:25, you wrote:
> >From: "Samuel Krempp" <krempp_at_[hidden]>
>
> >le Dimanche 13 Octobre 2002 18:59, tslettebo_at_[hidden] écrivit :
>
> >> As pointed out in another posting, as I understand, the only thing you
>can
> >> safely do with an end() iterator is to compare it with other iterators.
> >> Without this guarantee, it would limit how you could implement the end()
> >> iterator. See my other posting with the tree-iterators for an example.
>How
> >> would you implement operator--() on that end() iterator?
>
> >Well, schematically, the tree iterator I wrote keep a pointer to the root
> >of the tree from which it came, plus a 'current node' pointer that is set
> >to NULL for end().
> >then calling -- on an end pointer does :
> >.go to root
> >.{go down, and to your right, as much as you can }
>
> >it's very similar to what you do in ++begin() for an In-order iteration.
> >And even in post-order, when at a node on the bottom, calling ++ might
> >lead to more internal node iterations than --end()
> >(as you need to first go up. possibly up to root).
>
> >All in all I don't see tree iterators as an argument to disallow --end().
>
>No, that wasn't the point, either. The point was that the implementation I
>mentioned wouldn't be able to handle --end(), yet it would be able to use
>end(). However, I've since read up on the iterator requirements, and found
>that such an iterator would not be a conforming bidirectional/random access
>iterator, either (as mentioned earlier in the thread).

I'm dismayed (slightly) to discover that the containerators I wrote a year
ago aren't really conforming bidirectional iterators. You know, in all
that time, nobody's complained? Am I going to fix them? Not for the
original users, I don't work there anymore. Do I think that doubling the
memory requirements just so someone can do the equivalent of --end() is
worth it? Not really. Maybe we need a new class
called either-directional which becomes testable when it "steps off the
end" but that can't "come back".

>Regards,
>
>Terje
>
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Victor A. Wagner Jr. http://rudbek.com
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
               "There oughta be a law"


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