Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-24 11:33:24


So, I conclude that there's no difference in capability between the two
implementations, since the straightforward permutation_iterator doesn't
detect duplicates and force a failure.

It seems that your implementation makes some interesting trade-offs w.r.t.
permutation_iterator:

PROS:
you get value_type (etc.) deduction for free, whereas you don't in the other
case because the Base iterator actually iterates over the permutation rather
than the sequence elements

You only have to dereference one iterator to access an element.

CONS:
You modify two underlying iterators whenever the adapted iterator changes
position.

You dereference on eiterator whenever the adapted iterator changes position

It is harder for you to assert that two iterators being compared actually
refer to the same sequence.

-Dave

P.S. Is it a sequence if element addresses are repeated? Hmm...

----- Original Message -----
From: "Toon Knapen" <toon.knapen_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, November 24, 2001 10:36 AM
Subject: Re: [boost] reorder_iterator : iterator_adaptor

> > That's really cool, but I'm not sure I grok the difference in
functionality
> > you achieve from an ordinary permutation iterator. In the ordinary case,
the
> > Base iterator iterates over the permutation offsets, and the policies
class
> > just holds an iterator to the start of the target sequence. It seems to
me
> > that you can change the values of the permutation offsets as you iterate
in
> > that case (and -- why not? -- use duplicate permutation entries) as
well.
>
>
> well it's almost similar to a permutation_iterator. In a permutation
> however, every index or entry can only be encountered once. But the
> implementation also allows multiple occurences of the same entry, as
> you remarked correctly, and thus I just called it a reorder_iterator
> (maybe the name is still misleading).
> Anyway, I actually needed a permutation iterator and therefor came up
> with this one.
>
> toon
>
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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