Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2008-04-08 13:31:40


On reflection, I think the fact that the unneeded bounds checking can't be
turned off would probably dissuade me from using this. (I doubt any
compiler is going to be smart enough to realize the bounds check following
the modulus is unnecessary).

Too bad circular-buffer doesn't allow turning off the checking (via a
template parameter).

Jan Gaspar wrote:

> Yes, using the modulus operation would do. But I think wrapping the
> circular_buffer instead of deriving from it would suit better as there is
> no virtual destructor present in the circular_buffer.
>
> ----- Original Message ----
> From: Neal Becker <ndbecker2_at_[hidden]>
> To: boost_at_[hidden]
> Sent: Monday, 7 April, 2008 2:25:20 PM
> Subject: [boost] [circular-buffer] indexes
>
> I use my own implementation of circular buffers which simulate an infinite
> buffer that simply wraps around. The indexes are not restricted in either
> positive or negative direction. This is a very useful construct (believe
> it or not).
>
> It looks like boost::circular_buffer restricts the indexes. I suppose the
> straightforward way to use boost::circular_buffer would be derive from it
> and add a modulus operation to the indexing?
>


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