forked from Alepha/Alepha
Apply the newer namespace rules and layout/formatting.
This commit is contained in:
@ -6,51 +6,46 @@ static_assert( __cplusplus > 2020'99 );
|
||||
|
||||
#include <Alepha/Alepha.h>
|
||||
|
||||
namespace Alepha::Hydrogen::Meta
|
||||
namespace Alepha::Hydrogen::Meta ::detail:: functional_m
|
||||
{
|
||||
inline namespace exports { inline namespace functional {} }
|
||||
|
||||
namespace detail::functional
|
||||
inline namespace exports
|
||||
{
|
||||
inline namespace exports
|
||||
{
|
||||
template< typename MetaFunction, typename Arg >
|
||||
constexpr auto bind1st( MetaFunction func, Arg arg );
|
||||
}
|
||||
|
||||
template< typename MetaFunction, typename Arg > struct binder1st;
|
||||
|
||||
template< typename MetaFunction, typename Arg1, typename Arg2 >
|
||||
constexpr decltype( auto )
|
||||
invoke_call( MetaFunction func, Meta::type_value< Arg1 > arg1, Meta::type_value< Arg2 > arg2 )
|
||||
{
|
||||
return func( arg1, arg2 );
|
||||
}
|
||||
|
||||
template< typename MetaFunction, typename Arg >
|
||||
struct binder1st< MetaFunction, Meta::type_value< Arg > >
|
||||
{
|
||||
MetaFunction func;
|
||||
Meta::type_value< Arg > arg;
|
||||
|
||||
template< typename Second >
|
||||
constexpr decltype( auto )
|
||||
operator () ( const Second &second )
|
||||
{
|
||||
return invoke_call( func, arg, second );
|
||||
}
|
||||
};
|
||||
|
||||
template< typename MetaFunction, typename Arg >
|
||||
constexpr auto
|
||||
exports::bind1st( MetaFunction func, Arg arg )
|
||||
{
|
||||
return binder1st< MetaFunction, Arg >{ func, arg };
|
||||
}
|
||||
constexpr auto bind1st( MetaFunction func, Arg arg );
|
||||
}
|
||||
|
||||
namespace exports::functional
|
||||
template< typename MetaFunction, typename Arg > struct binder1st;
|
||||
|
||||
template< typename MetaFunction, typename Arg1, typename Arg2 >
|
||||
constexpr decltype( auto )
|
||||
invoke_call( MetaFunction func, Meta::type_value< Arg1 > arg1, Meta::type_value< Arg2 > arg2 )
|
||||
{
|
||||
using namespace detail::functional::exports;
|
||||
return func( arg1, arg2 );
|
||||
}
|
||||
|
||||
template< typename MetaFunction, typename Arg >
|
||||
struct binder1st< MetaFunction, Meta::type_value< Arg > >
|
||||
{
|
||||
MetaFunction func;
|
||||
Meta::type_value< Arg > arg;
|
||||
|
||||
template< typename Second >
|
||||
constexpr decltype( auto )
|
||||
operator () ( const Second &second )
|
||||
{
|
||||
return invoke_call( func, arg, second );
|
||||
}
|
||||
};
|
||||
|
||||
template< typename MetaFunction, typename Arg >
|
||||
constexpr auto
|
||||
exports::bind1st( MetaFunction func, Arg arg )
|
||||
{
|
||||
return binder1st< MetaFunction, Arg >{ func, arg };
|
||||
}
|
||||
}
|
||||
|
||||
namespace Alepha::Hydrogen::Meta::inline exports::inline functional_m
|
||||
{
|
||||
using namespace detail::functional_m::exports;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user