Skip to content

Commit

Permalink
Merge pull request triSYCL#334 from keryell/smallarray-conversion-to-…
Browse files Browse the repository at this point in the history
…integral

Allow conversion of 1D small array to any integral type.
Does not allow only for underlying std::size_t.
This allows for example to execute a kernel taking an int as an id instead of a sycl::id<1> or a std::size_t.
  • Loading branch information
keryell authored Sep 25, 2023
2 parents 4c0cefe + 59eb98e commit 180bd52
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/triSYCL/detail/small_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,14 @@ struct small_array_sycl : small_array<BasicType, FinalType, Dims> {
"value or 1 value per dimension");
}

/** Conversion operator to scalar BasicType when only 1 dimension
/** Conversion operator to scalar integral when only 1 dimension
This is used for example to implicitly convert a sycl::id<1> to
a std::size_t
a std::size_t or int
*/
template <auto T = Dims>
template <std::integral To>
requires(Dims == 1)
operator BasicType() {
operator To() {
return this->get(0);
}
};
Expand Down

0 comments on commit 180bd52

Please sign in to comment.