Boost logo

Boost :

From: Jan Gaspar (jano_gaspar_at_[hidden])
Date: 2004-03-14 16:26:51


--- Thorsten Ottosen <nesotto_at_[hidden]> wrote:
> > > > > I guess a deque cannot guarantee sequential
> data. Or
> > > > > could it with a special
> > > > > allocator?
> > > > I don't understand this question.
> > >
> > > I mean a vector and a circular_buffer can pass a
> pointer to their data
> to
> > > C-style functions.
> > > A deque cannot because it's data is not
> guaranteed to be sequential. The
> > > question is if
> > > a deque could provide this guarantee somehow
> using eg. a special
> > allocator.
> >
> > A deque can't. From the way it is specified,
> it more-or-less has to be
> > implemented as several fixed-size buffers, plus a
> control structure to
> tell
> > which buffer is being used when.
>
> then what about one big fixed-sized buffer? Can't
> the allocator determine
> the buffer size?
>
> >A circular_buffer really can't be passed to
> > a C-style function either. What if the data
> starts in the middle and
> wraps
> > around the end?
>
> You would have to call data(), right?
>
Yes you're right.

I just want to mention one more problem with deque.
With deque as underlying container of the
circular_buffer, you have no or very limited control
over iterator invalidation.

Best regards,

Jan

__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com


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