C++ Logo

std-proposals

Advanced search

Re: [span] Value of dynamic_extent

From: Justin Bassett <jbassett271_at_[hidden]>
Date: Tue, 2 Jul 2019 22:46:35 -0700
On Mon, Jul 1, 2019 at 4:21 PM Nevin Liber via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
> - Why any value at all? Last I checked, we now have variadic
> templates, where "now" is defined as since 2011...
>
> template <typename T, std::size_t Extent>
void some_function(std::span<T, Extent> some_span) { ... }

As currently specified, this function accepts any span of any extent,
static or dynamic. Using a variadic template breaks this, and there would
be no easy way to write a function taking both kinds of span. (Many
possible "fixes" break this, not just a variadic span). If both spans have
the same name, it seems right that we should be able to write this single
generic function to handle both cases. Also, static and dynamic extent
spans are very similar, so it makes sense to be able to handle both cases
at the same time.

We could think of them as entirely separate types that you can't constrain
in this way. I'm tempted to argue that that would mean that they should
have different names (which I see that you mentioned):

>
> - Why conflate dynamic-extent span and static-extent span into the
> same templated type?
>
>

At the end of the day, I really agree with Arthur:

On Mon, Jul 1, 2019 at 12:48 PM Arthur O'Dwyer via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> And your proposal's only motivation is the size of the debug symbols? The
> STL has *way* worse problems elsewhere with huge debug symbols, IMHO.
> Unless you've measured this somehow and have numbers showing the proposed
> improvement
>

Received on 2019-07-03 00:48:45