forked from Alepha/Alepha
Add a repeat function to type lisp.
This commit is contained in:
21
type_lisp.h
21
type_lisp.h
@ -141,6 +141,27 @@ namespace Alepha::Hydrogen ::detail:: type_lisp_m
|
|||||||
{
|
{
|
||||||
using type= TypeList< LeftArgs..., RightArgs... >;
|
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
|
namespace Alepha::Hydrogen::inline exports::inline type_lisp_m
|
||||||
|
|||||||
Reference in New Issue
Block a user