std::make_e...(std::errc)(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… NAME πŸ’…

Okay so bestie, welcome to the std::make_error_condition(std::errc) page β€” page label std::make_e...(std::errc)(3), from the C++ Standard Libary manual. The NAME bit is std::make_error_condition(std::errc) β€” std::make_error_condition(std::errc). Yep, it says it twice, and honestly? Double the icon, double the slay. πŸ’…

This is the iconic little function that makes an error condition out of an errc value. Yes queen, that’s the whole assignment. ✨

✨ Synopsis ✨

Defined in header <system_error>:

std::error_condition make_error_condition( std::errc e ) noexcept;

(since C++11)

What it does: creates an error condition for an errc value e. It sets the error value to int(e) and the error category to std::generic_category. That’s the whole plot, bestie. πŸŽ€

πŸŽ€ Parameters πŸŽ€

  • e β€” the standard error value. That’s it. That’s the parameter. 🫢

🌸 Return value 🌸

An error condition for e. Boom. Slay. πŸ’–

πŸ¦‹ Example πŸ¦‹

Run this code, bestie:

#include <iostream>
#include <string>
#include <system_error>

int main()
{
    auto err = std::make_error_condition(std::errc::invalid_argument);
    std::cout << err.message() << '\n';
}

⭐ Possible output ⭐

Invalid argument

That’s a wrap, bestie! Cute little sign-off: source http://cppreference.com, date/version 2024.06.10, and this page is std::make_e...(std::errc)(3). Mwah πŸ’‹πŸŒˆ

πŸ“¦ where this page comes from