Boost logo

Boost :

Subject: Re: [boost] AlRangeExandrescu?
From: Andrew Bromage (ajb_at_[hidden])
Date: 2009-07-26 22:19:02


Andrei Alexandrescu <andrei <at> metalanguage.com> writes:

> A design that has a bidirectional iterator walking freely up and down
> between two limits would be difficult to port to ranges. (If the
> iterator is random-access, things are trivial.) Ranges can only shrink,
> they never grow unless assigned from the outside.

I don't see a problem with this case. The limits are a range, and the
internal bidirectional iterator is a subrange of that range. There's
no reason why a subrange couldn't be allowed to grow since we know its
enclosing range.

> Another example of an iterator-based design that's not easy to replicate
> with ranges is Boost Multi-Index.

Right. Suffix arrays are a similar case (indeed, suffix arrays can be
represented straightforwardly with Boost.MultiIndex).

However, I suspect that the overwhelming majority of uses of
Boost.MultiIndex are better thought of as permutations rather than
a containers-of-iterators. If there was an abstract notion of
permutation that was just as high-level as ranges, most of these
problems may go away.

I say "most". I've used a containter-of-iterators to represent
inverted indexes, and they are definitely not permutations.

Andrew Bromage


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