We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Span
1 parent 78c9f8d commit 55a7de9Copy full SHA for 55a7de9
core/templates/span.h
@@ -59,4 +59,7 @@ class Span {
59
CRASH_COND(p_idx >= _len);
60
return _ptr[p_idx];
61
}
62
+
63
+ _FORCE_INLINE_ constexpr const T *begin() const { return _ptr; }
64
+ _FORCE_INLINE_ constexpr const T *end() const { return _ptr + _len; }
65
};
tests/core/templates/test_span.h
@@ -55,6 +55,11 @@ TEST_CASE("[Span] Constexpr Validators") {
55
static_assert(!span_array.is_empty());
56
static_assert(span_array[0] == U'1');
57
static_assert(span_array[span_array.size() - 1] == U'5');
58
+ int idx = 0;
+ for (const char32_t &chr : span_array) {
+ CHECK_EQ(chr, span_array[idx++]);
+ }
} // namespace TestSpan
0 commit comments