Index: src/list-inl.h |
=================================================================== |
--- src/list-inl.h (revision 1407) |
+++ src/list-inl.h (working copy) |
@@ -59,6 +59,18 @@ |
template<typename T, class P> |
+T& List<T, P>::Insert(int i, const T& element) { |
+ int free_index = length_ - 1; |
+ Add(last()); // Add grows the list if necessary. |
+ while (free_index > i) { |
+ data_[free_index] = data_[free_index - 1]; |
+ free_index--; |
+ } |
+ data_[free_index] = element; |
+} |
+ |
+ |
+template<typename T, class P> |
T List<T, P>::Remove(int i) { |
T element = at(i); |
length_--; |