thesis version
This commit is contained in:
50
inc/alsk/skeleton/muscle/muscle.h
Normal file
50
inc/alsk/skeleton/muscle/muscle.h
Normal file
@ -0,0 +1,50 @@
|
||||
#ifndef ALSK_ALSK_SKELETON_MUSCLE_MUSCLE_H
|
||||
#define ALSK_ALSK_SKELETON_MUSCLE_MUSCLE_H
|
||||
|
||||
#include <tmp/pack.h>
|
||||
|
||||
namespace alsk {
|
||||
|
||||
/**
|
||||
* @brief hold the functionoid type and its links
|
||||
*/
|
||||
template<typename Type, typename Links>
|
||||
using Fun = tmp::Pack<Type, Links>;
|
||||
|
||||
}
|
||||
|
||||
template<typename T, T> struct Fn;
|
||||
|
||||
template<typename R, typename... Ts, R(*F)(Ts...)>
|
||||
struct Fn<R(*)(Ts...), F> {
|
||||
using Signature = R(Ts...);
|
||||
constexpr R operator()(Ts... args) { return F(args...); }
|
||||
};
|
||||
|
||||
template<typename R, typename... Ts, R(&F)(Ts...)>
|
||||
struct Fn<R(&)(Ts...), F> {
|
||||
using Signature = R(Ts...);
|
||||
constexpr R operator()(Ts... args) { return F(args...); }
|
||||
};
|
||||
|
||||
#define FN(f) Fn<decltype(f)&, f>
|
||||
#define FN_OVERLOAD(T, f) Fn<T, f>
|
||||
|
||||
/** C++17
|
||||
* namespace impl {
|
||||
*
|
||||
* template<typename T, T> struct Fn;
|
||||
*
|
||||
* template<typename R, typename... Ts, R(*F)(Ts...)>
|
||||
* struct Fn<R(*)(Ts...), F> {
|
||||
* R operator()(Ts... args) { return F(args...); }
|
||||
* };
|
||||
*
|
||||
* }
|
||||
*
|
||||
* template<auto F>
|
||||
* using Fn = impl::Fn<decltype(F), F>;
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user