xref: /llvm-project/libcxx/include/__compare/compare_three_way.h (revision 9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7)
13df094d3SArthur O'Dwyer // -*- C++ -*-
23df094d3SArthur O'Dwyer //===----------------------------------------------------------------------===//
33df094d3SArthur O'Dwyer //
43df094d3SArthur O'Dwyer // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
53df094d3SArthur O'Dwyer // See https://llvm.org/LICENSE.txt for license information.
63df094d3SArthur O'Dwyer // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
73df094d3SArthur O'Dwyer //
83df094d3SArthur O'Dwyer //===----------------------------------------------------------------------===//
93df094d3SArthur O'Dwyer 
103df094d3SArthur O'Dwyer #ifndef _LIBCPP___COMPARE_COMPARE_THREE_WAY_H
113df094d3SArthur O'Dwyer #define _LIBCPP___COMPARE_COMPARE_THREE_WAY_H
123df094d3SArthur O'Dwyer 
133df094d3SArthur O'Dwyer #include <__compare/three_way_comparable.h>
144d81a46fSArthur O'Dwyer #include <__config>
153df094d3SArthur O'Dwyer #include <__utility/forward.h>
163df094d3SArthur O'Dwyer 
173df094d3SArthur O'Dwyer #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
183df094d3SArthur O'Dwyer #  pragma GCC system_header
193df094d3SArthur O'Dwyer #endif
203df094d3SArthur O'Dwyer 
213df094d3SArthur O'Dwyer _LIBCPP_BEGIN_NAMESPACE_STD
223df094d3SArthur O'Dwyer 
234f15267dSNikolas Klauser #if _LIBCPP_STD_VER >= 20
243df094d3SArthur O'Dwyer 
25*9783f28cSLouis Dionne struct _LIBCPP_TEMPLATE_VIS compare_three_way {
263df094d3SArthur O'Dwyer   template <class _T1, class _T2>
273df094d3SArthur O'Dwyer     requires three_way_comparable_with<_T1, _T2>
operatorcompare_three_way28*9783f28cSLouis Dionne   constexpr _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
29*9783f28cSLouis Dionne       noexcept(noexcept(std::forward<_T1>(__t) <=> std::forward<_T2>(__u))) {
30*9783f28cSLouis Dionne     return std::forward<_T1>(__t) <=> std::forward<_T2>(__u);
31*9783f28cSLouis Dionne   }
323df094d3SArthur O'Dwyer 
333df094d3SArthur O'Dwyer   using is_transparent = void;
343df094d3SArthur O'Dwyer };
353df094d3SArthur O'Dwyer 
364f15267dSNikolas Klauser #endif // _LIBCPP_STD_VER >= 20
373df094d3SArthur O'Dwyer 
383df094d3SArthur O'Dwyer _LIBCPP_END_NAMESPACE_STD
393df094d3SArthur O'Dwyer 
403df094d3SArthur O'Dwyer #endif // _LIBCPP___COMPARE_COMPARE_THREE_WAY_H
41