Closed kdkavanagh closed 3 months ago
A few thoughts...
span<T>
explicit was enough, but I guess that's not the case...explicit
? I want to make it easier to hit the deletion, not harder...Move constructors definitely needed + are perfectly appropriate (i.e same as std::unique_ptr
). Without them you pretty much wont be able to store the type in any container class
re: explicit, just a bad copy-paste into github. Definitely not needed
I initially didnt catch that
cuda::memory::host::make_unique_span
andcuda::memory::device::make_unique_span
do not both return the same type due to the different deleter required for the device span. I missed it because of the identically-named but differently-definedusing unique_span = ...
aliases for device/host.My issue arose when I assigned the results of both those calls to an object of type
cuda::unique_span<T>
.Even though copy-constructors are explicitly deleted,
unique_span
has a ctor which accepts astd::span
as a copy:Since a
cuda::memory::device::unique_span
is not technically the same type ascuda::unique_span
, the deleted copy constructor is ignored, and since the unique_span types extendstd::span
, that unique_span(span_type span) constructor is called, ending up with twounique_spans
"owning" the dataA fix for this would probably add an explicit deleted constructor for any
unique_span
type rather than just a deleted ctor for the sameunique_span
type: