Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-03-05 14:07:24


"Jeremy Maitin-Shepard" <jbms_at_[hidden]> wrote

> Perhaps in addition to a data() function, it would be useful if the
> container provided constant-time access to the data as two arrays.
> Perhaps something like std::pair<T *, T *> first_range() and std::pair<T
> *, T *> second_range(). (Where these can also be made available in
> const-form, since no internal modification is necessary) Then as
> Thorsten suggested, an operation such as linearize or reorder could be
> added which orders the elements such that first_range() contains all of
> the elements.
>
data() does 'linearization' when needed (it was called flatten()
when I proposed it ago).

Do you have an example where returning two arrays is much better than
optional reordering by data()? What kind of algorithm would be better to
be called twice?

/Pavel


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