Boost logo

Boost :

From: Jan Gaspar (jga_at_[hidden])
Date: 2003-10-02 06:04:32


Hi all!

After long time the new version was released. It is downloadable from
http://groups.yahoo.com/group/boost/files/circular_buffer.zip

Comments:

> 6. circular_buffer_adapter.hpp: member m_final_capacity
> may be named m_max_capacity.
> 7. Maybe there should be low treshold to capacity as well as high.
> Actual capacity may vary between these. This would avoid
> unnecessary reallocations when there are only few items.
>
This has been done, but not exactly as proposed. See the source - hope you'd like
it.

> 17. Maybe function data() should return 0 if buffer is empty instead
> of pointer pointing to garbage. It would at least make app behavior
> predictable.
>
Done.

> 20. Documentation: at the beginning of circular_buffer.html can be picture
> to give quick clue to people who do not read documentation throroughly
> ;-)
>
I changed the picture little bit - I had to shrink it.

> 22. The code can use static_asserts to check if InputIterator::value_type
> is convertible to T (using type traits, many places).
>
I did it like this:
BOOST_STATIC_ASSERT((is_convertible<typename
detail::iterator_traits<InputIterator>::value_type, T>::value));

It worked perfectly for MSVC 7 but didn't for MSVC 6. Moreover the documentation
says that is_convertible doesn't work for Borland C++ Builder 5 (and earlier) and
for the Metrowerks 7 (and earlier). So I removed the static assert - I don't want
prevent users of these compilers of using the circular_buffer just because of such
subtle thing as static assert.

> 23. Something to catch errors better: could function destroy() set all
> internal pointers to 0? (at least in debug mode). This would lead
> to predictable behavior with orphaned iterators.
>
Done. See also the "Debug Support" paragraph in the documentation.

> Similarly, circular_buffer_space_optimized can (before deallocating,
> in debug mode) fill old buffer with 0xCC or so.
>
Done automatically when the old buffer destructor is called.

-------

I updated the rule for iterator invalidation for swap operation. In the old
documentation the rule was like this:
"Swap does not invalidate any iterator, but the iterators will point to different
container."
I changed it to:
"Swap does invalidate iterators."

The reason is that after swap the iterator can really reference the same element
as before, but it is not possible to invoke operations like ++ or -- on the
iterator because of its inconsistent internal state.

Regards,

Jano


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