Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-07-18 16:56:10


Peter Dimov wrote:
> Some quick comments:
>
> "Sequence" doesn't guarantee traversal order... not a big
> problem, but the name "sequence" implies order. Unordered
> collections are typically "bags."

You have a point, but actually I think that it's more a bad wording on my
side (the docs say: "In general, a sequence does not guarantee that its
elements appear in any particular order") than a mismatch between the
"Sequence" name for the concept and what [I was trying to express] it
represents. The cited sentence probably should read like this: "In general,
a sequence does not guarantee that its _content_ doesn't change from one
iteration to another (or between subsequent compilation sessions)".

I think that "bag" would be actually a worse fit here, because, while the
name does imply a lack of order, it also implies the stability of the
content (i.e. a bag of random numbers is definitely not the same thing as
random numbers input sequence - although the former might be useful on its
own).

>
> "an algorithm that iterates through the range
> [begin<s>::type, end<s>::type)
> will pass through every element of s;"
>
> ... once.

Yes, thanks!

> The reference seems incomplete.

A little bit. I am working on it.

> I haven't found any mention of lambda
> expressions, or bind.

Will fix.

> No 'sort' algorithm?

A few were contributed, but I wanted a quick sort (like the one you've
posted a long time ago, but implemented in MPL terms), and never got to it.
Feel free to contribute! ;)

> Is MPL sequence-based, or is it iterator-based?

It's sequence-based in sense that most of the algorithms take a sequence and
do 'begin/end' (and some other things, like 'O1_size') internally.

> Let's take for example 'find'. It wants a sequence as a first argument.

Yep.

> How do I pass a subrange (the first half of an existing sequence, say) to
it?

typedef find< iterator_range< begin<Sequence>::type, middle >, T>::type
iter;

> The __typeof__ implementation hinted at in vector.html
> doesn't work for most (all) existing __typeof__ implementations.
> They strip references, and sometimes cv qualifiers.

I've read your next email that says that you take this back :), but just for
the record - it works with Metrowerks 8.1.

Aleksey


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