aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/utils/int_array_view.h
diff options
context:
space:
mode:
Diffstat (limited to 'native/jni/src/utils/int_array_view.h')
-rw-r--r--native/jni/src/utils/int_array_view.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/native/jni/src/utils/int_array_view.h b/native/jni/src/utils/int_array_view.h
index c1ddc9812..53f2d2971 100644
--- a/native/jni/src/utils/int_array_view.h
+++ b/native/jni/src/utils/int_array_view.h
@@ -91,6 +91,11 @@ class IntArrayView {
return mPtr + mSize;
}
+ // Returns the view whose size is smaller than or equal to the given count.
+ const IntArrayView limit(const size_t maxSize) const {
+ return IntArrayView(mPtr, std::min(maxSize, mSize));
+ }
+
private:
DISALLOW_ASSIGNMENT_OPERATOR(IntArrayView);