1
0
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:
2024-03-19 15:21:59 -04:00
parent 35e6089a80
commit 3707ec5cc2

View File

@ -36,6 +36,10 @@ namespace Alepha::Hydrogen::Reflection ::detail:: tagged_ctor_count_m
constexpr operator T (); 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 > template< typename T, typename ... Args >
requires( Concepts::ConstructibleFrom< T, Args... > ) requires( Concepts::ConstructibleFrom< T, Args... > )
constexpr void construct( std::tuple< 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 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 // The default arguments cause it to start with the blank sequence, even if it doesn't match this
// case in the specialization selection. // 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 struct tagged_ctor_count
: tagged_ctor_count< T, tag, cnt + 1 > {}; : 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 > template< typename T, typename tag, std::size_t depth >
struct tagged_ctor_count requires( ConstructibleWith< T, tag, depth > )
< struct tagged_ctor_count< T, tag, depth >
T,
tag,
depth,
std::void_t
<
decltype( construct< T >
(
std::tuple_cat( std::declval< expand_t< T, depth > >(), std::declval< std::tuple< tag > >() )
) )
>
>
// Size is 1 more than the depth we probed, since that also accounts for the tag. // Size is 1 more than the depth we probed, since that also accounts for the tag.
: std::integral_constant< std::size_t, depth + 1 > {}; : std::integral_constant< std::size_t, depth + 1 > {};