Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: src/utils.h

Issue 8732: Character classes (Closed)
Patch Set: Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/utils.h
diff --git a/src/utils.h b/src/utils.h
index 9f2407973d728e8495ea69a915d3a838e8442603..73585932d7bf1df50c9aa214de8a4067517461f5 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -283,6 +283,15 @@ class Vector {
return Vector<T>(NewArray<T>(length), length);
}
+ // Returns a vector using the same backing storage as this one,
+ // spanning from and including 'from', to but not including 'to'.
+ Vector<T> SubVector(int from, int to) {
+ ASSERT(from < length_);
+ ASSERT(to <= length_);
+ ASSERT(from < to);
+ return Vector<T>(start() + from, to - from);
+ }
+
// Returns the length of the vector.
int length() const { return length_; }
@@ -298,6 +307,10 @@ class Vector {
return start_[index];
}
+ T& first() { return start_[0]; }
+
+ T& last() { return start_[length_ - 1]; }
+
// Returns a clone of this vector with a new backing store.
Vector<T> Clone() const {
T* result = NewArray<T>(length_);
« src/jsregexp.cc ('K') | « src/jsregexp-inl.h ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698