diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-09-14 17:08:06 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-09-14 17:08:06 +0200 |
commit | 5d342a758c6095b4d30aba0750b54f13b8916f51 (patch) | |
tree | 762e9aa84781f5e3b96db2c02d356c29cf0217c0 /util/array.h | |
parent | cbe2d992e9cd1ea66af9fa91df006106775d3073 (diff) | |
download | mongodb-5d342a758c6095b4d30aba0750b54f13b8916f51.tar.gz |
Imported Upstream version 2.0.0
Diffstat (limited to 'util/array.h')
-rw-r--r-- | util/array.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/util/array.h b/util/array.h index bf705a4..1282225 100644 --- a/util/array.h +++ b/util/array.h @@ -18,6 +18,12 @@ namespace mongo { + /* + * simple array class that does no allocations + * same api as vector + * fixed buffer, so once capacity is exceeded, will assert + * meant to be-reused with clear() + */ template<typename T> class FastArray { public: @@ -44,6 +50,7 @@ namespace mongo { } void push_back( const T& t ) { + assert( _size < _capacity ); _data[_size++] = t; } |