diff options
Diffstat (limited to 'compiler/utils/array_ref.h')
-rw-r--r-- | compiler/utils/array_ref.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/utils/array_ref.h b/compiler/utils/array_ref.h index 303e0d5ad4..48f0328dce 100644 --- a/compiler/utils/array_ref.h +++ b/compiler/utils/array_ref.h @@ -161,6 +161,15 @@ class ArrayRef { value_type* data() { return array_; } const value_type* data() const { return array_; } + ArrayRef SubArray(size_type pos) const { + return SubArray(pos, size_ - pos); + } + ArrayRef SubArray(size_type pos, size_type length) const { + DCHECK_LE(pos, size()); + DCHECK_LE(length, size() - pos); + return ArrayRef(array_ + pos, length); + } + private: T* array_; size_t size_; |