C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::at

From: blacktea hamburger <greenteahamburger_at_[hidden]>
Date: Sat, 22 Oct 2022 15:57:13 +0800
Thanks. I think the reason it's fallen out of fashion may be that
implementations can choose to throw an exception though using operator[]
for out-of-bounds access causes UB.

Also, the definition of "out of bounds" is different for different
containers, a problem that std::at cannot solve. So I'll stop pushing it.

On Wednesday, October 19, 2022, Peter Olsson via Std-Proposals <
std-proposals_at_[hidden]> wrote:
>>Basically, classes that provide operator[] provide at
> std::span does not provide at.
>
> It doesn't seem to be an oversight because P1024 proposed it but it was
voted down (0 strongly for, 0 weakly for, 4 neutral, 4 weakly against, 5
strongly against).
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1024r3.pdf
> So to me it seems like at() has perhaps fallen out of fashion, at least
for sequential containers.

Received on 2022-10-22 07:57:15