a circlebuffer class in c++