1
0
forked from Alepha/Alepha

Add a bunch of TMP support.

I'm still on the fence about going full `constexpr` functions
for meta-code.  Overall, I think there's potential here.  I'm
not aiming to replicate what `boost::mpl` or `boost::hana` do
though.  This is more of an internal support mechanism for
Alepha code.  As-needed I'll implement things.
This commit is contained in:
2021-10-25 01:58:04 -04:00
parent 83aa3f9e61
commit 4538a8d943
4 changed files with 255 additions and 0 deletions

42
Meta/functional.h Normal file
View File

@ -0,0 +1,42 @@
static_assert( __cplusplus > 201700, "C++17 Required" );
#pragma once
// Analogue to `#include <functional>`
#include <Alepha/Alepha.h>
namespace Alepha::Hydrogen::Meta
{
inline namespace exports { inline namespace functional {} }
namespace detail::functional
{
inline namespace exports
{
template< template< typename, typename > class Function, typename First >
struct bind1st
{
using type= bind1st;
template< typename Arg >
struct call : Function< First, Arg >::type {};
};
template< template< typename, typename > class Function, typename Second >
struct bind2nd
{
using type= bind2nd;
template< typename Arg >
struct call : Function< Arg, second >::type {};
};
template< typename Function, typename ... Args >
struct call : Function::template call< Args... > {};
}
}
namespace exports::functional
{
using namespace detail::functional::exports;
}
}