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:15:00


Nevin Liber via Std-Proposals:
> Should all functions which have preconditions on calling them be named
> unsafe_***? I would not want to call unsafe_dereference(ptr) instead of
> *ptr each and every time I needed to dereference it (for example). I'm
> generally against verbosity for common cases.

Sure, a better solution would be Rust unsafe blocks. So you would write
dereference like this:

unsafe
{
        auto value = *ptr;
}

But that requires going through entire language to split it into safe
and unsafe parts.




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

Standard Proposals Archives on Google Groups