forked from Alepha/Alepha
We can use requires clauses here.
But it does seem that I can't remove the repeated defns for the argument extraction.
This commit is contained in:
@ -36,6 +36,10 @@ namespace Alepha::Hydrogen::Reflection ::detail:: tagged_ctor_count_m
|
||||
constexpr operator T ();
|
||||
};
|
||||
|
||||
template< typename T, typename ... Args >
|
||||
requires( Concepts::ConstructibleFrom< T, Args... > )
|
||||
constexpr void construct( const std::tuple< Args... > & );
|
||||
|
||||
template< typename T, typename ... Args >
|
||||
requires( Concepts::ConstructibleFrom< T, Args... > )
|
||||
constexpr void construct( std::tuple< Args... > && );
|
||||
@ -67,7 +71,7 @@ namespace Alepha::Hydrogen::Reflection ::detail:: tagged_ctor_count_m
|
||||
// The first step is to just start it all off with a blank sequence and walk forward from there.
|
||||
// The default arguments cause it to start with the blank sequence, even if it doesn't match this
|
||||
// case in the specialization selection.
|
||||
template< typename T, typename tag, std::size_t cnt= 0, typename= void >
|
||||
template< typename T, typename tag, std::size_t cnt= 0 >
|
||||
struct tagged_ctor_count
|
||||
: tagged_ctor_count< T, tag, cnt + 1 > {};
|
||||
|
||||
@ -79,19 +83,8 @@ namespace Alepha::Hydrogen::Reflection ::detail:: tagged_ctor_count_m
|
||||
};
|
||||
|
||||
template< typename T, typename tag, std::size_t depth >
|
||||
struct tagged_ctor_count
|
||||
<
|
||||
T,
|
||||
tag,
|
||||
depth,
|
||||
std::void_t
|
||||
<
|
||||
decltype( construct< T >
|
||||
(
|
||||
std::tuple_cat( std::declval< expand_t< T, depth > >(), std::declval< std::tuple< tag > >() )
|
||||
) )
|
||||
>
|
||||
>
|
||||
requires( ConstructibleWith< T, tag, depth > )
|
||||
struct tagged_ctor_count< T, tag, depth >
|
||||
// Size is 1 more than the depth we probed, since that also accounts for the tag.
|
||||
: std::integral_constant< std::size_t, depth + 1 > {};
|
||||
|
||||
|
Reference in New Issue
Block a user