Index: src/utils.h |
diff --git a/src/utils.h b/src/utils.h |
index d605891e6debb5b9e6c8c68b599a5d98987e8296..fefbfe9af6e36bd0ff56fd1e6cef3a62951b08f6 100644 |
--- a/src/utils.h |
+++ b/src/utils.h |
@@ -391,6 +391,12 @@ class Vector { |
// Factory method for creating empty vectors. |
static Vector<T> empty() { return Vector<T>(NULL, 0); } |
+ template<typename S> |
+ static Vector<T> cast(Vector<S> input) { |
+ return Vector<T>(reinterpret_cast<T*>(input.start()), |
+ input.length() * sizeof(S) / sizeof(T)); |
+ } |
+ |
protected: |
void set_start(T* start) { start_ = start; } |