public pure virtual member function
<system_error>

std::error_category::name

virtual const char* name() const noexcept = 0;
Return category name
In derived classes, the function returns a C-string naming the category.

In error_category, it is a pure virtual member function.

In the generic_category object, it returns "generic".
In the system_category object, it returns "system".
In the iostream_category object, it returns "iostream".

Parameters

none

Return Value

A pointer to the first character of a null-terminated character sequence with the category name.

Example

1
2
3
4
5
6
7
8
9
// error_category::name
#include <iostream>       // std::cout
#include <system_error>   // std::error_code

int main() {
  std::error_code ec;	// the default error code is system error 0
  std::cout << ec.category().name() << '\n';
  return 0;
}

Output:
system


See also