From 5d342a758c6095b4d30aba0750b54f13b8916f51 Mon Sep 17 00:00:00 2001 From: Antonin Kral Date: Wed, 14 Sep 2011 17:08:06 +0200 Subject: Imported Upstream version 2.0.0 --- util/array.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'util/array.h') 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 class FastArray { public: @@ -44,6 +50,7 @@ namespace mongo { } void push_back( const T& t ) { + assert( _size < _capacity ); _data[_size++] = t; } -- cgit v1.2.3