bug fix
This commit is contained in:
@@ -193,7 +193,7 @@ namespace TinySTL{
|
|||||||
size_ = n;
|
size_ = n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int nextIndex(int index){ return ++index % N; }
|
int nextIndex(int index){ return (index + 1) % N; }
|
||||||
void copyAllMembers(const circular_buffer& cb){
|
void copyAllMembers(const circular_buffer& cb){
|
||||||
start_ = cb.start_;
|
start_ = cb.start_;
|
||||||
finish_ = cb.finish_;
|
finish_ = cb.finish_;
|
||||||
@@ -277,11 +277,14 @@ namespace TinySTL{
|
|||||||
|
|
||||||
template<class T, size_t N, class Alloc>
|
template<class T, size_t N, class Alloc>
|
||||||
std::ostream& operator <<(std::ostream& os, circular_buffer<T, N, Alloc>& cb){
|
std::ostream& operator <<(std::ostream& os, circular_buffer<T, N, Alloc>& cb){
|
||||||
os << "(";
|
circular_buffer<T, N, Alloc>::size_type size = cb.size();
|
||||||
for (auto it = cb.first(); it != cb.last(); ++it){
|
if (!cb.empty()){
|
||||||
os << *it << ", ";
|
os << "(";
|
||||||
|
for (auto it = cb.first(); it != cb.last() && size != 0; ++it, --size){
|
||||||
|
os << *it << ", ";
|
||||||
|
}
|
||||||
|
os << *(cb.last()) << ")";
|
||||||
}
|
}
|
||||||
os << *(cb.last()) << ")";
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user