53 lines
1.3 KiB
C
53 lines
1.3 KiB
C
|
#ifndef ALSK_ALSK_SKELETON_LINK_LINK_H
|
||
|
#define ALSK_ALSK_SKELETON_LINK_LINK_H
|
||
|
|
||
|
#include <tmp/pack.h>
|
||
|
|
||
|
#include "args.h"
|
||
|
#include "utility.h"
|
||
|
|
||
|
#include "../struct/struct.h"
|
||
|
|
||
|
namespace alsk {
|
||
|
|
||
|
/**
|
||
|
* @brief hold the skeleton links
|
||
|
*/
|
||
|
template<template<typename...> class T, typename F, typename... Ts>
|
||
|
using L = S<T, F, Ts...>;
|
||
|
|
||
|
namespace impl {
|
||
|
|
||
|
/**
|
||
|
* Pack of return types from links
|
||
|
*/
|
||
|
template<typename...> struct LinksToReturnTypes;
|
||
|
|
||
|
template<typename R, typename... Params, typename... Ls>
|
||
|
struct LinksToReturnTypes<R(Params...), Ls...> {
|
||
|
using type = tmp::PackCat<tmp::Pack<R>, typename LinksToReturnTypes<Ls...>::type>;
|
||
|
};
|
||
|
|
||
|
template<template<typename...> class Skel, typename R, typename... Params, typename... InnerLs, typename... Ls>
|
||
|
struct LinksToReturnTypes<alsk::L<Skel, R(Params...), InnerLs...>, Ls...> {
|
||
|
using type = tmp::PackCat<tmp::Pack<R>, typename LinksToReturnTypes<Ls...>::type>;
|
||
|
};
|
||
|
|
||
|
template<template<typename...> class Skel, std::size_t I, typename... Params, typename... InnerLs, typename... Ls>
|
||
|
struct LinksToReturnTypes<alsk::L<Skel, alsk::arg::R<I>(Params...), InnerLs...>, Ls...> {
|
||
|
using rets = typename LinksToReturnTypes<InnerLs...>::type;
|
||
|
using R = tmp::PackGet<rets, I>;
|
||
|
using type = tmp::PackCat<tmp::Pack<R>, typename LinksToReturnTypes<Ls...>::type>;
|
||
|
};
|
||
|
|
||
|
template<>
|
||
|
struct LinksToReturnTypes<> {
|
||
|
using type = tmp::Pack<>;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|