Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-12-05 11:07:44


On Wed, 5 Dec 2001, Toon Knapen wrote:

toon.k> Jeremy Siek wrote:
toon.k>
toon.k> > Sure, and one could implement the permute function in terms of the
toon.k> > iterator adaptor, but I think it is still useful to have the algorithm
toon.k> > since it is more convenient.
toon.k>
toon.k> I agree for the inplace permutation.
toon.k> The other one is totally overlapping AFAICS.

Sure, but the permute_copy() is shorter to type, and easier for novices to
find and understand.

toon.k> to get philosophical : where's the border between
toon.k> algorithm and iterator.

The iterator approach can be more flexible and general since the users
decides when and how to "pull" values, but it is a bit harder to
understand, and more verbose to use. Also, the iterator approach is only
applicable when you don't need very much state to perform the operation
(unlike the inplace permute). I think it makes sense to provide both
approaches, since they cater to different usage situations.

Cheers,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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