Index: src/smart-pointers.h |
diff --git a/src/smart-pointers.h b/src/smart-pointers.h |
index 345c4d47fb73e8d3e0c10c7f80fc87530876dbb3..a800fc964537d4241ad97d0801183cce7c622a28 100644 |
--- a/src/smart-pointers.h |
+++ b/src/smart-pointers.h |
@@ -63,6 +63,11 @@ class SmartPointerBase { |
return p_[i]; |
} |
+ // You can use [n] to index as if it was a plain pointer |
Jakob Kummerow
2012/11/28 16:28:22
nit: trailing full stop please.
danno
2012/11/30 16:23:24
Done.
|
+ const inline T& operator[](size_t i) const { |
+ return p_[i]; |
+ } |
+ |
// We don't have implicit conversion to a T* since that hinders migration: |
// You would not be able to change a method from returning a T* to |
// returning an SmartArrayPointer<T> and then get errors wherever it is used. |
@@ -77,6 +82,11 @@ class SmartPointerBase { |
return temp; |
} |
+ inline void Reset(T* new_value) { |
+ if (p_) Deallocator::Delete(p_); |
+ p_ = new_value; |
+ } |
+ |
// Assignment requires an empty (NULL) SmartArrayPointer as the receiver. Like |
// the copy constructor it removes the pointer in the original to avoid |
// double freeing. |