Files
cppdraft_translate/cppdraft/syserr/errcode/overview.md
2025-10-25 03:02:53 +03:00

32 lines
1.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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);}