forked from Alepha/Alepha
Conceptualize member strict_weak_order_lens.
This commit is contained in:
@ -151,23 +151,17 @@ namespace Alepha::Hydrogen
|
||||
|
||||
// Strict weak order lens support
|
||||
|
||||
template< typename T, typename= void >
|
||||
struct has_strict_weak_order_lens_member : std::false_type {};
|
||||
|
||||
template< typename T >
|
||||
struct has_strict_weak_order_lens_member< T, std::void_t< decltype( std::declval< const T & >().strict_weak_order_lens() ) > > : std::true_type {};
|
||||
concept MemberStrictWeakOrderLensed=
|
||||
LensComparable< T >
|
||||
and
|
||||
requires( const T &val )
|
||||
{
|
||||
{ val.strict_weak_order_lens() } -> Concepts::LessThanComparable;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
constexpr bool has_strict_weak_order_lens_member_v= has_strict_weak_order_lens_member< T >::value;
|
||||
|
||||
template
|
||||
<
|
||||
LensComparable T,
|
||||
typename= std::enable_if_t< has_strict_weak_order_lens_member_v< T > >,
|
||||
overload< __LINE__ > = nullptr
|
||||
>
|
||||
constexpr decltype( auto )
|
||||
strict_weak_order_lens( T &t )
|
||||
strict_weak_order_lens( const MemberStrictWeakOrderLensed auto &t )
|
||||
{
|
||||
return t.strict_weak_order_lens();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user