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

45
Meta/type_value.h Normal file
View File

@ -0,0 +1,45 @@
static_assert( __cplusplus > 2017, "C++17 Required" );
#pragma once
#include <Alepha/Alepha.h>
namespace Alepha::Hydrogen::Meta
{
inline namespace exports { inline namespace type_value_wrapper {} }
namespace detail::type_value_wrapper
{
inline namespace exports
{
template< typename >
struct type_value {};
template< typename Lhs, typename Rhs >
constexpr bool
operator == ( type_value< Lhs >, type_value< Rhs > )
{
return false;
}
template< typename Value >
constexpr bool
operator == ( type_value< Value >, type_value< Value > )
{
return true;
}
template< typename T >
constexpr auto
make_value_type( T&& )
{
return type_value< std::decay_t< T > >{};
}
}
}
namespace exports::type_value_wrapper
{
using namespace detail::type_value_wrapper::exports;
}
}