1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include <__config>
10
11// This has technically been removed in LLVM 3.4
12#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) && !defined(_LIBCPP_OBJECT_FORMAT_XCOFF) && \
13 _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 4
14# define _LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS
15#endif
16
17#include <system_error>
18
19_LIBCPP_BEGIN_NAMESPACE_STD
20
21// class error_category
22
23#if defined(_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS)
24error_category::error_category() noexcept {}
25#endif
26
27error_category::~error_category() noexcept {}
28
29error_condition error_category::default_error_condition(int ev) const noexcept { return error_condition(ev, *this); }
30
31bool error_category::equivalent(int code, const error_condition& condition) const noexcept {
32 return default_error_condition(ev: code) == condition;
33}
34
35bool error_category::equivalent(const error_code& code, int condition) const noexcept {
36 return *this == code.category() && code.value() == condition;
37}
38
39_LIBCPP_END_NAMESPACE_STD
40