1
0
forked from Alepha/Alepha

Add a template binding gadget for type lists.

This commit is contained in:
2024-06-14 11:28:13 -04:00
parent 500ad866eb
commit fa33154064
4 changed files with 61 additions and 0 deletions

38
make_template.h Normal file
View File

@ -0,0 +1,38 @@
static_assert( __cplusplus > 2023'00 );
#pragma once
#include <Alepha/Alepha.h>
#include <Alepha/type_lisp.h>
namespace Alepha::Hydrogen ::detail:: make_template_m
{
inline namespace exports {}
template< template< typename ... > class, TypeListType >
struct make_template;
template< template< typename ... > class Template, typename ... Types >
struct make_template< Template, TypeList< Types... > >
{
using type= Template< Types... >;
};
namespace exports
{
/*!
* Bind a type list to a class template which takes a list of arguments.
*
* @tparam Template The class template to instantiate.
* @tparam List The list of types (`Alepha::TypeList< ... >`) to bind.
*/
template< template< typename ... > class Template, TypeListType List >
using make_template_t= typename make_template< Template, List >::type;
};
}
namespace Alepha::Hydrogen::inline exports::inline make_template_m
{
using namespace detail::make_template_m::exports;
}