Path: blob/main/contrib/llvm-project/libcxx/include/__algorithm/comp.h
35232 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef _LIBCPP___ALGORITHM_COMP_H9#define _LIBCPP___ALGORITHM_COMP_H1011#include <__config>12#include <__type_traits/desugars_to.h>1314#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)15# pragma GCC system_header16#endif1718_LIBCPP_BEGIN_NAMESPACE_STD1920struct __equal_to {21template <class _T1, class _T2>22_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _T1& __x, const _T2& __y) const {23return __x == __y;24}25};2627template <class _Tp, class _Up>28inline const bool __desugars_to_v<__equal_tag, __equal_to, _Tp, _Up> = true;2930// The definition is required because __less is part of the ABI, but it's empty31// because all comparisons should be transparent.32template <class _T1 = void, class _T2 = _T1>33struct __less {};3435template <>36struct __less<void, void> {37template <class _Tp, class _Up>38_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __lhs, const _Up& __rhs) const {39return __lhs < __rhs;40}41};4243template <class _Tp>44inline const bool __desugars_to_v<__less_tag, __less<>, _Tp, _Tp> = true;4546_LIBCPP_END_NAMESPACE_STD4748#endif // _LIBCPP___ALGORITHM_COMP_H495051