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,32 @@
[system.error.syn]
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
## 19.5 System error support [[syserr]](syserr#system.error.syn)
### 19.5.2 Header <system_error> synopsis [system.error.syn]
[🔗](#header:%3csystem_error%3e)
#include <compare> // see [[compare.syn]](compare.syn "17.12.1Header <compare> synopsis")namespace std {class error_category; const error_category& generic_category() noexcept; const error_category& system_category() noexcept; class error_code; class error_condition; class system_error; template<class T>struct [is_error_code_enum](#lib:is_error_code_enum "19.5.2Header <system_­error> synopsis[system.error.syn]") : public false_type {}; template<class T>struct [is_error_condition_enum](#lib:is_error_condition_enum "19.5.2Header <system_­error> synopsis[system.error.syn]") : public false_type {}; enum class [errc](#lib:errc "19.5.2Header <system_­error> synopsis[system.error.syn]") { // freestanding address_family_not_supported, // EAFNOSUPPORT address_in_use, // EADDRINUSE address_not_available, // EADDRNOTAVAIL already_connected, // EISCONN argument_list_too_long, // E2BIG argument_out_of_domain, // EDOM bad_address, // EFAULT bad_file_descriptor, // EBADF bad_message, // EBADMSG broken_pipe, // EPIPE connection_aborted, // ECONNABORTED connection_already_in_progress, // EALREADY connection_refused, // ECONNREFUSED connection_reset, // ECONNRESET cross_device_link, // EXDEV destination_address_required, // EDESTADDRREQ device_or_resource_busy, // EBUSY directory_not_empty, // ENOTEMPTY executable_format_error, // ENOEXEC file_exists, // EEXIST file_too_large, // EFBIG filename_too_long, // ENAMETOOLONG function_not_supported, // ENOSYS host_unreachable, // EHOSTUNREACH identifier_removed, // EIDRM illegal_byte_sequence, // EILSEQ inappropriate_io_control_operation, // ENOTTY interrupted, // EINTR invalid_argument, // EINVAL invalid_seek, // ESPIPE io_error, // EIO is_a_directory, // EISDIR message_size, // EMSGSIZE network_down, // ENETDOWN network_reset, // ENETRESET network_unreachable, // ENETUNREACH no_buffer_space, // ENOBUFS no_child_process, // ECHILD no_link, // ENOLINK no_lock_available, // ENOLCK no_message, // ENOMSG no_protocol_option, // ENOPROTOOPT no_space_on_device, // ENOSPC no_such_device_or_address, // ENXIO no_such_device, // ENODEV no_such_file_or_directory, // ENOENT no_such_process, // ESRCH not_a_directory, // ENOTDIR not_a_socket, // ENOTSOCK not_connected, // ENOTCONN not_enough_memory, // ENOMEM not_supported, // ENOTSUP operation_canceled, // ECANCELED operation_in_progress, // EINPROGRESS operation_not_permitted, // EPERM operation_not_supported, // EOPNOTSUPP operation_would_block, // EWOULDBLOCK owner_dead, // EOWNERDEAD permission_denied, // EACCES protocol_error, // EPROTO protocol_not_supported, // EPROTONOSUPPORT read_only_file_system, // EROFS resource_deadlock_would_occur, // EDEADLK resource_unavailable_try_again, // EAGAIN result_out_of_range, // ERANGE state_not_recoverable, // ENOTRECOVERABLE text_file_busy, // ETXTBSY timed_out, // ETIMEDOUT too_many_files_open_in_system, // ENFILE too_many_files_open, // EMFILE too_many_links, // EMLINK too_many_symbolic_link_levels, // ELOOP value_too_large, // EOVERFLOW wrong_protocol_type, // EPROTOTYPE}; template<> struct is_error_condition_enum<errc> : true_type {}; // [[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); // [[syserr.errcondition.nonmembers]](syserr.errcondition.nonmembers "19.5.5.5Non-member functions"), non-member functions error_condition make_error_condition(errc e) noexcept; // [[syserr.compare]](syserr.compare "19.5.6Comparison operator functions"), comparison operator functionsbool operator==(const error_code& lhs, const error_code& rhs) noexcept; bool operator==(const error_code& lhs, const error_condition& rhs) noexcept; bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
strong_ordering operator<=>(const error_code& lhs, const error_code& rhs) noexcept;
strong_ordering operator<=>(const error_condition& lhs, const error_condition& rhs) noexcept; // [[syserr.hash]](syserr.hash "19.5.7System error hash support"), hash supporttemplate<class T> struct hash; template<> struct hash<error_code>; template<> struct hash<error_condition>; // [[syserr]](syserr "19.5System error support"), system error supporttemplate<class T>constexpr bool [is_error_code_enum_v](#lib:is_error_code_enum_v "19.5.2Header <system_­error> synopsis[system.error.syn]") = [is_error_code_enum](#lib:is_error_code_enum "19.5.2Header <system_­error> synopsis[system.error.syn]")<T>::value; template<class T>constexpr bool [is_error_condition_enum_v](#lib:is_error_condition_enum_v "19.5.2Header <system_­error> synopsis[system.error.syn]") = [is_error_condition_enum](#lib:is_error_condition_enum "19.5.2Header <system_­error> synopsis[system.error.syn]")<T>::value;}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L767)
The value of each enum errc enumerator is the same as
the value of the [<cerrno>](errno.general#header:%3ccerrno%3e "19.4.1General[errno.general]") macro shown in the above synopsis[.](#1.sentence-1)
Whether or not the [<system_error>](#header:%3csystem_error%3e "19.5.2Header <system_­error> synopsis[system.error.syn]") implementation
exposes the [<cerrno>](errno.general#header:%3ccerrno%3e "19.4.1General[errno.general]") macros is unspecified[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L773)
The [is_error_code_enum](#lib:is_error_code_enum "19.5.2Header <system_­error> synopsis[system.error.syn]") and [is_error_condition_enum](#lib:is_error_condition_enum "19.5.2Header <system_­error> synopsis[system.error.syn]") templates may be
specialized for program-defined types to indicate that such types are eligible
for class [error_code](syserr.errcode.overview#lib:error_code "19.5.4.1Overview[syserr.errcode.overview]") and class [error_condition](syserr.errcondition.overview#lib:error_condition "19.5.5.1Overview[syserr.errcondition.overview]") implicit
conversions, respectively[.](#2.sentence-1)