This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
[syserr.compare]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#compare)
### 19.5.6 Comparison operator functions [syserr.compare]
[🔗](#lib:operator==,error_code)
`bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1438)
*Returns*: lhs.category() == rhs.category() && lhs.value() == rhs.value()
[🔗](#lib:operator==,error_condition)
`bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1452)
*Returns*: lhs.category().equivalent(lhs.value(), rhs) || rhs.category().equivalent(lhs, rhs.value())
[🔗](#lib:operator==,error_condition_)
`bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1465)
*Returns*: lhs.category() == rhs.category() && lhs.value() == rhs.value()
[🔗](#lib:operator%3c=%3e,error_code)
`strong_ordering operator<=>(const error_code& lhs, const error_code& rhs) noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1478)
*Effects*: Equivalent to:if (auto c = lhs.category() <=> rhs.category(); c != 0) return c;return lhs.value() <=> rhs.value();
[🔗](#lib:operator%3c=%3e,error_condition)
`strong_ordering operator<=>(const error_condition& lhs, const error_condition& rhs) noexcept;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1493)
*Returns*: if (auto c = lhs.category() <=> rhs.category(); c != 0) return c;return lhs.value() <=> rhs.value();

241
cppdraft/syserr/errcat.md Normal file
View File

@@ -0,0 +1,241 @@
[syserr.errcat]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcat)
### 19.5.3 Class error_category [syserr.errcat]
#### [19.5.3.1](#overview) Overview [[syserr.errcat.overview]](syserr.errcat.overview)
[1](#overview-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L783)
The class error_category serves as a base class for types used
to identify the source and encoding of a particular category of error code[.](#overview-1.sentence-1)
Classes may be derived from error_category to support
categories of errors in addition to those defined in this document[.](#overview-1.sentence-2)
Such classes shall behave as specified in subclause [syserr.errcat][.](#overview-1.sentence-3)
[*Note [1](#overview-note-1)*:
error_category objects are
passed by reference, and two such objects
are equal if they have the same address[.](#overview-1.sentence-4)
If there is more than a single object of a custom error_category type,
such equality comparisons can evaluate to false even for objects holding the same value[.](#overview-1.sentence-5)
— *end note*]
[🔗](#lib:error_category)
namespace std {class error_category {public:constexpr error_category() noexcept; virtual ~error_category();
error_category(const error_category&) = delete;
error_category& operator=(const error_category&) = delete; virtual const char* name() const noexcept = 0; virtual error_condition default_error_condition(int ev) const noexcept; virtual bool equivalent(int code, const error_condition& condition) const noexcept; virtual bool equivalent(const error_code& code, int condition) const noexcept; virtual string message(int ev) const = 0; bool operator==(const error_category& rhs) const noexcept;
strong_ordering operator<=>(const error_category& rhs) const noexcept; }; const error_category& [generic_category](#lib:generic_category "19.5.3.5Error category objects[syserr.errcat.objects]")() noexcept; const error_category& [system_category](#lib:system_category "19.5.3.5Error category objects[syserr.errcat.objects]")() noexcept;}
#### [19.5.3.2](#virtuals) Virtual members [[syserr.errcat.virtuals]](syserr.errcat.virtuals)
[🔗](#lib:name,error_category)
`virtual const char* name() const noexcept = 0;
`
[1](#virtuals-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L832)
*Returns*: A string naming the error category[.](#virtuals-1.sentence-1)
[🔗](#lib:default_error_condition,error_category)
`virtual error_condition default_error_condition(int ev) const noexcept;
`
[2](#virtuals-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L843)
*Returns*: error_condition(ev, *this)[.](#virtuals-2.sentence-1)
[🔗](#lib:equivalent,error_category)
`virtual bool equivalent(int code, const error_condition& condition) const noexcept;
`
[3](#virtuals-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L854)
*Returns*: default_error_condition(code) == condition[.](#virtuals-3.sentence-1)
[🔗](#lib:equivalent,error_category_)
`virtual bool equivalent(const error_code& code, int condition) const noexcept;
`
[4](#virtuals-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L865)
*Returns*: *this == code.category() && code.value() == condition[.](#virtuals-4.sentence-1)
[🔗](#lib:message,error_category)
`virtual string message(int ev) const = 0;
`
[5](#virtuals-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L876)
*Returns*: A string that describes the error condition denoted by ev[.](#virtuals-5.sentence-1)
#### [19.5.3.3](#nonvirtuals) Non-virtual members [[syserr.errcat.nonvirtuals]](syserr.errcat.nonvirtuals)
[🔗](#lib:operator==,error_category)
`bool operator==(const error_category& rhs) const noexcept;
`
[1](#nonvirtuals-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L889)
*Returns*: this == &rhs[.](#nonvirtuals-1.sentence-1)
[🔗](#lib:operator%3c=%3e,error_category)
`strong_ordering operator<=>(const error_category& rhs) const noexcept;
`
[2](#nonvirtuals-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L900)
*Returns*: compare_three_way()(this, &rhs)[.](#nonvirtuals-2.sentence-1)
[*Note [1](#nonvirtuals-note-1)*:
compare_three_way ([[comparisons.three.way]](comparisons.three.way "22.10.8.8Class compare_­three_­way")) provides a total ordering for pointers[.](#nonvirtuals-2.sentence-2)
— *end note*]
#### [19.5.3.4](#derived) Program-defined classes derived from error_category [[syserr.errcat.derived]](syserr.errcat.derived)
[🔗](#lib:name,error_category_)
`virtual const char* name() const noexcept = 0;
`
[1](#derived-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L917)
*Returns*: A string naming the error category[.](#derived-1.sentence-1)
[🔗](#lib:default_error_condition,error_category_)
`virtual error_condition default_error_condition(int ev) const noexcept;
`
[2](#derived-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L928)
*Returns*: An object of type error_condition that corresponds to ev[.](#derived-2.sentence-1)
[🔗](#lib:equivalent,error_category__)
`virtual bool equivalent(int code, const error_condition& condition) const noexcept;
`
[3](#derived-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L939)
*Returns*: true if, for the category of error represented by *this, code is considered equivalent to condition; otherwise, false[.](#derived-3.sentence-1)
[🔗](#lib:equivalent,error_category___)
`virtual bool equivalent(const error_code& code, int condition) const noexcept;
`
[4](#derived-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L950)
*Returns*: true if, for the category of error represented by *this, code is considered equivalent to condition; otherwise, false[.](#derived-4.sentence-1)
#### [19.5.3.5](#objects) Error category objects [[syserr.errcat.objects]](syserr.errcat.objects)
[🔗](#lib:generic_category_)
`const error_category& generic_category() noexcept;
`
[1](#objects-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L963)
*Returns*: A reference to an object of a type derived from class error_category[.](#objects-1.sentence-1)
All calls to this function shall return references to the same object[.](#objects-1.sentence-2)
[2](#objects-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L968)
*Remarks*: The object's default_error_condition and equivalent virtual functions shall behave as specified for the class error_category[.](#objects-2.sentence-1)
The object's name virtual function shall return a pointer to the string "generic"[.](#objects-2.sentence-2)
[🔗](#lib:system_category_)
`const error_category& system_category() noexcept;
`
[3](#objects-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L979)
*Returns*: A reference to an object of a type derived from class error_category[.](#objects-3.sentence-1)
All calls to this function shall return references to the same object[.](#objects-3.sentence-2)
[4](#objects-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L984)
*Remarks*: The object's equivalent virtual functions shall behave as specified for
class error_category[.](#objects-4.sentence-1)
The object's name virtual function shall return a
pointer to the string "system"[.](#objects-4.sentence-2)
The object's default_error_condition virtual function shall behave as follows:
If the argument ev is equal to 0,
the function returns error_condition(0, generic_category())[.](#objects-4.sentence-4)
Otherwise,
if ev corresponds to a POSIX errno value pxv,
the function returns error_condition(pxv, generic_category())[.](#objects-4.sentence-5)
Otherwise, the function returns error_condition(ev, system_category())[.](#objects-4.sentence-6)
What constitutes correspondence for any given operating system is unspecified[.](#objects-4.sentence-7)
[*Note [1](#objects-note-1)*:
The number of potential system error codes is large
and unbounded, and some might not correspond to any POSIX errno value[.](#objects-4.sentence-8)
Thus
implementations are given latitude in determining correspondence[.](#objects-4.sentence-9)
— *end note*]

View File

@@ -0,0 +1,53 @@
[syserr.errcat.derived]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcat.derived)
### 19.5.3 Class error_category [[syserr.errcat]](syserr.errcat#derived)
#### 19.5.3.4 Program-defined classes derived from error_category [syserr.errcat.derived]
[🔗](#lib:name,error_category)
`virtual const char* name() const noexcept = 0;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L917)
*Returns*: A string naming the error category[.](#1.sentence-1)
[🔗](#lib:default_error_condition,error_category)
`virtual error_condition default_error_condition(int ev) const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L928)
*Returns*: An object of type error_condition that corresponds to ev[.](#2.sentence-1)
[🔗](#lib:equivalent,error_category)
`virtual bool equivalent(int code, const error_condition& condition) const noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L939)
*Returns*: true if, for the category of error represented by *this, code is considered equivalent to condition; otherwise, false[.](#3.sentence-1)
[🔗](#lib:equivalent,error_category_)
`virtual bool equivalent(const error_code& code, int condition) const noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L950)
*Returns*: true if, for the category of error represented by *this, code is considered equivalent to condition; otherwise, false[.](#4.sentence-1)

View File

@@ -0,0 +1,37 @@
[syserr.errcat.nonvirtuals]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcat.nonvirtuals)
### 19.5.3 Class error_category [[syserr.errcat]](syserr.errcat#nonvirtuals)
#### 19.5.3.3 Non-virtual members [syserr.errcat.nonvirtuals]
[🔗](#lib:operator==,error_category)
`bool operator==(const error_category& rhs) const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L889)
*Returns*: this == &rhs[.](#1.sentence-1)
[🔗](#lib:operator%3c=%3e,error_category)
`strong_ordering operator<=>(const error_category& rhs) const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L900)
*Returns*: compare_three_way()(this, &rhs)[.](#2.sentence-1)
[*Note [1](#note-1)*:
compare_three_way ([[comparisons.three.way]](comparisons.three.way "22.10.8.8Class compare_­three_­way")) provides a total ordering for pointers[.](#2.sentence-2)
— *end note*]

View File

@@ -0,0 +1,76 @@
[syserr.errcat.objects]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcat.objects)
### 19.5.3 Class error_category [[syserr.errcat]](syserr.errcat#objects)
#### 19.5.3.5 Error category objects [syserr.errcat.objects]
[🔗](#lib:generic_category)
`const error_category& generic_category() noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L963)
*Returns*: A reference to an object of a type derived from class error_category[.](#1.sentence-1)
All calls to this function shall return references to the same object[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L968)
*Remarks*: The object's default_error_condition and equivalent virtual functions shall behave as specified for the class error_category[.](#2.sentence-1)
The object's name virtual function shall return a pointer to the string "generic"[.](#2.sentence-2)
[🔗](#lib:system_category)
`const error_category& system_category() noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L979)
*Returns*: A reference to an object of a type derived from class error_category[.](#3.sentence-1)
All calls to this function shall return references to the same object[.](#3.sentence-2)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L984)
*Remarks*: The object's equivalent virtual functions shall behave as specified for
class error_category[.](#4.sentence-1)
The object's name virtual function shall return a
pointer to the string "system"[.](#4.sentence-2)
The object's default_error_condition virtual function shall behave as follows:
If the argument ev is equal to 0,
the function returns error_condition(0, generic_category())[.](#4.sentence-4)
Otherwise,
if ev corresponds to a POSIX errno value pxv,
the function returns error_condition(pxv, generic_category())[.](#4.sentence-5)
Otherwise, the function returns error_condition(ev, system_category())[.](#4.sentence-6)
What constitutes correspondence for any given operating system is unspecified[.](#4.sentence-7)
[*Note [1](#note-1)*:
The number of potential system error codes is large
and unbounded, and some might not correspond to any POSIX errno value[.](#4.sentence-8)
Thus
implementations are given latitude in determining correspondence[.](#4.sentence-9)
— *end note*]

View File

@@ -0,0 +1,39 @@
[syserr.errcat.overview]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcat.overview)
### 19.5.3 Class error_category [[syserr.errcat]](syserr.errcat#overview)
#### 19.5.3.1 Overview [syserr.errcat.overview]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L783)
The class error_category serves as a base class for types used
to identify the source and encoding of a particular category of error code[.](#1.sentence-1)
Classes may be derived from error_category to support
categories of errors in addition to those defined in this document[.](#1.sentence-2)
Such classes shall behave as specified in subclause [[syserr.errcat]](syserr.errcat "19.5.3Class error_­category")[.](#1.sentence-3)
[*Note [1](#note-1)*:
error_category objects are
passed by reference, and two such objects
are equal if they have the same address[.](#1.sentence-4)
If there is more than a single object of a custom error_category type,
such equality comparisons can evaluate to false even for objects holding the same value[.](#1.sentence-5)
— *end note*]
[🔗](#lib:error_category)
namespace std {class error_category {public:constexpr error_category() noexcept; virtual ~error_category();
error_category(const error_category&) = delete;
error_category& operator=(const error_category&) = delete; virtual const char* name() const noexcept = 0; virtual error_condition default_error_condition(int ev) const noexcept; virtual bool equivalent(int code, const error_condition& condition) const noexcept; virtual bool equivalent(const error_code& code, int condition) const noexcept; virtual string message(int ev) const = 0; bool operator==(const error_category& rhs) const noexcept;
strong_ordering operator<=>(const error_category& rhs) const noexcept; }; const error_category& [generic_category](syserr.errcat.objects#lib:generic_category "19.5.3.5Error category objects[syserr.errcat.objects]")() noexcept; const error_category& [system_category](syserr.errcat.objects#lib:system_category "19.5.3.5Error category objects[syserr.errcat.objects]")() noexcept;}

View File

@@ -0,0 +1,64 @@
[syserr.errcat.virtuals]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcat.virtuals)
### 19.5.3 Class error_category [[syserr.errcat]](syserr.errcat#virtuals)
#### 19.5.3.2 Virtual members [syserr.errcat.virtuals]
[🔗](#lib:name,error_category)
`virtual const char* name() const noexcept = 0;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L832)
*Returns*: A string naming the error category[.](#1.sentence-1)
[🔗](#lib:default_error_condition,error_category)
`virtual error_condition default_error_condition(int ev) const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L843)
*Returns*: error_condition(ev, *this)[.](#2.sentence-1)
[🔗](#lib:equivalent,error_category)
`virtual bool equivalent(int code, const error_condition& condition) const noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L854)
*Returns*: default_error_condition(code) == condition[.](#3.sentence-1)
[🔗](#lib:equivalent,error_category_)
`virtual bool equivalent(const error_code& code, int condition) const noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L865)
*Returns*: *this == code.category() && code.value() == condition[.](#4.sentence-1)
[🔗](#lib:message,error_category)
`virtual string message(int ev) const = 0;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L876)
*Returns*: A string that describes the error condition denoted by ev[.](#5.sentence-1)

205
cppdraft/syserr/errcode.md Normal file
View File

@@ -0,0 +1,205 @@
[syserr.errcode]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcode)
### 19.5.4 Class error_code [syserr.errcode]
#### [19.5.4.1](#overview) Overview [[syserr.errcode.overview]](syserr.errcode.overview)
[1](#overview-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1009)
The class error_code describes an object used to hold error code
values, such as those originating from the operating system or other low-level
application program interfaces[.](#overview-1.sentence-1)
[*Note [1](#overview-note-1)*:
Class error_code is an
adjunct to error reporting by exception[.](#overview-1.sentence-2)
— *end note*]
[🔗](#lib:error_code)
namespace std {class error_code {public:// [[syserr.errcode.constructors]](#constructors "19.5.4.2Constructors"), constructors error_code() noexcept;
error_code(int val, const error_category& cat) noexcept; template<class ErrorCodeEnum> error_code(ErrorCodeEnum e) noexcept; // [[syserr.errcode.modifiers]](#modifiers "19.5.4.3Modifiers"), modifiersvoid assign(int val, const error_category& cat) noexcept; template<class ErrorCodeEnum> error_code& operator=(ErrorCodeEnum e) noexcept; void clear() noexcept; // [[syserr.errcode.observers]](#observers "19.5.4.4Observers"), observersint value() const noexcept; const error_category& category() const noexcept;
error_condition default_error_condition() const noexcept;
string message() const; explicit operator bool() const noexcept; private:int *val_*; // *exposition only*const error_category* *cat_*; // *exposition only*}; // [[syserr.errcode.nonmembers]](#nonmembers "19.5.4.5Non-member functions"), non-member functions error_code make_error_code(errc e) noexcept; template<class charT, class traits> basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const error_code& ec);}
#### [19.5.4.2](#constructors) Constructors [[syserr.errcode.constructors]](syserr.errcode.constructors)
[🔗](#lib:error_code,constructor)
`error_code() noexcept;
`
[1](#constructors-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1064)
*Effects*: Initializes *val_* with 0 and *cat_* with &system_category()[.](#constructors-1.sentence-1)
[🔗](#lib:error_code,constructor_)
`error_code(int val, const error_category& cat) noexcept;
`
[2](#constructors-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1076)
*Effects*: Initializes *val_* with val and *cat_* with &cat[.](#constructors-2.sentence-1)
[🔗](#lib:error_code,constructor__)
`template<class ErrorCodeEnum>
error_code(ErrorCodeEnum e) noexcept;
`
[3](#constructors-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1089)
*Constraints*: [is_error_code_enum_v](system.error.syn#lib:is_error_code_enum_v "19.5.2Header <system_­error> synopsis[system.error.syn]")<ErrorCodeEnum> is true[.](#constructors-3.sentence-1)
[4](#constructors-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1093)
*Effects*: Equivalent to:error_code ec = make_error_code(e);
assign(ec.value(), ec.category());
#### [19.5.4.3](#modifiers) Modifiers [[syserr.errcode.modifiers]](syserr.errcode.modifiers)
[🔗](#lib:assign,error_code)
`void assign(int val, const error_category& cat) noexcept;
`
[1](#modifiers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1110)
*Postconditions*: *val_* == val and *cat_* == &cat[.](#modifiers-1.sentence-1)
[🔗](#lib:operator=,error_code)
`template<class ErrorCodeEnum>
error_code& operator=(ErrorCodeEnum e) noexcept;
`
[2](#modifiers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1122)
*Constraints*: [is_error_code_enum_v](system.error.syn#lib:is_error_code_enum_v "19.5.2Header <system_­error> synopsis[system.error.syn]")<ErrorCodeEnum> is true[.](#modifiers-2.sentence-1)
[3](#modifiers-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1126)
*Effects*: Equivalent to:error_code ec = make_error_code(e);
assign(ec.value(), ec.category());
[4](#modifiers-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1134)
*Returns*: *this[.](#modifiers-4.sentence-1)
[🔗](#lib:clear,error_code)
`void clear() noexcept;
`
[5](#modifiers-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1145)
*Postconditions*: value() == 0 and category() == system_category()[.](#modifiers-5.sentence-1)
#### [19.5.4.4](#observers) Observers [[syserr.errcode.observers]](syserr.errcode.observers)
[🔗](#lib:value,error_code)
`int value() const noexcept;
`
[1](#observers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1159)
*Returns*: *val_*[.](#observers-1.sentence-1)
[🔗](#lib:category,error_code)
`const error_category& category() const noexcept;
`
[2](#observers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1170)
*Returns*: **cat_*[.](#observers-2.sentence-1)
[🔗](#lib:default_error_condition,error_code)
`error_condition default_error_condition() const noexcept;
`
[3](#observers-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1181)
*Returns*: category().default_error_condition(value())[.](#observers-3.sentence-1)
[🔗](#lib:message,error_code)
`string message() const;
`
[4](#observers-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1192)
*Returns*: category().message(value())[.](#observers-4.sentence-1)
[🔗](#lib:operator_bool,error_code)
`explicit operator bool() const noexcept;
`
[5](#observers-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1203)
*Returns*: value() != 0[.](#observers-5.sentence-1)
#### [19.5.4.5](#nonmembers) Non-member functions [[syserr.errcode.nonmembers]](syserr.errcode.nonmembers)
[🔗](#lib:make_error_code,errc)
`error_code make_error_code(errc e) noexcept;
`
[1](#nonmembers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1216)
*Returns*: error_code(static_cast<int>(e), generic_category())[.](#nonmembers-1.sentence-1)
[🔗](#lib:operator%3c%3c,error_code)
`template<class charT, class traits>
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const error_code& ec);
`
[2](#nonmembers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1228)
*Effects*: Equivalent to: return os << ec.category().name() << ':' << ec.value();

View File

@@ -0,0 +1,50 @@
[syserr.errcode.constructors]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcode.constructors)
### 19.5.4 Class error_code [[syserr.errcode]](syserr.errcode#constructors)
#### 19.5.4.2 Constructors [syserr.errcode.constructors]
[🔗](#lib:error_code,constructor)
`error_code() noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1064)
*Effects*: Initializes *val_* with 0 and *cat_* with &system_category()[.](#1.sentence-1)
[🔗](#lib:error_code,constructor_)
`error_code(int val, const error_category& cat) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1076)
*Effects*: Initializes *val_* with val and *cat_* with &cat[.](#2.sentence-1)
[🔗](#lib:error_code,constructor__)
`template<class ErrorCodeEnum>
error_code(ErrorCodeEnum e) noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1089)
*Constraints*: [is_error_code_enum_v](system.error.syn#lib:is_error_code_enum_v "19.5.2Header <system_­error> synopsis[system.error.syn]")<ErrorCodeEnum> is true[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1093)
*Effects*: Equivalent to:error_code ec = make_error_code(e);
assign(ec.value(), ec.category());

View File

@@ -0,0 +1,56 @@
[syserr.errcode.modifiers]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcode.modifiers)
### 19.5.4 Class error_code [[syserr.errcode]](syserr.errcode#modifiers)
#### 19.5.4.3 Modifiers [syserr.errcode.modifiers]
[🔗](#lib:assign,error_code)
`void assign(int val, const error_category& cat) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1110)
*Postconditions*: *val_* == val and *cat_* == &cat[.](#1.sentence-1)
[🔗](#lib:operator=,error_code)
`template<class ErrorCodeEnum>
error_code& operator=(ErrorCodeEnum e) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1122)
*Constraints*: [is_error_code_enum_v](system.error.syn#lib:is_error_code_enum_v "19.5.2Header <system_­error> synopsis[system.error.syn]")<ErrorCodeEnum> is true[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1126)
*Effects*: Equivalent to:error_code ec = make_error_code(e);
assign(ec.value(), ec.category());
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1134)
*Returns*: *this[.](#4.sentence-1)
[🔗](#lib:clear,error_code)
`void clear() noexcept;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1145)
*Postconditions*: value() == 0 and category() == system_category()[.](#5.sentence-1)

View File

@@ -0,0 +1,32 @@
[syserr.errcode.nonmembers]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcode.nonmembers)
### 19.5.4 Class error_code [[syserr.errcode]](syserr.errcode#nonmembers)
#### 19.5.4.5 Non-member functions [syserr.errcode.nonmembers]
[🔗](#lib:make_error_code,errc)
`error_code make_error_code(errc e) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1216)
*Returns*: error_code(static_cast<int>(e), generic_category())[.](#1.sentence-1)
[🔗](#lib:operator%3c%3c,error_code)
`template<class charT, class traits>
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const error_code& ec);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1228)
*Effects*: Equivalent to: return os << ec.category().name() << ':' << ec.value();

View File

@@ -0,0 +1,64 @@
[syserr.errcode.observers]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcode.observers)
### 19.5.4 Class error_code [[syserr.errcode]](syserr.errcode#observers)
#### 19.5.4.4 Observers [syserr.errcode.observers]
[🔗](#lib:value,error_code)
`int value() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1159)
*Returns*: *val_*[.](#1.sentence-1)
[🔗](#lib:category,error_code)
`const error_category& category() const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1170)
*Returns*: **cat_*[.](#2.sentence-1)
[🔗](#lib:default_error_condition,error_code)
`error_condition default_error_condition() const noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1181)
*Returns*: category().default_error_condition(value())[.](#3.sentence-1)
[🔗](#lib:message,error_code)
`string message() const;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1192)
*Returns*: category().message(value())[.](#4.sentence-1)
[🔗](#lib:operator_bool,error_code)
`explicit operator bool() const noexcept;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1203)
*Returns*: value() != 0[.](#5.sentence-1)

View File

@@ -0,0 +1,31 @@
[syserr.errcode.overview]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcode.overview)
### 19.5.4 Class error_code [[syserr.errcode]](syserr.errcode#overview)
#### 19.5.4.1 Overview [syserr.errcode.overview]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1009)
The class error_code describes an object used to hold error code
values, such as those originating from the operating system or other low-level
application program interfaces[.](#1.sentence-1)
[*Note [1](#note-1)*:
Class error_code is an
adjunct to error reporting by exception[.](#1.sentence-2)
— *end note*]
[🔗](#lib:error_code)
namespace std {class error_code {public:// [[syserr.errcode.constructors]](syserr.errcode.constructors "19.5.4.2Constructors"), constructors error_code() noexcept;
error_code(int val, const error_category& cat) noexcept; template<class ErrorCodeEnum> error_code(ErrorCodeEnum e) noexcept; // [[syserr.errcode.modifiers]](syserr.errcode.modifiers "19.5.4.3Modifiers"), modifiersvoid assign(int val, const error_category& cat) noexcept; template<class ErrorCodeEnum> error_code& operator=(ErrorCodeEnum e) noexcept; void clear() noexcept; // [[syserr.errcode.observers]](syserr.errcode.observers "19.5.4.4Observers"), observersint value() const noexcept; const error_category& category() const noexcept;
error_condition default_error_condition() const noexcept;
string message() const; explicit operator bool() const noexcept; private:int *val_*; // *exposition only*const error_category* *cat_*; // *exposition only*}; // [[syserr.errcode.nonmembers]](syserr.errcode.nonmembers "19.5.4.5Non-member functions"), non-member functions error_code make_error_code(errc e) noexcept; template<class charT, class traits> basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const error_code& ec);}

View File

@@ -0,0 +1,180 @@
[syserr.errcondition]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcondition)
### 19.5.5 Class error_condition [syserr.errcondition]
#### [19.5.5.1](#overview) Overview [[syserr.errcondition.overview]](syserr.errcondition.overview)
[1](#overview-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1238)
The class error_condition describes an object used to hold values identifying
error conditions[.](#overview-1.sentence-1)
[*Note [1](#overview-note-1)*:
error_condition values are portable abstractions,
while error_code values ([[syserr.errcode]](syserr.errcode "19.5.4Class error_­code")) are implementation specific[.](#overview-1.sentence-2)
— *end note*]
[🔗](#lib:error_condition)
namespace std {class error_condition {public:// [[syserr.errcondition.constructors]](#constructors "19.5.5.2Constructors"), constructors error_condition() noexcept;
error_condition(int val, const error_category& cat) noexcept; template<class ErrorConditionEnum> error_condition(ErrorConditionEnum e) noexcept; // [[syserr.errcondition.modifiers]](#modifiers "19.5.5.3Modifiers"), modifiersvoid assign(int val, const error_category& cat) noexcept; template<class ErrorConditionEnum> error_condition& operator=(ErrorConditionEnum e) noexcept; void clear() noexcept; // [[syserr.errcondition.observers]](#observers "19.5.5.4Observers"), observersint value() const noexcept; const error_category& category() const noexcept;
string message() const; explicit operator bool() const noexcept; private:int *val_*; // *exposition only*const error_category* *cat_*; // *exposition only*};}
#### [19.5.5.2](#constructors) Constructors [[syserr.errcondition.constructors]](syserr.errcondition.constructors)
[🔗](#lib:error_condition,constructor)
`error_condition() noexcept;
`
[1](#constructors-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1284)
*Effects*: Initializes *val_* with 0 and *cat_* with &generic_category()[.](#constructors-1.sentence-1)
[🔗](#lib:error_condition,constructor_)
`error_condition(int val, const error_category& cat) noexcept;
`
[2](#constructors-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1296)
*Effects*: Initializes *val_* with val and *cat_* with &cat[.](#constructors-2.sentence-1)
[🔗](#lib:error_condition,constructor__)
`template<class ErrorConditionEnum>
error_condition(ErrorConditionEnum e) noexcept;
`
[3](#constructors-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1309)
*Constraints*: is_error_condition_enum_v<ErrorConditionEnum> is true[.](#constructors-3.sentence-1)
[4](#constructors-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1313)
*Effects*: Equivalent to:error_condition ec = make_error_condition(e);
assign(ec.value(), ec.category());
#### [19.5.5.3](#modifiers) Modifiers [[syserr.errcondition.modifiers]](syserr.errcondition.modifiers)
[🔗](#lib:assign,error_condition)
`void assign(int val, const error_category& cat) noexcept;
`
[1](#modifiers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1331)
*Postconditions*: *val_* == val and *cat_* == &cat[.](#modifiers-1.sentence-1)
[🔗](#lib:operator=,error_condition)
`template<class ErrorConditionEnum>
error_condition& operator=(ErrorConditionEnum e) noexcept;
`
[2](#modifiers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1343)
*Constraints*: is_error_condition_enum_v<ErrorConditionEnum> is true[.](#modifiers-2.sentence-1)
[3](#modifiers-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1347)
*Effects*: Equivalent to:error_condition ec = make_error_condition(e);
assign(ec.value(), ec.category());
[4](#modifiers-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1355)
*Returns*: *this[.](#modifiers-4.sentence-1)
[🔗](#lib:clear,error_condition)
`void clear() noexcept;
`
[5](#modifiers-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1366)
*Postconditions*: value() == 0 and category() == generic_category()[.](#modifiers-5.sentence-1)
#### [19.5.5.4](#observers) Observers [[syserr.errcondition.observers]](syserr.errcondition.observers)
[🔗](#lib:value,error_condition)
`int value() const noexcept;
`
[1](#observers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1379)
*Returns*: *val_*[.](#observers-1.sentence-1)
[🔗](#lib:category,error_condition)
`const error_category& category() const noexcept;
`
[2](#observers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1390)
*Returns*: **cat_*[.](#observers-2.sentence-1)
[🔗](#lib:message,error_condition)
`string message() const;
`
[3](#observers-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1401)
*Returns*: category().message(value())[.](#observers-3.sentence-1)
[🔗](#lib:operator_bool,error_condition)
`explicit operator bool() const noexcept;
`
[4](#observers-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1412)
*Returns*: value() != 0[.](#observers-4.sentence-1)
#### [19.5.5.5](#nonmembers) Non-member functions [[syserr.errcondition.nonmembers]](syserr.errcondition.nonmembers)
[🔗](#lib:make_error_condition,errc)
`error_condition make_error_condition(errc e) noexcept;
`
[1](#nonmembers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1425)
*Returns*: error_condition(static_cast<int>(e), generic_category())[.](#nonmembers-1.sentence-1)

View File

@@ -0,0 +1,50 @@
[syserr.errcondition.constructors]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcondition.constructors)
### 19.5.5 Class error_condition [[syserr.errcondition]](syserr.errcondition#constructors)
#### 19.5.5.2 Constructors [syserr.errcondition.constructors]
[🔗](#lib:error_condition,constructor)
`error_condition() noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1284)
*Effects*: Initializes *val_* with 0 and *cat_* with &generic_category()[.](#1.sentence-1)
[🔗](#lib:error_condition,constructor_)
`error_condition(int val, const error_category& cat) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1296)
*Effects*: Initializes *val_* with val and *cat_* with &cat[.](#2.sentence-1)
[🔗](#lib:error_condition,constructor__)
`template<class ErrorConditionEnum>
error_condition(ErrorConditionEnum e) noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1309)
*Constraints*: is_error_condition_enum_v<ErrorConditionEnum> is true[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1313)
*Effects*: Equivalent to:error_condition ec = make_error_condition(e);
assign(ec.value(), ec.category());

View File

@@ -0,0 +1,56 @@
[syserr.errcondition.modifiers]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcondition.modifiers)
### 19.5.5 Class error_condition [[syserr.errcondition]](syserr.errcondition#modifiers)
#### 19.5.5.3 Modifiers [syserr.errcondition.modifiers]
[🔗](#lib:assign,error_condition)
`void assign(int val, const error_category& cat) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1331)
*Postconditions*: *val_* == val and *cat_* == &cat[.](#1.sentence-1)
[🔗](#lib:operator=,error_condition)
`template<class ErrorConditionEnum>
error_condition& operator=(ErrorConditionEnum e) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1343)
*Constraints*: is_error_condition_enum_v<ErrorConditionEnum> is true[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1347)
*Effects*: Equivalent to:error_condition ec = make_error_condition(e);
assign(ec.value(), ec.category());
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1355)
*Returns*: *this[.](#4.sentence-1)
[🔗](#lib:clear,error_condition)
`void clear() noexcept;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1366)
*Postconditions*: value() == 0 and category() == generic_category()[.](#5.sentence-1)

View File

@@ -0,0 +1,20 @@
[syserr.errcondition.nonmembers]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcondition.nonmembers)
### 19.5.5 Class error_condition [[syserr.errcondition]](syserr.errcondition#nonmembers)
#### 19.5.5.5 Non-member functions [syserr.errcondition.nonmembers]
[🔗](#lib:make_error_condition,errc)
`error_condition make_error_condition(errc e) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1425)
*Returns*: error_condition(static_cast<int>(e), generic_category())[.](#1.sentence-1)

View File

@@ -0,0 +1,53 @@
[syserr.errcondition.observers]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcondition.observers)
### 19.5.5 Class error_condition [[syserr.errcondition]](syserr.errcondition#observers)
#### 19.5.5.4 Observers [syserr.errcondition.observers]
[🔗](#lib:value,error_condition)
`int value() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1379)
*Returns*: *val_*[.](#1.sentence-1)
[🔗](#lib:category,error_condition)
`const error_category& category() const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1390)
*Returns*: **cat_*[.](#2.sentence-1)
[🔗](#lib:message,error_condition)
`string message() const;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1401)
*Returns*: category().message(value())[.](#3.sentence-1)
[🔗](#lib:operator_bool,error_condition)
`explicit operator bool() const noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1412)
*Returns*: value() != 0[.](#4.sentence-1)

View File

@@ -0,0 +1,29 @@
[syserr.errcondition.overview]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#errcondition.overview)
### 19.5.5 Class error_condition [[syserr.errcondition]](syserr.errcondition#overview)
#### 19.5.5.1 Overview [syserr.errcondition.overview]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1238)
The class error_condition describes an object used to hold values identifying
error conditions[.](#1.sentence-1)
[*Note [1](#note-1)*:
error_condition values are portable abstractions,
while error_code values ([[syserr.errcode]](syserr.errcode "19.5.4Class error_­code")) are implementation specific[.](#1.sentence-2)
— *end note*]
[🔗](#lib:error_condition)
namespace std {class error_condition {public:// [[syserr.errcondition.constructors]](syserr.errcondition.constructors "19.5.5.2Constructors"), constructors error_condition() noexcept;
error_condition(int val, const error_category& cat) noexcept; template<class ErrorConditionEnum> error_condition(ErrorConditionEnum e) noexcept; // [[syserr.errcondition.modifiers]](syserr.errcondition.modifiers "19.5.5.3Modifiers"), modifiersvoid assign(int val, const error_category& cat) noexcept; template<class ErrorConditionEnum> error_condition& operator=(ErrorConditionEnum e) noexcept; void clear() noexcept; // [[syserr.errcondition.observers]](syserr.errcondition.observers "19.5.5.4Observers"), observersint value() const noexcept; const error_category& category() const noexcept;
string message() const; explicit operator bool() const noexcept; private:int *val_*; // *exposition only*const error_category* *cat_*; // *exposition only*};}

View File

@@ -0,0 +1,24 @@
[syserr.general]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#general)
### 19.5.1 General [syserr.general]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L620)
Subclause [[syserr]](syserr "19.5System error support") describes components that the standard library and
C++ programs may use to report error conditions originating from
the operating system or other low-level application program interfaces[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L625)
Components described in [[syserr]](syserr "19.5System error support") do not change the value oferrno ([[errno]](errno "19.4Error numbers"))[.](#2.sentence-1)
*Recommended practice*: Implementations should leave the error states provided by other
libraries unchanged[.](#2.sentence-2)

19
cppdraft/syserr/hash.md Normal file
View File

@@ -0,0 +1,19 @@
[syserr.hash]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#hash)
### 19.5.7 System error hash support [syserr.hash]
[🔗](#lib:hash,error_code)
`template<> struct hash<error_code>;
template<> struct hash<error_condition>;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1510)
The specializations are enabled ([[unord.hash]](unord.hash "22.10.19Class template hash"))[.](#1.sentence-1)

141
cppdraft/syserr/syserr.md Normal file
View File

@@ -0,0 +1,141 @@
[syserr.syserr]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#syserr)
### 19.5.8 Class system_error [syserr.syserr]
#### [19.5.8.1](#overview) Overview [[syserr.syserr.overview]](syserr.syserr.overview)
[1](#overview-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1518)
The class system_error describes an exception object used to
report error conditions that have an associated error code[.](#overview-1.sentence-1)
Such error
conditions typically originate from the operating system or other low-level
application program interfaces[.](#overview-1.sentence-2)
[2](#overview-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1524)
[*Note [1](#overview-note-1)*:
If an error represents an out-of-memory condition, implementations are
encouraged to throw an exception object of type [bad_alloc](bad.alloc "17.6.4.1Class bad_­alloc[bad.alloc]") rather
than system_error[.](#overview-2.sentence-1)
— *end note*]
[🔗](#lib:system_error)
namespace std {class system_error : public runtime_error {public: system_error(error_code ec, const string& what_arg);
system_error(error_code ec, const char* what_arg);
system_error(error_code ec);
system_error(int ev, const error_category& ecat, const string& what_arg);
system_error(int ev, const error_category& ecat, const char* what_arg);
system_error(int ev, const error_category& ecat); const error_code& code() const noexcept; const char* what() const noexcept override; };}
#### [19.5.8.2](#members) Members [[syserr.syserr.members]](syserr.syserr.members)
[🔗](#lib:system_error,constructor)
`system_error(error_code ec, const string& what_arg);
`
[1](#members-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1555)
*Postconditions*: code() == ec and
string_view(what()).find(what_arg.c_str()) != string_view::npos[.](#members-1.sentence-1)
[🔗](#lib:system_error,constructor_)
`system_error(error_code ec, const char* what_arg);
`
[2](#members-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1567)
*Postconditions*: code() == ec andstring_view(what()).find(what_arg) != string_view::npos[.](#members-2.sentence-1)
[🔗](#lib:system_error,constructor__)
`system_error(error_code ec);
`
[3](#members-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1579)
*Postconditions*: code() == ec[.](#members-3.sentence-1)
[🔗](#lib:system_error,constructor___)
`system_error(int ev, const error_category& ecat, const string& what_arg);
`
[4](#members-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1590)
*Postconditions*: code() == error_code(ev, ecat) and
string_view(what()).find(what_arg.c_str()) != string_view::npos[.](#members-4.sentence-1)
[🔗](#lib:system_error,constructor____)
`system_error(int ev, const error_category& ecat, const char* what_arg);
`
[5](#members-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1602)
*Postconditions*: code() == error_code(ev, ecat) and
string_view(what()).find(what_arg) != string_view::npos[.](#members-5.sentence-1)
[🔗](#lib:system_error,constructor_____)
`system_error(int ev, const error_category& ecat);
`
[6](#members-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1614)
*Postconditions*: code() == error_code(ev, ecat)[.](#members-6.sentence-1)
[🔗](#lib:code,system_error)
`const error_code& code() const noexcept;
`
[7](#members-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1625)
*Returns*: ec or error_code(ev, ecat), from the constructor,
as appropriate[.](#members-7.sentence-1)
[🔗](#lib:what,system_error)
`const char* what() const noexcept override;
`
[8](#members-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1637)
*Returns*: An ntbs incorporating the arguments supplied in the constructor[.](#members-8.sentence-1)
[*Note [1](#members-note-1)*:
The returned ntbs might be the contents of what_arg + ": " + code.message()[.](#members-8.sentence-2)
— *end note*]

View File

@@ -0,0 +1,107 @@
[syserr.syserr.members]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#syserr.members)
### 19.5.8 Class system_error [[syserr.syserr]](syserr.syserr#members)
#### 19.5.8.2 Members [syserr.syserr.members]
[🔗](#lib:system_error,constructor)
`system_error(error_code ec, const string& what_arg);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1555)
*Postconditions*: code() == ec and
string_view(what()).find(what_arg.c_str()) != string_view::npos[.](#1.sentence-1)
[🔗](#lib:system_error,constructor_)
`system_error(error_code ec, const char* what_arg);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1567)
*Postconditions*: code() == ec andstring_view(what()).find(what_arg) != string_view::npos[.](#2.sentence-1)
[🔗](#lib:system_error,constructor__)
`system_error(error_code ec);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1579)
*Postconditions*: code() == ec[.](#3.sentence-1)
[🔗](#lib:system_error,constructor___)
`system_error(int ev, const error_category& ecat, const string& what_arg);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1590)
*Postconditions*: code() == error_code(ev, ecat) and
string_view(what()).find(what_arg.c_str()) != string_view::npos[.](#4.sentence-1)
[🔗](#lib:system_error,constructor____)
`system_error(int ev, const error_category& ecat, const char* what_arg);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1602)
*Postconditions*: code() == error_code(ev, ecat) and
string_view(what()).find(what_arg) != string_view::npos[.](#5.sentence-1)
[🔗](#lib:system_error,constructor_____)
`system_error(int ev, const error_category& ecat);
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1614)
*Postconditions*: code() == error_code(ev, ecat)[.](#6.sentence-1)
[🔗](#lib:code,system_error)
`const error_code& code() const noexcept;
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1625)
*Returns*: ec or error_code(ev, ecat), from the constructor,
as appropriate[.](#7.sentence-1)
[🔗](#lib:what,system_error)
`const char* what() const noexcept override;
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1637)
*Returns*: An ntbs incorporating the arguments supplied in the constructor[.](#8.sentence-1)
[*Note [1](#note-1)*:
The returned ntbs might be the contents of what_arg + ": " + code.message()[.](#8.sentence-2)
— *end note*]

View File

@@ -0,0 +1,41 @@
[syserr.syserr.overview]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#syserr.overview)
### 19.5.8 Class system_error [[syserr.syserr]](syserr.syserr#overview)
#### 19.5.8.1 Overview [syserr.syserr.overview]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1518)
The class system_error describes an exception object used to
report error conditions that have an associated error code[.](#1.sentence-1)
Such error
conditions typically originate from the operating system or other low-level
application program interfaces[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1524)
[*Note [1](#note-1)*:
If an error represents an out-of-memory condition, implementations are
encouraged to throw an exception object of type [bad_alloc](bad.alloc "17.6.4.1Class bad_­alloc[bad.alloc]") rather
than system_error[.](#2.sentence-1)
— *end note*]
[🔗](#lib:system_error)
namespace std {class system_error : public runtime_error {public: system_error(error_code ec, const string& what_arg);
system_error(error_code ec, const char* what_arg);
system_error(error_code ec);
system_error(int ev, const error_category& ecat, const string& what_arg);
system_error(int ev, const error_category& ecat, const char* what_arg);
system_error(int ev, const error_category& ecat); const error_code& code() const noexcept; const char* what() const noexcept override; };}