forked from Alepha/Alepha
Rename the core concept in comparison helpers.
This commit is contained in:
@ -28,10 +28,8 @@ namespace Alepha::Hydrogen
|
||||
using detail::comparisons_m::comparable;
|
||||
}
|
||||
|
||||
// TODO: This name collides with `Concepts::Comparable` in annoying ways, it seems.
|
||||
// Maybe rename to `LensComparable`?
|
||||
template< typename T >
|
||||
concept Comparable= HasCapability< T, comparable >;
|
||||
concept LensComparable= HasCapability< T, comparable >;
|
||||
|
||||
|
||||
// Spaceship lens support
|
||||
@ -47,7 +45,7 @@ namespace Alepha::Hydrogen
|
||||
|
||||
template
|
||||
<
|
||||
Comparable T,
|
||||
LensComparable T,
|
||||
typename= std::enable_if_t< has_spaceship_lens_member_v< T > >,
|
||||
overload< __LINE__ > = nullptr
|
||||
>
|
||||
@ -79,7 +77,7 @@ namespace Alepha::Hydrogen
|
||||
|
||||
template< typename T >
|
||||
concept MemberValueLensed=
|
||||
Comparable< T >
|
||||
LensComparable< T >
|
||||
and
|
||||
requires( const T &val )
|
||||
{
|
||||
@ -94,7 +92,7 @@ namespace Alepha::Hydrogen
|
||||
|
||||
template
|
||||
<
|
||||
Comparable T,
|
||||
LensComparable T,
|
||||
typename= std::enable_if_t< supports_spaceship_lens_v< T > >,
|
||||
overload< __LINE__ > = nullptr
|
||||
>
|
||||
@ -106,7 +104,7 @@ namespace Alepha::Hydrogen
|
||||
|
||||
template< typename T >
|
||||
concept ValueLensed=
|
||||
Comparable< T >
|
||||
LensComparable< T >
|
||||
and
|
||||
requires( const T &val )
|
||||
{
|
||||
@ -126,7 +124,7 @@ namespace Alepha::Hydrogen
|
||||
|
||||
template< typename T >
|
||||
concept MemberEqualityLensed=
|
||||
Comparable< T >
|
||||
LensComparable< T >
|
||||
and
|
||||
requires( const T &val )
|
||||
{
|
||||
@ -147,7 +145,7 @@ namespace Alepha::Hydrogen
|
||||
|
||||
template< typename T >
|
||||
concept EqualityLensed=
|
||||
Comparable< T >
|
||||
LensComparable< T >
|
||||
and
|
||||
requires( const T &val )
|
||||
{
|
||||
@ -176,7 +174,7 @@ namespace Alepha::Hydrogen
|
||||
|
||||
template
|
||||
<
|
||||
Comparable T,
|
||||
LensComparable T,
|
||||
typename= std::enable_if_t< has_strict_weak_order_lens_member_v< T > >,
|
||||
overload< __LINE__ > = nullptr
|
||||
>
|
||||
@ -211,42 +209,42 @@ namespace Alepha::Hydrogen
|
||||
}
|
||||
|
||||
// Operator support:
|
||||
template< Comparable T >
|
||||
template< LensComparable T >
|
||||
constexpr bool
|
||||
operator == ( const T &lhs, const T &rhs )
|
||||
{
|
||||
return make_equality_lens( lhs ) == make_equality_lens( rhs );
|
||||
}
|
||||
|
||||
template< Comparable T >
|
||||
template< LensComparable T >
|
||||
constexpr bool
|
||||
operator != ( const T &lhs, const T &rhs )
|
||||
{
|
||||
return make_equality_lens( lhs ) != make_equality_lens( rhs );
|
||||
}
|
||||
|
||||
template< Comparable T >
|
||||
template< LensComparable T >
|
||||
constexpr bool
|
||||
operator < ( const T &lhs, const T &rhs )
|
||||
{
|
||||
return make_strict_weak_order_lens( lhs ) < make_strict_weak_order_lens( rhs );
|
||||
}
|
||||
|
||||
template< Comparable T >
|
||||
template< LensComparable T >
|
||||
constexpr bool
|
||||
operator > ( const T &lhs, const T &rhs )
|
||||
{
|
||||
return make_strict_weak_order_lens( lhs ) > make_strict_weak_order_lens( rhs );
|
||||
}
|
||||
|
||||
template< Comparable T >
|
||||
template< LensComparable T >
|
||||
constexpr bool
|
||||
operator <= ( const T &lhs, const T &rhs )
|
||||
{
|
||||
return make_strict_weak_order_lens( lhs ) <= make_strict_weak_order_lens( rhs );
|
||||
}
|
||||
|
||||
template< Comparable T >
|
||||
template< LensComparable T >
|
||||
constexpr bool
|
||||
operator >= ( const T &lhs, const T &rhs )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user