Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-27 07:44:02

----- Original Message -----
From: "Toon Knapen" <toon.knapen_at_[hidden]>

> >>So I guess we converge to the scheme were the Base is the actual random
> >>iterator and which is the second argument to the
> >>make_permutation_iterator such that the past-the-end can be specified by
> >>means of the first argument
> >>
> >
> > I don't see why the argument order to the generator(s) is important, but
> > yes, I always thought that past-the-end should be determined by a
> > in the sequence of permutation indices.
> If the order is the first argument you can easily specify the
> past-the-end iterator like :
> permutation_type end = make_permutation_iterator< sequence::iterator,
> sequence::iterator >( order.end() );
> OK, the notation is not optimal ;-). The idea is just that ultimatly the
> user would only need to create a past-the-end permutation iterator with
> one argument, the past-the-end of the order. This is simpler for the
> user and less confusing, since otherwise the user needs to construct the
> past-the-end from two iterator of which one is actually not used (and
> thus what value should it have ideally ?)

OK. Downside: all end-of-sequence iterators using the same permutation but a
different element set look identical, thwarting bug detection somewhat.

> > FWIW, still think "permutation iterator" is still a better name for this
> > beast, even though it can be used to do other kinds of shuffled
> I agree. It should be stated clearly though that the
> permutation_iterator is not limited to bijections (every element in the
> original list maps to _exactly_ _one_ in the resulting permutation).

Yep. I suggest you make a new submission along the lines of Jens' recent
generator iterator adaptor. I'll be happy to add it to the library.


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