forked from Alepha/Alepha
Starting out Alepha from scratch, as a C++17 effort.
This one is going to be prepped for GitHub private, from the get go. This initial commit has some evaluation helpers and the unit testing infrastructure. `TableTest` will come next.
This commit is contained in:
48
Utility/evaluation.h
Normal file
48
Utility/evaluation.h
Normal file
@ -0,0 +1,48 @@
|
||||
static_assert( __cplusplus > 201700, "C++17 Required" );
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Alepha/Alepha.h>
|
||||
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
namespace Alepha::Hydrogen::Utility
|
||||
{
|
||||
inline namespace exports { inline namespace evaluation {} }
|
||||
|
||||
namespace detail::evaluation
|
||||
{
|
||||
struct evaluate_t {};
|
||||
struct enroll_t {};
|
||||
|
||||
inline namespace exports
|
||||
{
|
||||
inline constexpr evaluate_t evaluate;
|
||||
inline constexpr enroll_t enroll;
|
||||
}
|
||||
|
||||
template< typename Function >
|
||||
decltype( auto )
|
||||
operator <=( evaluate_t, Function &&init )
|
||||
{
|
||||
return std::forward< Function >( init )();
|
||||
}
|
||||
|
||||
template< typename Init >
|
||||
auto
|
||||
operator <=( enroll_t, Init init )
|
||||
{
|
||||
struct {} registration;
|
||||
|
||||
(void) ( evaluate <=init );
|
||||
|
||||
return registration;
|
||||
}
|
||||
}
|
||||
|
||||
namespace exports::evaluation
|
||||
{
|
||||
using namespace detail::evaluation::exports;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user