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