Init
This commit is contained in:
67
cppdraft/support/contract/enum.md
Normal file
67
cppdraft/support/contract/enum.md
Normal file
@@ -0,0 +1,67 @@
|
||||
[support.contract.enum]
|
||||
|
||||
# 17 Language support library [[support]](./#support)
|
||||
|
||||
## 17.10 Contract-violation handling [[support.contract]](support.contract#enum)
|
||||
|
||||
### 17.10.2 Enumerations [support.contract.enum]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4438)
|
||||
|
||||
*Recommended practice*: For all enumerations in [support.contract.enum],
|
||||
if implementation-defined enumerators are provided,
|
||||
they should have a minimum value of 1000[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4444)
|
||||
|
||||
The enumerators of assertion_kind correspond to
|
||||
the syntactic forms of a contract assertion ([[basic.contract.general]](basic.contract.general "6.11.1 General")),
|
||||
with meanings listed in Table [44](#tab:support.contract.enum.kind "Table 44: Enum assertion_kind")[.](#2.sentence-1)
|
||||
|
||||
Table [44](#tab:support.contract.enum.kind) — Enum assertion_kind [[tab:support.contract.enum.kind]](./tab:support.contract.enum.kind)
|
||||
|
||||
| [ð](#tab:support.contract.enum.kind-row-1)<br>**Name** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:support.contract.enum.kind-row-2)<br>pre | A precondition assertion |
|
||||
| [ð](#tab:support.contract.enum.kind-row-3)<br>post | A postcondition assertion |
|
||||
| [ð](#tab:support.contract.enum.kind-row-4)<br>assert | An [*assertion-statement*](stmt.contract.assert#nt:assertion-statement "8.9 Assertion statement [stmt.contract.assert]") |
|
||||
| [ð](#tab:support.contract.enum.kind-row-5) |
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4459)
|
||||
|
||||
The enumerators of evaluation_semantic correspond to
|
||||
the evaluation semantics with which
|
||||
a contract assertion may be evaluated ([[basic.contract.eval]](basic.contract.eval "6.11.2 Evaluation")),
|
||||
with meanings listed in Table [45](#tab:support.contract.enum.semantic "Table 45: Enum evaluation_semantic")[.](#3.sentence-1)
|
||||
|
||||
Table [45](#tab:support.contract.enum.semantic) — Enum evaluation_semantic [[tab:support.contract.enum.semantic]](./tab:support.contract.enum.semantic)
|
||||
|
||||
| [ð](#tab:support.contract.enum.semantic-row-1)<br>**Name** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:support.contract.enum.semantic-row-2)<br>ignore | Ignore evaluation semantic |
|
||||
| [ð](#tab:support.contract.enum.semantic-row-3)<br>observe | Observe evaluation semantic |
|
||||
| [ð](#tab:support.contract.enum.semantic-row-4)<br>enforce | Enforce evaluation semantic |
|
||||
| [ð](#tab:support.contract.enum.semantic-row-5)<br>quick_enforce | Quick-enforce evaluation semantic |
|
||||
| [ð](#tab:support.contract.enum.semantic-row-6) |
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4476)
|
||||
|
||||
The enumerators of detection_mode correspond to the manners in which a
|
||||
contract violation can be identified ([[basic.contract.eval]](basic.contract.eval "6.11.2 Evaluation")), with
|
||||
meanings listed in Table [46](#tab:support.contract.enum.detection "Table 46: Enum detection_mode")[.](#4.sentence-1)
|
||||
|
||||
Table [46](#tab:support.contract.enum.detection) — Enum detection_mode [[tab:support.contract.enum.detection]](./tab:support.contract.enum.detection)
|
||||
|
||||
| [ð](#tab:support.contract.enum.detection-row-1)<br>**Name** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:support.contract.enum.detection-row-2)<br>predicate_false | The predicate of the contract assertion evaluated to false or would have evaluated to false[.](#tab:support.contract.enum.detection-row-2-column-2-sentence-1) |
|
||||
| [ð](#tab:support.contract.enum.detection-row-3)<br>evaluation_exception | An uncaught exception occurred during evaluation of the contract assertion[.](#tab:support.contract.enum.detection-row-3-column-2-sentence-1) |
|
||||
| [ð](#tab:support.contract.enum.detection-row-4) |
|
||||
19
cppdraft/support/contract/invoke.md
Normal file
19
cppdraft/support/contract/invoke.md
Normal file
@@ -0,0 +1,19 @@
|
||||
[support.contract.invoke]
|
||||
|
||||
# 17 Language support library [[support]](./#support)
|
||||
|
||||
## 17.10 Contract-violation handling [[support.contract]](support.contract#invoke)
|
||||
|
||||
### 17.10.4 Invoke default handler [support.contract.invoke]
|
||||
|
||||
[ð](#itemdecl:1)
|
||||
|
||||
`void invoke_default_contract_violation_handler(const contract_violation& v);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4638)
|
||||
|
||||
*Effects*: Invokes the default contract-violation handler ([[basic.contract.handler]](basic.contract.handler "6.11.3 Contract-violation handler"))
|
||||
with the argument v[.](#1.sentence-1)
|
||||
152
cppdraft/support/contract/violation.md
Normal file
152
cppdraft/support/contract/violation.md
Normal file
@@ -0,0 +1,152 @@
|
||||
[support.contract.violation]
|
||||
|
||||
# 17 Language support library [[support]](./#support)
|
||||
|
||||
## 17.10 Contract-violation handling [[support.contract]](support.contract#violation)
|
||||
|
||||
### 17.10.3 Class contract_violation [support.contract.violation]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4491)
|
||||
|
||||
The class 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 ([[basic.contract.eval]](basic.contract.eval "6.11.2 Evaluation"))[.](#1.sentence-1)
|
||||
|
||||
Objects of this type can
|
||||
be created only by the implementation[.](#1.sentence-2)
|
||||
|
||||
It isimplementation-defined
|
||||
whether the destructor is virtual[.](#1.sentence-3)
|
||||
|
||||
[ð](#itemdecl:1)
|
||||
|
||||
`const char* comment() const noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4509)
|
||||
|
||||
*Returns*: Animplementation-definedntmbs in
|
||||
the ordinary literal encoding ([[lex.charset]](lex.charset "5.3.1 Character sets"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4516)
|
||||
|
||||
*Recommended practice*: 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[.](#3.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The string can represent a
|
||||
truncated, reformatted, or summarized rendering of the
|
||||
predicate, before or after preprocessing[.](#3.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#itemdecl:2)
|
||||
|
||||
`contracts::detection_mode detection_mode() const noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4536)
|
||||
|
||||
*Returns*: The enumerator value
|
||||
corresponding to
|
||||
the manner in which the contract violation was identified[.](#4.sentence-1)
|
||||
|
||||
[ð](#itemdecl:3)
|
||||
|
||||
`exception_ptr evaluation_exception() const noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4550)
|
||||
|
||||
*Returns*: If the contract violation occurred
|
||||
because the evaluation of the predicate exited via an exception,
|
||||
an exception_ptr object that refers to
|
||||
that exception or a copy of that exception;
|
||||
otherwise, a null exception_ptr object[.](#5.sentence-1)
|
||||
|
||||
[ð](#itemdecl:4)
|
||||
|
||||
`bool is_terminating() const noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4566)
|
||||
|
||||
*Returns*: true if the evaluation semantic is
|
||||
a terminating semantic ([[basic.contract.eval]](basic.contract.eval "6.11.2 Evaluation"));
|
||||
otherwise, false[.](#6.sentence-1)
|
||||
|
||||
[ð](#itemdecl:5)
|
||||
|
||||
`assertion_kind kind() const noexcept;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4579)
|
||||
|
||||
*Returns*: The enumerator value
|
||||
corresponding to
|
||||
the syntactic form of the violated contract assertion[.](#7.sentence-1)
|
||||
|
||||
[ð](#itemdecl:6)
|
||||
|
||||
`source_location location() const noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4592)
|
||||
|
||||
*Returns*: A source_location object
|
||||
withimplementation-defined
|
||||
value[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4599)
|
||||
|
||||
*Recommended practice*: The value returned should be
|
||||
a default constructed source_location object
|
||||
or a value identifying the violated contract assertion:
|
||||
|
||||
- [(9.1)](#9.1)
|
||||
|
||||
When possible,
|
||||
if the violated contract assertion was a precondition,
|
||||
the source location of the function invocation should be returned[.](#9.1.sentence-1)
|
||||
|
||||
- [(9.2)](#9.2)
|
||||
|
||||
Otherwise,
|
||||
the source location of the contract assertion should be returned[.](#9.2.sentence-1)
|
||||
|
||||
[ð](#itemdecl:7)
|
||||
|
||||
`evaluation_semantic semantic() const noexcept;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4622)
|
||||
|
||||
*Returns*: The enumerator value
|
||||
corresponding to
|
||||
the evaluation semantic with which
|
||||
the violated contract assertion was evaluated[.](#10.sentence-1)
|
||||
Reference in New Issue
Block a user