C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Opt-In Compile Time Bounds Checking

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Tue, 3 Oct 2023 12:51:02 -0600
On Tue, Oct 3, 2023, 12:30 Bjorn Reese via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 10/3/23 08:21, Julien Jorge via Std-Proposals wrote:
> > Regarding the description of nspan, you wrote:
> >
> > > We don't use span because present day code uses it differently. For
> > example you can not pass span into a function with the same type but
> > smaller length.
> >
> > It seems to me that this restriction can be lifted by changing the
> > constraint of 24.7.2.2.2 ยง19.2 from
> >
> > extent == dynamic_extent
> > || OtherExtent == dynamic_extent
> > || extent == OtherExtent
> >
> > to
> >
> > extent == dynamic_extent
> > || OtherExtent == dynamic_extent
> > || extent <= OtherExtent
>
> In what way is span::first() or span::subspan() insufficient?
>

a) friction, b) coupling - it makes changing the span size an API break,
unless you expose it as a separate constant.

>

Received on 2023-10-03 18:51:13