From 5242aa340a3cdebce46f47b932b563aad55401e9 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Thu, 21 Mar 2024 16:13:30 -0400 Subject: [PATCH 1/2] Tuple concatenation. --- Meta/tuple_cat.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Meta/tuple_cat.h diff --git a/Meta/tuple_cat.h b/Meta/tuple_cat.h new file mode 100644 index 0000000..79f7079 --- /dev/null +++ b/Meta/tuple_cat.h @@ -0,0 +1,24 @@ +static_assert( __cplusplus > 2020'99 ); + +#pragma once + +#include + +#include + +#include + +namespace Alepha::Hydrogen::Meta ::detail:: tuple_cat_m +{ + inline namespace exports + { + template< typename Left, typename Right > + using tuple_cat_t= tuple_from_list_t< list_cat_t< list_from_tuple_t< Left >, list_from_tuple_t< Right > > >; + } +} + +namespace Alepha::Hydrogen::Meta::inline exports::inline tuple_cat_m +{ + using namespace detail::tuple_cat_m::exports; +} + From 5438ae93121ef2f0b2b14ae1a35eddf3a4247a56 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Thu, 21 Mar 2024 16:20:26 -0400 Subject: [PATCH 2/2] Add a repeat function to type lisp. --- type_lisp.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/type_lisp.h b/type_lisp.h index ca2331f..b8e36bd 100644 --- a/type_lisp.h +++ b/type_lisp.h @@ -141,6 +141,27 @@ namespace Alepha::Hydrogen ::detail:: type_lisp_m { using type= TypeList< LeftArgs..., RightArgs... >; }; + + template< typename Item, std::size_t count > + struct repeat; + + namespace exports + { + template< typename Item, std::size_t count > + using repeat_t= typename repeat< Item, count >::type; + } + + template< typename Item, std::size_t count > + struct repeat + { + using type= cons_t< Item, repeat_t< Item, count - 1 > >; + }; + + template< typename Item > + struct repeat< Item, 0 > + { + using type= Nil; + }; } namespace Alepha::Hydrogen::inline exports::inline type_lisp_m