I have a const z* zs = nullptr;
I want to convert zs
to std::span
When I try to do std::span<const z>(zs)
I get an error saying
error: no matching function for call to ‘std::span::span(const z* const&)’
How do I convert to zs to std::span
I tried std::span<const z>(zs[0])
it seems to compile. Is that way correct?
std::span
has a constructor which takes a pointer and a size, use that:
std::span<const z>(zs, 0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With