6 Basics [basic]

6.11 Contract assertions [basic.contract]

6.11.3 Contract-violation handler [basic.contract.handler]

1
#
The contract-violation handler of a program is a function named ​::​handle_contract_violation.
The contract-violation handler shall have a single parameter of type "lvalue reference to const std​::​contracts​::​contract_violation" and shall return void.
The contract-violation handler may have a non-throwing exception specification.
The implementation shall provide a definition of the contract-violation handler, called the default contract-violation handler .
[Note 1 : 
No declaration for the default contract-violation handler is provided by any standard library header.
end note]
2
#
Recommended practice: The default contract-violation handler should produce diagnostic output that suitably formats the most relevant contents of the std​::​contracts​::​contract_violation object, rate-limited for potentially repeated violations of observed contract assertions, and then return normally.
3
#
It is implementation-defined whether the contract-violation handler is replaceable ([dcl.fct.def.replace]).
If the contract-violation handler is not replaceable, a declaration of a replacement function for the contract-violation handler is ill-formed, no diagnostic required.

AltStyle によって変換されたページ (->オリジナル) /