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