Commit ae299a76 authored by Davis King's avatar Davis King

Gave circular_buffer a constructor that takes the size.

parent a7363d41
...@@ -26,7 +26,11 @@ namespace dlib ...@@ -26,7 +26,11 @@ namespace dlib
circular_buffer() circular_buffer()
{ {
offset = 0; }
explicit circular_buffer(unsigned long s)
{
resize(s);
} }
void clear ( void clear (
...@@ -149,7 +153,7 @@ namespace dlib ...@@ -149,7 +153,7 @@ namespace dlib
private: private:
std::vector<T> data; std::vector<T> data;
unsigned long offset; unsigned long offset = 0;
}; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
...@@ -49,6 +49,15 @@ namespace dlib ...@@ -49,6 +49,15 @@ namespace dlib
- this object is properly initialized - this object is properly initialized
!*/ !*/
explicit circular_buffer(
unsigned long s
);
/*!
ensures
- #size() == s
- this object is properly initialized
!*/
void clear ( void clear (
); );
/*! /*!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment