bug fix
This commit is contained in:
@@ -117,8 +117,6 @@ namespace TinySTL{
|
|||||||
|
|
||||||
typedef Alloc dataAllocator;
|
typedef Alloc dataAllocator;
|
||||||
public:
|
public:
|
||||||
circular_buffer() :
|
|
||||||
start_(0), finish_(0), indexOfHead(0), indexOfTail(0), size_(0){}
|
|
||||||
explicit circular_buffer(const int& n, const value_type& val = value_type());
|
explicit circular_buffer(const int& n, const value_type& val = value_type());
|
||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
circular_buffer(InputIterator first, InputIterator last);
|
circular_buffer(InputIterator first, InputIterator last);
|
||||||
@@ -148,8 +146,8 @@ namespace TinySTL{
|
|||||||
reference operator [](size_type i){ return *(start_ + i); }
|
reference operator [](size_type i){ return *(start_ + i); }
|
||||||
reference front(){ return *(start_ + indexOfHead); }
|
reference front(){ return *(start_ + indexOfHead); }
|
||||||
reference back(){ return *(start_ + indexOfTail); }
|
reference back(){ return *(start_ + indexOfTail); }
|
||||||
void push(const T& val);
|
void push_back(const T& val);
|
||||||
void pop();
|
void pop_front();
|
||||||
|
|
||||||
bool operator == (circular_buffer& cb){
|
bool operator == (circular_buffer& cb){
|
||||||
auto it1 = first(), it2 = cb.first();
|
auto it1 = first(), it2 = cb.first();
|
||||||
@@ -257,7 +255,7 @@ namespace TinySTL{
|
|||||||
}
|
}
|
||||||
//************<2A><><EFBFBD>룬ɾ<EBA3AC><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>***********************
|
//************<2A><><EFBFBD>룬ɾ<EBA3AC><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>***********************
|
||||||
template<class T, size_t N, class Alloc>
|
template<class T, size_t N, class Alloc>
|
||||||
void circular_buffer<T, N, Alloc>::push(const T& val){
|
void circular_buffer<T, N, Alloc>::push_back(const T& val){
|
||||||
if (full()){
|
if (full()){
|
||||||
indexOfTail = nextIndex(indexOfTail);
|
indexOfTail = nextIndex(indexOfTail);
|
||||||
dataAllocator::construct(start_ + indexOfTail, val);
|
dataAllocator::construct(start_ + indexOfTail, val);
|
||||||
@@ -269,7 +267,7 @@ namespace TinySTL{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
template<class T, size_t N, class Alloc>
|
template<class T, size_t N, class Alloc>
|
||||||
void circular_buffer<T, N, Alloc>::pop(){
|
void circular_buffer<T, N, Alloc>::pop_front(){
|
||||||
if (empty())
|
if (empty())
|
||||||
throw;
|
throw;
|
||||||
dataAllocator::destroy(start_ + indexOfHead);
|
dataAllocator::destroy(start_ + indexOfHead);
|
||||||
|
|||||||
Reference in New Issue
Block a user