std::generic_category(3)
π NAME π
Okay so the NAME is literally std::generic_category - std::generic_category β yes bestie, the page is named after the function, main character energy fr fr. This is the std::generic_category(3) page from the C++ Standard Libary manual, and we're about to make it make sense. π«Ά
π Synopsis π
Defined in header <system_error>.
const std::error_category& generic_category() noexcept;
(since C++11) β noted, bestie. β¨
Okay so what does it do? It obtains a reference to the static error category object for generic errors. The object is required to override the virtual function error_category::name() to return a pointer to the string "generic". It is used to identify error conditions that correspond to the POSIX errno codes. That's the whole lore. π
π Parameters π
(none) β literally none, not a single parameter. The vibe check is empty and we love that. π«Ά
π¦ Return value π¦
A reference to the static object of unspecified runtime type, derived from std::error_category. No cap, that's the return value. π
β¨ Example β¨
// Run this code
#include <cerrno>
#include <iostream>
#include <string>
#include <system_error>
int main()
{
std::error_condition econd =
std::generic_category().default_error_condition(EDOM);
std::cout << "Category: " << econd.category().name() << '\n'
<< "Value: " << econd.value() << '\n'
<< "Message: " << econd.message() << '\n';
}
π Output: π
Category: generic
Value: 33
Message: Numerical argument out of domain
Not me getting emotional over a category name and a number. ππ
π See also π
system_categoryβ identifies the operating system error category (C++11) (function)errcβ thestd::error_conditionenumeration listing all standard<cerrno>macro constants (C++11) (class)
mwah π β source/version: http://cppreference.com, date: 2024.06.10, page: std::generic_category(3). Bye bestie! π«Άπ
π¦ 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