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

51 lines
1.5 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.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());