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: Lyberta (lyberta_at_[hidden])
Date: 2019-11-30 14:09:00


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.

> 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 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.




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

Standard Proposals Archives on Google Groups