Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-08-13 15:17:14


Not actually off-list.
From: "Terje Slettebø" <tslettebo_at_[hidden]>

> >From: "David Abrahams" <dave_at_[hidden]>
>
> >>From: "Terje Slettebø" <tslettebo_at_[hidden]>
>
> >> It depends on how the sort is implemented, I guess (one isn't present
in
> >the
> >> library, yet). As you know, C++ MP isn't mutating, so such a sort
would
> >> return a sorted copy of the half of the sequence. Likely stored in the
> >same
> >> kind of sequence as the original, to preserve the characteristics of
the
> >> original sequence.
>
> >No, and I'm pretty sure this is in part why MPL uses sequences instead
of
> >iterators: the algorithms that produce new sequences generally take an
> >empty version of the new sequence as an input, and "append" their
results
> >to it.
>
> >From the docs (http://www.mywikinet.com/mpl/ref/Table_of_Content.html),
the
> way you describe here doesn't appear to be used a lot. copy/copy_if works
> that way. However, other algorithms, like transform, doesn't work that
way.
>
> In fact, there isn't a lot of algorithms that take an empty sequence, and
> returns new sequence of the same type. Could you give more examples than
the
> ones above?

Nope.

> Preferable listed in the docs. :)
>
> Even though transform doesn't take an empty sequence as a parameter, it
says
> that it returns a sequence with the same characteristics as the input
> sequence. Which I why I assumed a sort could behave similarly.

OK. I guess I was wrong.

-Dave


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