Index: mojo/public/cpp/bindings/array.h |
diff --git a/mojo/public/cpp/bindings/array.h b/mojo/public/cpp/bindings/array.h |
index a253da1f3954eed84541177cfee46df4c17a7dfa..973aa08ab4ff7a4c137ac03d884cc6edb68da831 100644 |
--- a/mojo/public/cpp/bindings/array.h |
+++ b/mojo/public/cpp/bindings/array.h |
@@ -133,6 +133,11 @@ class Array { |
// Sets the array to empty (even if previously it was null.) |
void SetToEmpty() { resize(0); } |
+ // Ensures the underlying storage can store up to |size| elements without |
+ // performing reallocations. This works like the reserve method of |
+ // |std::vector|. |
+ void reserve(size_t size) { vec_.reserve(size); } |
+ |
// Returns a const reference to the |std::vector| managed by this class. If |
// the array is null, this will be an empty vector. |
const std::vector<T>& storage() const { return vec_; } |