
Hi,
Firstly, thanks for the work on a circular buffer. This is very
useful since many of my applications require it. I am having a
problem though...
I am using Boost 1.38.0. When I call push_back(), the iterator math
makes it appear that begin() moves backwards and end() remains
constant. (Based on other STL libraries, I expect that begin() will
remain constant and end() will keep advancing as I call push_back()).
In other words, this assertion fails (but I expect it to succeed):
circular_buffer<int> buf(8);
circular_buffer<int>::iterator a;
circular_buffer<int>::iterator b;
a = buf.begin();
buf.push_back(1);
b = buf.begin();
assert(a == b); // Fails!!
Also, this code fails too (but I expect it to succeed):
circular_buffer<int> buf(8);
circular_buffer<int>::iterator a;
circular_buffer<int>::iterator b;
a = buf.end();
buf.push_back(1);
b = buf.end();
assert(a != b); // Also fails!
Below is a full example that you can compile and try out:
#include