std::span / gsl::span are very useful in host-side code: A pointer+length pair with standard-library-container trappings (iterators, operators, usable in standard algorithms etc.)
Now, it's not as though you should just use spans willy-nilly; they can have some overhead, but - they can sometimes make sense. The may be particularly useful as kernel parameters - pay the overhead just once per thread, then in the kernel you do what you like. And it makes it easier to work with memory regions - device-side and host-side.
See also issue #17.
We can base ourselves on either an GSL or a standard-library implementation.
But:
We need it to work on the device side
We need to detach it from the rest of the library (unless we want to import the entire GSL, which we probably don't):
2.1 Drop Expects, Requires -> No (?) need for <gsl/gsl_assert>
2.2 Roll our own byte or use unsigned char -> No(?) need for <gsl/gsl_byte> // for byte
2.3 narrowing cast, other stuff ??? in <gsl/gsl_util>
We can assume at least C++11 (perhaps 14?)
.... edit: Going with std::span adapted for earlier C++ versions. Hope it's not too bad. Still not sure if I shouldn't just use gsl::span instead.
std::span
/gsl::span
are very useful in host-side code: A pointer+length pair with standard-library-container trappings (iterators, operators, usable in standard algorithms etc.)Now, it's not as though you should just use spans willy-nilly; they can have some overhead, but - they can sometimes make sense. The may be particularly useful as kernel parameters - pay the overhead just once per thread, then in the kernel you do what you like. And it makes it easier to work with memory regions - device-side and host-side.
See also issue #17.
We can base ourselves on either an GSL or a standard-library implementation. But:
Expects
,Requires
-> No (?) need for<gsl/gsl_assert>
2.2 Roll our own byte or use unsigned char -> No(?) need for<gsl/gsl_byte>
// for byte 2.3 narrowing cast, other stuff ??? in<gsl/gsl_util>
.... edit: Going with std::span adapted for earlier C++ versions. Hope it's not too bad. Still not sure if I shouldn't just use gsl::span instead.