Boost logo

Boost :

From: Dave Gomboc (dave_at_[hidden])
Date: 2003-07-21 07:14:18


> > 3. cb_iterator: is the m_end value needed?
> >
> > It can be computed using 'm_it == m_buff->m_last' in
> > those few (~2) places it is needed and if eliminated,
> > iterator will get smaller (by 30%) and simpler.
>
> Yes, the m_end member is needed. Suppose the circular_buffer is full.
> Then m_buff->m_first == m_buff->m_last. If there is no m_end variable
> how would you recognize that the iterator points to the beginning or
> end?

30% is a lot. Would it make sense to always allocate one extra element,
so that this equality can never occur?

Dave


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