C++ Logo

std-proposals

Advanced search

Re: [std-proposals] noexcept(static)

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 17 Sep 2026 13:28:48 +0100
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();
    }

Received on 2026-09-17 12:28:52