[syserr.errcat.overview] # 19 Diagnostics library [[diagnostics]](./#diagnostics) ## 19.5 System error support [[syserr]](syserr#errcat.overview) ### 19.5.3 Class error_category [[syserr.errcat]](syserr.errcat#overview) #### 19.5.3.1 Overview [syserr.errcat.overview] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L783) The class error_category serves as a base class for types used to identify the source and encoding of a particular category of error code[.](#1.sentence-1) Classes may be derived from error_category to support categories of errors in addition to those defined in this document[.](#1.sentence-2) Such classes shall behave as specified in subclause [[syserr.errcat]](syserr.errcat "19.5.3 Class error_­category")[.](#1.sentence-3) [*Note [1](#note-1)*: error_category objects are passed by reference, and two such objects are equal if they have the same address[.](#1.sentence-4) If there is more than a single object of a custom error_category type, such equality comparisons can evaluate to false even for objects holding the same value[.](#1.sentence-5) — *end note*] [🔗](#lib:error_category) namespace std {class error_category {public:constexpr error_category() noexcept; virtual ~error_category(); error_category(const error_category&) = delete; error_category& operator=(const error_category&) = delete; virtual const char* name() const noexcept = 0; virtual error_condition default_error_condition(int ev) const noexcept; virtual bool equivalent(int code, const error_condition& condition) const noexcept; virtual bool equivalent(const error_code& code, int condition) const noexcept; virtual string message(int ev) const = 0; bool operator==(const error_category& rhs) const noexcept; strong_ordering operator<=>(const error_category& rhs) const noexcept; }; const error_category& [generic_category](syserr.errcat.objects#lib:generic_category "19.5.3.5 Error category objects [syserr.errcat.objects]")() noexcept; const error_category& [system_category](syserr.errcat.objects#lib:system_category "19.5.3.5 Error category objects [syserr.errcat.objects]")() noexcept;}