summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorakhropov <[email protected]>2026-06-01 20:02:24 +0300
committerakhropov <[email protected]>2026-06-01 20:36:08 +0300
commit54fe0971bca36ca40446ad614bcc60282228a85d (patch)
tree3b321d31b71828016ac835912c138fb5881c03ee /util
parent2451d837d33cdcb1c9e1ed30ec575119ef0548b2 (diff)
Documentation comments: fix for 'subspan', add for 'Slice'
commit_hash:678331261f55d56d7af4534c58ec675a1465d2cc
Diffstat (limited to 'util')
-rw-r--r--util/generic/array_ref.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/util/generic/array_ref.h b/util/generic/array_ref.h
index 22c207e8606..fd8011b2300 100644
--- a/util/generic/array_ref.h
+++ b/util/generic/array_ref.h
@@ -193,24 +193,39 @@ public:
}
/**
- * Obtains a ref that is a view over the `count` elements of this TArrayRef starting at `offset`.
+ * Obtains a ref that is a view over the elements of this TArrayRef starting at `offset`.
*
- * The behavior is undefined in either offset or count is out of range.
+ * The behavior is undefined if `offset` is greater than the size of this TArrayRef.
*/
TArrayRef subspan(size_t offset) const {
Y_ASSERT(offset <= size());
return TArrayRef(data() + offset, size() - offset);
}
+ /**
+ * Obtains a ref that is a view over the `count` elements of this TArrayRef starting at `offset`.
+ *
+ * The behavior is undefined if `offset` + `count` is greater than the size of this TArrayRef.
+ */
TArrayRef subspan(size_t offset, size_t count) const {
Y_ASSERT(offset + count <= size());
return TArrayRef(data() + offset, count);
}
+ /**
+ * Obtains a ref that is a view over the elements of this TArrayRef starting at `offset`.
+ *
+ * The behavior is undefined if `offset` is greater than the size of this TArrayRef.
+ */
TArrayRef Slice(size_t offset) const {
return subspan(offset);
}
+ /**
+ * Obtains a ref that is a view over the `size` elements of this TArrayRef starting at `offset`.
+ *
+ * The behavior is undefined if `offset` + `size` is greater than the size of this TArrayRef.
+ */
TArrayRef Slice(size_t offset, size_t size) const {
return subspan(offset, size);
}