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: Bjorn Reese (breese_at_[hidden])
Date: 2019-11-30 09:43:59


On 2019-11-30 11:15, Eyal Rozenberg via Std-Proposals wrote:
> What are the arguments against "at()", other than possibly being redundant?

That it brings in exceptions, which are disable in many real-time and
embedded projects.

For instance P0829 proposes to remove std::array<T>::at() in
freestanding mode.

I reckon that the most viable approach forward is to introduce a free
std::at() function, similar to std::get(). This makes it possible to
have bounds check for types that do not support them, such as C arrays
or std::span.


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

Standard Proposals Archives on Google Groups