1
0
forked from Alepha/Alepha

Pairs !- tuples, so add some better Meta support

I usually use `tuple` for all product types, but some STL bits
use pair, which is a distinct type.  So here's some helpful
meta helpers for them.
This commit is contained in:
2021-10-15 05:19:09 -04:00
parent 6dcc093af6
commit 525c5b7be8
4 changed files with 139 additions and 0 deletions

36
Meta/pair_decay.h Normal file
View File

@ -0,0 +1,36 @@
static_assert( __cplusplus > 201700, "C++17 Required" );
#pragma once
#include <Alepha/Alepha.h>
#include <type_traits>
#include <Alepha/Stud/type_traits.h>
namespace Alepha::Hydrogen::Meta
{
inline namespace exports { inline namespace type_traits {} }
namespace detail::type_traits::pair_decay
{
inline namespace exports
{
template< typename T > struct pair_decay;
template< typename First, typename Second >
struct pair_decay< std::pair< First, Second > >
{
using type= std::pair< Stud::decay_t< First >, Stud::decay_t< Second > >;
};
template< typename T >
using pair_decay_t= typename pair_decay< T >::type;
}
}
namespace exports::type_traits
{
using namespace detail::type_traits::pair_decay::exports;
}
}