How can I use gsl::span and indicate ownership?
<p>I want to write a function which:</p>
<ol>
<li>Takes a pointer as a parameter</li>
<li>Takes a length as a parameter</li>
<li>Owns the memory pointed to by the pointer (e.g. maybe it releases it, or constructs a unique_ptr to it in some data structure etc.)</li>
</ol>
<p>Now, if I wanted 1+2 I would just use <code>gsl::span</code>. And if wanted 1+3 I would use <code>owner&lt;T*&gt;</code>. But what should I do when I want all three? Should I pass an <code>owner&lt;gsl::span&lt;T&gt;&gt;</code>? Something else?</p>
<p>Notes:</p>
<ul>
<li>You may not assume the pointer is into the heap.</li>
<li><code>std::vector</code> is requiring too much. The function should not require the caller to construct an <code>std::vector</code>.</li>
</ul>