std::contracts::contract_violation
<contracts>
The class std::contracts::contract_violation
defines the type of objects used to represent a contract violation that has been detected during the evaluation of a contract assertion with a particular evaluation semantic.
Objects of this type can only be created by the implementation when the contract-violation handler needs to be invoked. Users cannot create such objects directly.
Contents
- 1 Member functions
- 2 std::contracts::contract_violation::contract_violation
- 3 std::contracts::contract_violation::operator=
- 4 std::contracts::contract_violation::~contract_violation
- 5 std::contracts::contract_violation::kind
- 6 std::contracts::contract_violation::semantic
- 7 std::contracts::contract_violation::is_terminating
- 8 std::contracts::contract_violation::detection_mode
- 9 std::contracts::contract_violation::evaluation_exception
- 10 std::contracts::contract_violation::comment
- 11 std::contracts::contract_violation::location
[edit] Member functions
contract_violation
objects cannot be constructed by users (public member function)
contract_violation
objects cannot be assigned (public member function)
contract_violation
object (public member function)
General contract-violation information
(public member function)
(public member function)
(public member function)
(public member function)
(public member function)
Miscellaneous contract-violation information
(public member function)
(public member function)
std::contracts::contract_violation::contract_violation
The copy destructor is defined as deleted. std::contracts::contract_violation
is not CopyConstructible.
Notes
Other constructors are for internal usage only, they are not user-accessible.
std::contracts::contract_violation::operator=
The copy assignment operator is defined as deleted. std::contracts::contract_violation
is not CopyAssignable.
std::contracts::contract_violation::~contract_violation
Destructs the contract_violation
object.
Notes
It is implementation-defined whether the destructor is virtual.
std::contracts::contract_violation::kind
Return value
Returns the enumerator value corresponding to the syntactic form of the violated contract assertion.
std::contracts::contract_violation::semantic
Return value
Returns the enumerator value corresponding to the evaluation semantic with which the violated contract assertion was evaluated.
std::contracts::contract_violation::is_terminating
Return value
If the evaluation semantic is a terminating semantic, returns true. Otherwise returns false.
std::contracts::contract_violation::detection_mode
Return value
Returns the enumerator value corresponding to the reasons that cause the contract violation.
std::contracts::contract_violation::evaluation_exception
Return value
If the contract violation occurred because the evaluation of the predicate exited via an exception, returns an std::exception_ptr object that refers to that exception or a copy of that exception. Otherwise, returns a null std::exception_ptr object.
std::contracts::contract_violation::comment
Return value
Returns an implementation-defined null-terminated multibyte string in the ordinary literal encoding.
Notes
The C++ standard recommends that the string returned should contain a textual representation of the predicate of the violated contract assertion or an empty string if storing a textual representation is undesired.
std::contracts::contract_violation::location
Return value
Returns a std::source_location object with implementation-defined value.
Notes
The C++ standard recommends that the value returned should be a default constructed std::source_location object or a value identifying the violated contract assertion:
- When possible, if the violated contract assertion was a precondition assertion, the source location of the function invocation should be returned.
- Otherwise, the source location of the contract assertion should be returned.