diff options
Diffstat (limited to 'test/SemaTemplate/example-dynarray.cpp')
-rw-r--r-- | test/SemaTemplate/example-dynarray.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/SemaTemplate/example-dynarray.cpp b/test/SemaTemplate/example-dynarray.cpp index 990c799ee1..1fe85d920c 100644 --- a/test/SemaTemplate/example-dynarray.cpp +++ b/test/SemaTemplate/example-dynarray.cpp @@ -77,16 +77,14 @@ class dynarray { return Start[Idx]; } - // FIXME: use these for begin/end when we can instantiate - // TypedefType nodes. typedef T* iterator; typedef const T* const_iterator; - T* begin() { return Start; } - const T* begin() const { return Start; } + iterator begin() { return Start; } + const_iterator begin() const { return Start; } - T* end() { return Last; } - const T* end() const { return Last; } + iterator end() { return Last; } + const_iterator end() const { return Last; } public: T* Start, *Last, *End; @@ -115,6 +113,9 @@ int main() { for (dynarray<int>::iterator I = di.begin(), IEnd = di.end(); I != IEnd; ++I) assert(*I == I - di.begin()); + for (int I = 0, N = di.size(); I != N; ++I) + assert(di[I] == I); + di.pop_back(); assert(di.size() == 4); di.push_back(4); |