C++26 introduces contracts as a language feature for defining preconditions, postconditions, and invariants for functions with new keywords like contract_assert, pre, and post. These assertions can be enforced, observed, or ignored based on compiler flags. Moreover, user-defined assertion violation handlers can be implemented for customized failure handling.
Table of contents
Asserting before contractsEnter contractsEvaluation of assertsAssertion violation handlerSort: