Standard library header <contracts> (C++26)
This header is part of the language support library.
Types |
|
Defined in namespace std::contracts |
|
|---|---|
|
(C++26) | the kind of the contract assertion violated (enum) |
|
(C++26) | the evaluation semantic when the contract violation occurs (enum) |
|
(C++26) | the reason that causes the contract violation (enum) |
|
(C++26) | the type holding the contract-violation information (class) |
Functions |
|
Defined in namespace std::contracts |
|
|
(C++26) | invokes the default contract-violation handler (function) |
Synopsis
// all freestanding
namespace std::contracts {
enum class assertion_kind : /* unspecified */
{
pre = 1,
post = 2,
assert = 3
};
enum class evaluation_semantic : /* unspecified */
{
ignore = 1,
observe = 2,
enforce = 3,
quick_enforce = 4
};
enum class detection_mode : /* unspecified */
{
predicate_false = 1,
evaluation_exception = 2
};
class contract_violation;
void invoke_default_contract_violation_handler(const contract_violation&);
}
Class std::contracts::contract_violation
namespace std::contracts {
class contract_violation
{
// no user-accessible constructor
public:
contract_violation(const contract_violation&) = delete;
contract_violation& operator=(const contract_violation&) = delete;
/* see description */ ~contract_violation();
const char* comment() const noexcept;
contracts::detection_mode detection_mode() const noexcept;
bool is_terminating() const noexcept;
assertion_kind kind() const noexcept;
source_location location() const noexcept;
evaluation_semantic semantic() const noexcept;
};
}
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/header/contracts