summaryrefslogtreecommitdiff
path: root/compiler/utils/growable_array.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2014-04-29 15:11:54 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2014-04-29 15:11:55 +0000
commitbecc37249b652ae9fecb6a23ced708cdacb7effd (patch)
treeebea9259f134f9b50c9b6f96ceb74e63f2b875ca /compiler/utils/growable_array.h
parent5108b6774ad12f4b74a7e2e2a1c6e8fc58db073e (diff)
parent1ceea7eb080a309fc2811db604bceed9e638bc5e (diff)
Merge "ART: Initialization of RegLocation and API for GrowableArray Iterator"
Diffstat (limited to 'compiler/utils/growable_array.h')
-rw-r--r--compiler/utils/growable_array.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/utils/growable_array.h b/compiler/utils/growable_array.h
index b33a62e67f..993492da6d 100644
--- a/compiler/utils/growable_array.h
+++ b/compiler/utils/growable_array.h
@@ -49,9 +49,14 @@ class GrowableArray {
: idx_(0),
g_list_(g_list) {}
+ explicit Iterator()
+ : idx_(0),
+ g_list_(nullptr) {}
+
// NOTE: returns 0/NULL when no next.
// TODO: redo to make usage consistent with other iterators.
T Next() {
+ DCHECK(g_list_ != nullptr);
if (idx_ >= g_list_->Size()) {
return 0;
} else {
@@ -63,6 +68,15 @@ class GrowableArray {
idx_ = 0;
}
+ void Reset(GrowableArray* g_list) {
+ idx_ = 0;
+ g_list_ = g_list;
+ }
+
+ size_t GetIndex() const {
+ return idx_;
+ }
+
private:
size_t idx_;
GrowableArray* const g_list_;