Date: Sun, 11 Sep 2022 22:28:01 +0800
I also wonder why they hate to use conditional noexcept, what's so bad
about it?
On Tue, Aug 30, 2022 at 1:26 PM blacktea hamburger
<IMCEAEX-_O=FIRST+20ORGANIZATION_OU=EXCHANGE+20ADMINISTRATIVE+20GROUP+28FYDIBOHF>
wrote:
> Well...but nothing in the paper says that functions having a narrow
> contract can be marked as conditional noexcept.
>
> And std::begin is similar to std::cbegin, it simply delegates to
> c.begin(), which is allowed to throw, but std::begin is not marked as
> conditional noexcept. Similar examples are std::end, std::size, etc.
>
> On Mon, Aug 29, 2022 at 10:22 AM blacktea hamburger via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
> I have noticed that some standard functions having a wide contract such
> as functions in [iterator.range] <https://eel.is/c++draft/iterator.range>
> conditionally do not throw exceptions, but they are not marked as
> conditionally noexcept.
>
>
> It is described in N3279 <https://wg21.link/N3279>: [2011]
>
> Note that there's also a later paper by Nico Josuttis [2018]:
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0884r0.pdf
> I don't think any differences are relevant to your question, but just FYI.
>
>
> But there are some functions that do not obey this guideline such as
> std::cbegin. And I did not find a reason in this paper.
>
> Can you clarify what you mean? Looking at cppreference,
> https://en.cppreference.com/w/cpp/iterator/begin
> I see that
> (1) std::cbegin in fact has a *narrow* contract; it simply delegates to
> std::begin(x), which is allowed to throw.
> (2) std::cbegin *is* marked conditionally noexcept.
>
> So, I'm not sure what you're asking.
>
> –Arthur
>
>
about it?
On Tue, Aug 30, 2022 at 1:26 PM blacktea hamburger
<IMCEAEX-_O=FIRST+20ORGANIZATION_OU=EXCHANGE+20ADMINISTRATIVE+20GROUP+28FYDIBOHF>
wrote:
> Well...but nothing in the paper says that functions having a narrow
> contract can be marked as conditional noexcept.
>
> And std::begin is similar to std::cbegin, it simply delegates to
> c.begin(), which is allowed to throw, but std::begin is not marked as
> conditional noexcept. Similar examples are std::end, std::size, etc.
>
> On Mon, Aug 29, 2022 at 10:22 AM blacktea hamburger via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
> I have noticed that some standard functions having a wide contract such
> as functions in [iterator.range] <https://eel.is/c++draft/iterator.range>
> conditionally do not throw exceptions, but they are not marked as
> conditionally noexcept.
>
>
> It is described in N3279 <https://wg21.link/N3279>: [2011]
>
> Note that there's also a later paper by Nico Josuttis [2018]:
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0884r0.pdf
> I don't think any differences are relevant to your question, but just FYI.
>
>
> But there are some functions that do not obey this guideline such as
> std::cbegin. And I did not find a reason in this paper.
>
> Can you clarify what you mean? Looking at cppreference,
> https://en.cppreference.com/w/cpp/iterator/begin
> I see that
> (1) std::cbegin in fact has a *narrow* contract; it simply delegates to
> std::begin(x), which is allowed to throw.
> (2) std::cbegin *is* marked conditionally noexcept.
>
> So, I'm not sure what you're asking.
>
> –Arthur
>
>
Received on 2022-09-11 14:28:28