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 #ifdef _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS 12 # define _LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS 13 #endif 14 15 #include <system_error> 16 17 _LIBCPP_BEGIN_NAMESPACE_STD 18 19 // class error_category 20 21 #if defined(_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS) 22 error_category::error_category() noexcept {} 23 #endif 24 25 error_category::~error_category() noexcept {} 26 27 error_condition error_category::default_error_condition(int ev) const noexcept { return error_condition(ev, *this); } 28 29 bool error_category::equivalent(int code, const error_condition& condition) const noexcept { 30 return default_error_condition(code) == condition; 31 } 32 33 bool error_category::equivalent(const error_code& code, int condition) const noexcept { 34 return *this == code.category() && code.value() == condition; 35 } 36 37 _LIBCPP_END_NAMESPACE_STD 38