Index: src/vector.h |
diff --git a/src/vector.h b/src/vector.h |
index e4637c91c9804fe5f191976e0ed1a0f9e7a4979c..d120dfc4ac70c36ff9cbc7340546b356f529babd 100644 |
--- a/src/vector.h |
+++ b/src/vector.h |
@@ -24,6 +24,9 @@ class Vector { |
DCHECK(length == 0 || (length > 0 && data != NULL)); |
} |
+ template <int N> |
+ explicit Vector(T (&arr)[N]) : start_(arr), length_(N) {} |
+ |
static Vector<T> New(int length) { |
return Vector<T>(NewArray<T>(length), length); |
} |
@@ -201,6 +204,10 @@ inline Vector<char> MutableCStrVector(char* data, int max) { |
return Vector<char>(data, (length < max) ? length : max); |
} |
+template <typename T, int N> |
+inline Vector<T> ArrayVector(T (&arr)[N]) { |
+ return Vector<T>(arr); |
+} |
} // namespace internal |
} // namespace v8 |