Path: blob/main/contrib/llvm-project/libcxx/include/__functional/ranges_operations.h
35260 views
// -*- C++ -*-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-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H10#define _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H1112#include <__concepts/equality_comparable.h>13#include <__concepts/totally_ordered.h>14#include <__config>15#include <__type_traits/desugars_to.h>16#include <__utility/forward.h>1718#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)19# pragma GCC system_header20#endif2122_LIBCPP_BEGIN_NAMESPACE_STD2324#if _LIBCPP_STD_VER >= 202526namespace ranges {2728struct equal_to {29template <class _Tp, class _Up>30requires equality_comparable_with<_Tp, _Up>31[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const32noexcept(noexcept(bool(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))) {33return std::forward<_Tp>(__t) == std::forward<_Up>(__u);34}3536using is_transparent = void;37};3839struct not_equal_to {40template <class _Tp, class _Up>41requires equality_comparable_with<_Tp, _Up>42[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const43noexcept(noexcept(bool(!(std::forward<_Tp>(__t) == std::forward<_Up>(__u))))) {44return !(std::forward<_Tp>(__t) == std::forward<_Up>(__u));45}4647using is_transparent = void;48};4950struct less {51template <class _Tp, class _Up>52requires totally_ordered_with<_Tp, _Up>53[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const54noexcept(noexcept(bool(std::forward<_Tp>(__t) < std::forward<_Up>(__u)))) {55return std::forward<_Tp>(__t) < std::forward<_Up>(__u);56}5758using is_transparent = void;59};6061struct less_equal {62template <class _Tp, class _Up>63requires totally_ordered_with<_Tp, _Up>64[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const65noexcept(noexcept(bool(!(std::forward<_Up>(__u) < std::forward<_Tp>(__t))))) {66return !(std::forward<_Up>(__u) < std::forward<_Tp>(__t));67}6869using is_transparent = void;70};7172struct greater {73template <class _Tp, class _Up>74requires totally_ordered_with<_Tp, _Up>75[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const76noexcept(noexcept(bool(std::forward<_Up>(__u) < std::forward<_Tp>(__t)))) {77return std::forward<_Up>(__u) < std::forward<_Tp>(__t);78}7980using is_transparent = void;81};8283struct greater_equal {84template <class _Tp, class _Up>85requires totally_ordered_with<_Tp, _Up>86[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const87noexcept(noexcept(bool(!(std::forward<_Tp>(__t) < std::forward<_Up>(__u))))) {88return !(std::forward<_Tp>(__t) < std::forward<_Up>(__u));89}9091using is_transparent = void;92};9394} // namespace ranges9596// For ranges we do not require that the types on each side of the equality97// operator are of the same type98template <class _Tp, class _Up>99inline const bool __desugars_to_v<__equal_tag, ranges::equal_to, _Tp, _Up> = true;100101template <class _Tp, class _Up>102inline const bool __desugars_to_v<__less_tag, ranges::less, _Tp, _Up> = true;103104#endif // _LIBCPP_STD_VER >= 20105106_LIBCPP_END_NAMESPACE_STD107108#endif // _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H109110111