C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] function at() for span<> that throws exception on out-of-range, like vector and array ::at()
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2019-11-30 14:49:32


On Sat, 30 Nov 2019 at 22:09, Lyberta via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Ville Voutilainen:
> > I would otherwise have sympathy for that, but WTF Lyberta, I did 2
> > instead of 3.
>
> Yeah, sure. But that takes mental resources that are already scarce.

Granted, I accept your point, pardon my snarkiness. :)

> > that the 2/3 difference
> > scales when you have a range; it's 2, as opposed to N, depending on
> > how many accesses you have.
>
> In my experience array indexes mostly come from sockets or files and
> there is rarely more than one index in a single function. The rest are
> iterators.

I.. don't think it's a matter of how many indexes there are, but a matter
of how many accesses with those indexes are performed.

> > I.. don't see how unsafe_at walked into this discussion. Perhaps
> > that's my mistake, honestly,
> > but I thought this was about adding at() in span because it's already
> > present in vector and array.
> >
>
> I wanted to point out that making std::span API compatible with
> std::vector and std::array is still not ideal. But that would be a
> discussion for something like C++29.

I would like to unrealistically encourage audiences that care about these
things to target their initial work for C++23.


STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups