From d9b2362b54d9abb109ebfa078cd9ee43174602bf Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Thu, 21 Mar 2024 16:21:08 -0400 Subject: [PATCH] Start introducing more requires clauses. --- Reflection/tagged_ctor_arg.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Reflection/tagged_ctor_arg.h b/Reflection/tagged_ctor_arg.h index e868fe2..d1f2283 100644 --- a/Reflection/tagged_ctor_arg.h +++ b/Reflection/tagged_ctor_arg.h @@ -9,6 +9,9 @@ static_assert( __cplusplus > 2020'99 ); #include #include +#include + +#include #include @@ -77,6 +80,13 @@ namespace Alepha::Hydrogen::Reflection ::detail:: tagged_ctor_arg_m requires( Concepts::ConstructibleFrom< T, Args... > ) constexpr void construct( std::tuple< Args... > && ); + template< typename T, typename Tuple > + concept ConstructibleWithTuple= + requires( Tuple tup ) + { + { construct< T >( tup ) }; + }; + template < typename T, @@ -105,6 +115,15 @@ namespace Alepha::Hydrogen::Reflection ::detail:: tagged_ctor_arg_m typename tag, std::size_t ... positions > + requires + ( + ConstructibleWithTuple + < + T, + Meta::tuple_cat_t< + tuple_from_list_t< repeat_t< argument< T >, sizeof...( positions ) > >, std::tuple< tag > > + > + ) struct extract_all_ctor_arguments < T, @@ -123,6 +142,16 @@ namespace Alepha::Hydrogen::Reflection ::detail:: tagged_ctor_arg_m > > { + static_assert + ( + ConstructibleWithTuple + < + T, + Meta::tuple_cat_t< + tuple_from_list_t< repeat_t< argument< T >, sizeof...( positions ) > >, std::tuple< tag > > + > + ); + template < typename int_const,