Skip to content

Commit 2ed8a14

Browse files
[SYCL] variadic_iterator noexcept (#19706)
variadic_iterator was recently introduced and is used by several routines that are marked as noexcept, some being API. Changing its operator++ to be noexcept to prevent issues and put Coverity's mind at ease --------- Signed-off-by: Chris Perkins <[email protected]>
1 parent 8000760 commit 2ed8a14

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

sycl/source/detail/helpers.hpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,18 @@ template <typename SyclTy, typename... Iterators> class variadic_iterator {
5959
template <typename IterTy>
6060
variadic_iterator(IterTy &&It) : It(std::forward<IterTy>(It)) {}
6161

62-
variadic_iterator &operator++() {
63-
It = std::visit(
64-
[](auto &&It) {
65-
++It;
66-
return storage_iter{It};
67-
},
68-
It);
62+
variadic_iterator &operator++() noexcept {
63+
std::visit([](auto &&It) noexcept { ++It; }, It);
6964
return *this;
7065
}
71-
bool operator!=(const variadic_iterator &Other) const {
66+
bool operator!=(const variadic_iterator &Other) const noexcept {
7267
return It != Other.It;
7368
}
74-
bool operator==(const variadic_iterator &Other) const {
69+
bool operator==(const variadic_iterator &Other) const noexcept {
7570
return It == Other.It;
7671
}
7772

78-
decltype(auto) operator*() {
73+
decltype(auto) operator*() noexcept {
7974
return std::visit(
8075
[](auto &&It) -> decltype(auto) {
8176
decltype(auto) Elem = *It;

0 commit comments

Comments
 (0)