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

57 lines
1.6 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.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)