Still working on my circular_buffer iterator invalidation problems, and
another issue arose. As I mentioned before my class is roughly
class MyContainer {
private:
circular_buffer<T> my_buffer;
vector my_range_ends;
// omitted
}
I'm trying to add a swap method, and the obvious approach does not work:
void MyContainter::swap(MyContainer & other) {
using std::swap;
swap(my_buffer, other.my_buffer);
swap(my_range_ends, other.my_range_ends);
}
This is unsurprising, because of the iterator invalidation rules. So
I'll need to manually figure out the distances and create temporary
vectors to hold my_range_ends. But this just seems like too much
trouble if I'm not in debug mode. If the BOOST_CB_ENABLE_DEBUG macro
hadn't been undefined by circular_buffer.hpp I could wrap my hand-coded
iterator swapping in #if...#endif, and otherwise just use std::swap.
I think this is a valid use case for leaving that macro defined. Any
reasons I should not file a ticket requesting the change?
--
Anthony Foglia
Princeton Consultants
(609) 987-8787 x233