我喜欢Boost Templated Circular Buffer Container,但是当它被填充 100% 时如何获得?
#include <boost/circular_buffer.hpp>
int main() {
// Create a circular buffer with a capacity for 3 integers.
boost::circular_buffer<int> cb(3);
// Insert some elements into the buffer.
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// Here I want some function to be called (for example one that would cout all buffer contents)
int a = cb[0]; // a == 1
int b = cb[1]; // b == 2
int c = cb[2]; // c == 3
return 0;
}
那么如何监听此类事件,boost::circular_buffer
例如 cout 所有缓冲区内容?