1
0
forked from Alepha/Alepha

Concept-like overloading of functions support.

When using `enable_if` clauses in templates, we need an NTTP
in the mix to let us get good overloading support.  The boolean
true/false trick of the `enable_if` second parameter actually
doesn't work for many situations.
This commit is contained in:
2021-10-19 22:28:45 -04:00
parent d870367f76
commit 744e02fb01

32
Meta/overload.h Normal file
View File

@ -0,0 +1,32 @@
static_assert( __cplusplus > 201700, "C++17 Required" );
#pragma once
#include <Alepha/Alepha.h>
namespace Alepha::Hydrogen::Meta
{
inline namespace exports { inline namespace template_overload {} }
namespace detail::template_overload
{
inline namespace exports {}
template< std::size_t >
struct holder
{
struct overload_t;
};
namespace exports
{
template< std::size_t i >
using overload= typename holder< i >::overload_t *;
}
}
namespace exports::template_overload
{
using namespace detail::template_overload::exports;
}
}