Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-07-21 08:46:34


Jan Gaspar wrote:
>>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?

I think that by adding some more logic, it should be possible to
eliminate the m_end. The flag can be replaces by letting m_it point
behind m_buff or set it to 0. I think it's worth to test it, although
it's hard to predict the benchmark results...

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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