Skip to content

Commit fe6e307

Browse files
authored
[SYCL] Make range::size() exception-free (#15042)
There is no need to use the detail::array::get() with bounds checking as it is guaranteed that we don't go out-of-bounds in this case, so just use underlying storage directly to calculate the size. This is also necessary because accessor::size() and buffer::size() methods are noexcept by spec and their implementation use range::size();
1 parent cad9a1b commit fe6e307

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sycl/include/sycl/range.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ template <int Dimensions = 1> class range : public detail::array<Dimensions> {
5656
size_t size() const {
5757
size_t size = 1;
5858
for (int i = 0; i < Dimensions; ++i) {
59-
size *= this->get(i);
59+
size *= this->common_array[i];
6060
}
6161
return size;
6262
}

0 commit comments

Comments
 (0)