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:
42
Meta/functional.h
Normal file
42
Meta/functional.h
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user