tmp/tmpkdpll2c5/{from.md → to.md}
RENAMED
|
@@ -2,26 +2,27 @@
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
class exception {
|
| 6 |
public:
|
| 7 |
-
exception() noexcept;
|
| 8 |
-
exception(const exception&) noexcept;
|
| 9 |
-
exception& operator=(const exception&) noexcept;
|
| 10 |
-
virtual ~exception();
|
| 11 |
-
virtual const char* what() const noexcept;
|
| 12 |
};
|
| 13 |
}
|
| 14 |
```
|
| 15 |
|
| 16 |
The class `exception` defines the base class for the types of objects
|
| 17 |
thrown as exceptions by C++ standard library components, and certain
|
| 18 |
expressions, to report errors detected during program execution.
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
a non-throwing
|
|
|
|
| 23 |
|
| 24 |
- default constructor (unless the class synopsis shows other
|
| 25 |
constructors)
|
| 26 |
- copy constructor
|
| 27 |
- copy assignment operator
|
|
@@ -31,28 +32,29 @@ postcondition: If two objects `lhs` and `rhs` both have dynamic type `T`
|
|
| 31 |
and `lhs` is a copy of `rhs`, then `strcmp(lhs.what(), rhs.what())` is
|
| 32 |
equal to `0`. The `what()` member function of each such `T` satisfies
|
| 33 |
the constraints specified for `exception::what()` (see below).
|
| 34 |
|
| 35 |
``` cpp
|
| 36 |
-
exception(const exception& rhs) noexcept;
|
| 37 |
-
exception& operator=(const exception& rhs) noexcept;
|
| 38 |
```
|
| 39 |
|
| 40 |
*Ensures:* If `*this` and `rhs` both have dynamic type `exception` then
|
| 41 |
the value of the expression `strcmp(what(), rhs.what())` shall equal 0.
|
| 42 |
|
| 43 |
``` cpp
|
| 44 |
-
virtual ~exception();
|
| 45 |
```
|
| 46 |
|
| 47 |
*Effects:* Destroys an object of class `exception`.
|
| 48 |
|
| 49 |
``` cpp
|
| 50 |
-
virtual const char* what() const noexcept;
|
| 51 |
```
|
| 52 |
|
| 53 |
-
*Returns:* An *implementation-defined* NTBS
|
|
|
|
| 54 |
|
| 55 |
*Remarks:* The message may be a null-terminated multibyte
|
| 56 |
string [[multibyte.strings]], suitable for conversion and display as a
|
| 57 |
`wstring` [[string.classes]], [[locale.codecvt]]. The return value
|
| 58 |
remains valid until the exception object from which it is obtained is
|
|
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
class exception {
|
| 6 |
public:
|
| 7 |
+
constexpr exception() noexcept;
|
| 8 |
+
constexpr exception(const exception&) noexcept;
|
| 9 |
+
constexpr exception& operator=(const exception&) noexcept;
|
| 10 |
+
constexpr virtual ~exception();
|
| 11 |
+
constexpr virtual const char* what() const noexcept;
|
| 12 |
};
|
| 13 |
}
|
| 14 |
```
|
| 15 |
|
| 16 |
The class `exception` defines the base class for the types of objects
|
| 17 |
thrown as exceptions by C++ standard library components, and certain
|
| 18 |
expressions, to report errors detected during program execution.
|
| 19 |
|
| 20 |
+
Except where explicitly specified otherwise, each standard library class
|
| 21 |
+
`T` that derives from class `exception` has the following publicly
|
| 22 |
+
accessible member functions, each of them having a non-throwing
|
| 23 |
+
exception specification [[except.spec]]:
|
| 24 |
|
| 25 |
- default constructor (unless the class synopsis shows other
|
| 26 |
constructors)
|
| 27 |
- copy constructor
|
| 28 |
- copy assignment operator
|
|
|
|
| 32 |
and `lhs` is a copy of `rhs`, then `strcmp(lhs.what(), rhs.what())` is
|
| 33 |
equal to `0`. The `what()` member function of each such `T` satisfies
|
| 34 |
the constraints specified for `exception::what()` (see below).
|
| 35 |
|
| 36 |
``` cpp
|
| 37 |
+
constexpr exception(const exception& rhs) noexcept;
|
| 38 |
+
constexpr exception& operator=(const exception& rhs) noexcept;
|
| 39 |
```
|
| 40 |
|
| 41 |
*Ensures:* If `*this` and `rhs` both have dynamic type `exception` then
|
| 42 |
the value of the expression `strcmp(what(), rhs.what())` shall equal 0.
|
| 43 |
|
| 44 |
``` cpp
|
| 45 |
+
constexpr virtual ~exception();
|
| 46 |
```
|
| 47 |
|
| 48 |
*Effects:* Destroys an object of class `exception`.
|
| 49 |
|
| 50 |
``` cpp
|
| 51 |
+
constexpr virtual const char* what() const noexcept;
|
| 52 |
```
|
| 53 |
|
| 54 |
+
*Returns:* An *implementation-defined* NTBS, which during constant
|
| 55 |
+
evaluation is encoded with the ordinary literal encoding [[lex.ccon]].
|
| 56 |
|
| 57 |
*Remarks:* The message may be a null-terminated multibyte
|
| 58 |
string [[multibyte.strings]], suitable for conversion and display as a
|
| 59 |
`wstring` [[string.classes]], [[locale.codecvt]]. The return value
|
| 60 |
remains valid until the exception object from which it is obtained is
|