C++ Logo

std-proposals

Advanced search

[std-proposals] Why some standard functions having a wide contract are not marked as conditionally noexcept?

From: blacktea hamburger <blackteahamburger_at_[hidden]>
Date: Mon, 29 Aug 2022 14:22:12 +0000
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>:

Each library function having a wide contract, that the LWG agree cannot throw, should be marked as unconditionally noexcept.

If a library swap function, move-constructor, or move-assignment operator is conditionally-wide (i.e. can be proven to not throw by applying the noexcept operator) then it should be marked as conditionally noexcept. No other function should use a conditional noexcept specification.

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.

Received on 2022-08-29 14:22:17