std::error_...::error_code(3)
π std::error_...::error_code(3) π
okay bestie, welcome to std::error_...::error_code(3) from the C++ Standard Libary manual β that's the exact manual spelling, no cap, we are not correcting it π
. This page is all about the std::error_code constructors, and it's lowkey giving "small object, big feelings."
πΈ NAME πΈ
std::error_code::error_code - std::error_code::error_code
β¨ SYNOPSIS β¨
error_code() noexcept; (1) (since C++11)
error_code( int ec, const error_category& ecat ) noexcept; (2) (since C++11)
template< class ErrorCodeEnum > (3) (since C++11)
error_code( ErrorCodeEnum e ) noexcept;
error_code( const error_code& other ) = default; (4) (since C++11)
(implicitly declared)
error_code( error_code&& other ) = default; (5) (since C++11)
(implicitly declared)
Constructs new error code. Not me getting emotional over a constructor π. Here's the tea, overload by overload:
(1)β Constructs error code with default value. Equivalent toerror_code(0, std::system_category()).(2)β Constructs error code withecas the platform-dependent error code andecatas the corresponding error category.(3)β Constructs error code from an error code enume. Equivalent tomake_error_code(e), wheremake_error_codeis only found by argument-dependent lookup. This overload participates in overload resolution only ifstd::is_error_code_enum<ErrorCodeEnum>::valueis true.
π¨ overload-resolution vibe check: number (3) is only in the club if std::is_error_code_enum<ErrorCodeEnum>::value is true. periodt.
(4), (5)β Implicitly defined copy constructor and move constructor. Initializes the error code with the contents of the other.
π PARAMETERS π
- other β another error code to initialize with
- ec β platform dependent error code to construct with
- ecat β error category corresponding to
ec - e β error code enum to construct with
π DEFECT REPORTS π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- DR
LWG 3629, applied to C++11 β behavior as published: onlystd::make_error_codeoverloads were ADL-found; correct behavior: ADL-found overloads are used.
π¦ SEE ALSO π¦
make_error_code(std::errc)(C++11)β creates error code value forerrcenume; (function)make_error_code(std::io_errc)(C++11)β constructs an iostream error code; (function)make_error_code(std::future_errc)(C++11)β constructs a future error code; (function)
okay that's the whole page, bestie π«Ά. source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::error_...::error_code(3). slay, go construct some error codes responsibly πβ¨.
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms