From a2f83abeb63c016bb804d796f252fb1268dd33b8 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Thu, 28 Aug 2025 00:17:43 -0400 Subject: [PATCH] Rename the core concept in comparison helpers. --- comparisons.h | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/comparisons.h b/comparisons.h index b4ded81..2ee7fea 100644 --- a/comparisons.h +++ b/comparisons.h @@ -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 ) {