std::make_e...d::io_errc)(3)
okay so bestie, this is the C++ Standard Library page for std::make_error_code(std::io_errc) πβ¨ yes the manual name is folded in right here, and we are keeping every single fact while making it cute. periodt.
π NAME π
std::make_error_code(std::io_errc) β the function that constructs an std::error_code from an std::io_errc value. slay.
β¨ Synopsis β¨
Defined in header <ios> β and this signature has been iconic since C++11:
std::error_code make_error_code( std::io_errc e ) noexcept;
(since C++11)
Constructs an std::error_code object from a value of type std::io_errc as if by:
return std::error_code(static_cast<int>(e), std::iostream_category());
This function is called by the constructor of std::error_code with an std::io_errc argument. no cap, thatβs the whole vibe.
π Parameters π
eβ error code number
π¦ Return value π¦
A value of type std::error_code that holds the error code number from e associated with the error category "iostream". literally that.
πΈ Example πΈ
the original says // Run this code β hereβs the code, bestie:
#include <iostream>
#include <system_error>
int main()
{
std::error_code ec = std::make_error_code(std::io_errc::stream);
// This works because of the overloaded method
// and the is_error_code_enum specialization.
ec = std::io_errc::stream;
std::cout << "Error code from io_errc::stream has category "
<< ec.category().name() << '\n';
}
π Output π
Error code from io_errc::stream has category iostream
π©Ή Defect reports π©Ή
The following behavior-changing defect reports were applied retroactively to previously published C++ standards. iykyk, we keep the receipts:
- LWG 2087 β applied to C++11. Behavior as published:
make_error_code(io_errc)was not declarednoexcept. Correct behavior: declarednoexcept.
π See also π
error_code(C++11) (class) β holds a platform-dependent error codeio_errc(C++11) (enum) β the IO stream error codesmake_error_code(std::errc)(C++11) (function) β creates error code value for errc enum emake_error_code(std::future_errc)(C++11) (function) β constructs a future error code
π cute sign-off: source is http://cppreference.com, version/date is 2024.06.10, and the footerβs title column is std::make_e...d::io_errc)(3). thatβs the footer, but make it fashion ππ
π¦ 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