C++ Logo

std-proposals

Advanced search

Re: function at() for span<> that throws exception on out-of-range, like vector and array ::at()

From: Miguel Ojeda <miguel.ojeda.sandonis_at_[hidden]>
Date: Sat, 30 Nov 2019 17:56:05 +0100
On Sat, Nov 30, 2019 at 5:40 PM John McFarlane via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> It's not.
>
> Sanitizing user input sounds like something that is best served by explicit logic. I certainly don't think that UI is any concern of containers.

Agreed, but it is nevertheless useful to have a member function like
`at()`. Another useful one would have been one that would simply abort
the program.

Cheers,
Miguel

Received on 2019-11-30 10:58:40