Boost logo

Boost Users :

Subject: Re: [Boost-users] circular buffer in a multithreaded program
From: Sebastian Gesemann (s.gesemann_at_[hidden])
Date: 2014-04-24 03:51:42


On Thu, Apr 24, 2014 at 8:44 AM, Antony Polukhin <antoshkka_at_[hidden]> wrote:
>
> You are right. Iterator holds a pointer to circular_buffer and accesses some
> of its internals.
>
> However it is safe to use only iterators and overwrite independent parts of
> circular_buffer. All the operations with iterators do not modify internals
> of circular_bufer.
> So if you change cb.erase_first(n)/cb.resize(cb.capacity()) to iterator
> operations there must be no problems. Though I thinks that's what you have
> done in case of custom vector-based data structure.

And what iterator operations would that be? Before erase_first, I
tried the iterator-based erase, but it actually had iterator
invalidation properties that were of no use to me IIRC.

> Thanks for the investigation!

Thanks for taking the time to read what I had to say. :)

Cheers!
Sebastian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net