From f4c2e1e0448c4a4ab64e032742c3c181936e574b Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Thu, 19 Sep 2024 00:35:59 -0400 Subject: [PATCH] Add list size primitive to type lisp. --- type_lisp.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/type_lisp.h b/type_lisp.h index 97ac571..07c3618 100644 --- a/type_lisp.h +++ b/type_lisp.h @@ -48,6 +48,21 @@ namespace Alepha::Hydrogen ::detail:: type_lisp_m using type= std::tuple< Members... >; }; + template< TypeListType > + struct list_size; + + template< typename ... Members > + struct list_size< TypeList< Members... > > + { + static const std::size_t value= sizeof...( Members ); + }; + + namespace exports + { + template< TypeListType List > + constexpr std::size_t list_size_v= list_size< List >::value; + } + template< typename List > struct car_impl { using type= Nil; };