8#ifndef INCLUDED_BSLALG_SYNTHTHREEWAYUTIL
9#define INCLUDED_BSLALG_SYNTHTHREEWAYUTIL
111#include <bslscm_version.h>
116#if defined(BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON) && \
117 defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS)
119#define BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE 1
134struct SynthThreeWayUtil {
146 template <
class t_TYPE1,
class t_TYPE2>
147 static constexpr bool isNoexcept(
const t_TYPE1 *t1 =
nullptr,
148 const t_TYPE2 *t2 =
nullptr)
150 if constexpr (std::three_way_comparable_with<t_TYPE1, t_TYPE2>)
151 return noexcept(*t1 <=> *t2);
153 return noexcept(*t1 < *t2) &&
noexcept(*t2 < *t1);
156 template <
class t_TYPE1,
class t_TYPE2>
158 constexpr auto operator()(
const t_TYPE1& t1,
const t_TYPE2& t2)
const
159 noexcept(isNoexcept<t_TYPE1, t_TYPE2>())
161 { t1 < t2 } -> bslmf::BooleanTestable;
162 { t2 < t1 } -> bslmf::BooleanTestable;
165 if constexpr (std::three_way_comparable_with<t_TYPE1, t_TYPE2>)
170 return std::weak_ordering::less;
172 return std::weak_ordering::greater;
174 return std::weak_ordering::equivalent;
183 template <
class t_TYPE1,
class t_TYPE2 = t_TYPE1>
184 using Result =
decltype(compare(std::declval<t_TYPE1&>(),
185 std::declval<t_TYPE2&>()));
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlc_flathashmap.h:1805