C++ Logo

std-proposals

Advanced search

Re: [std-proposals] noexcept(static)

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Thu, 17 Sep 2026 14:27:28 +0200
For a certain class of conditions this is done by the contracts pre() precondition specifier.   Better improve the contracts checking modes to do, what is needed, than invent another way to specify a precondition IMHO.   E.g. precondition specifies the checkable precondition. Hardened mode: Tested at runtime, throws exception or terminates program (selectable). Unhardened mode: No test at runtime / UB.   Some facility to check a precondition separately from the function call.   -----Ursprüngliche Nachricht----- Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Do 17.09.2026 14:29 Betreff:Re: [std-proposals] noexcept(static) An:std-proposals_at_[hidden]; CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>; On Thursday, September 17, 2026, Sebastian Wittmeier wrote: Then write a wrapper that is noexcept. Then the program terminates in those cases or just declare the caller as noexcept.   Or maybe add a new operator called 'contract_check' which you use like this:      bool is_okay = contract_check( v[i] );  This operator returns a bool to say whether its argument satisfies all contractual requirements. Then you'd add a method to your class:      [[contract_check]] bool vector::operator[](size_t const n)     {          return n < this->size();     }      -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-09-17 12:34:21