frame_graph's FG_DEPS
Nielsbishere opened this issue · comments
Is your request related to a problem? Please describe.
FG_DEPS doesn't allow infinite expansion (only up to 6 dependencies) and requires the end-user to specify number of dependencies; which is redundant if using templates instead.
Describe the solution you'd like
fg_dep<DeferredMainTaskData, RTHybridData>();
where fg_dep:
namespace fg_deps
{
using type = std::vector<std::reference_wrapper<const std::type_info>>;
template<typename T, typename ...args>
struct insert
{
static inline void exec(type& deps)
{
deps.push_back(typeid(T));
fg_deps::insert<args...>::exec(deps);
}
};
template<typename T>
struct insert<T>
{
static inline void exec(type& deps)
{
deps.push_back(typeid(T));
}
};
template<typename ...args>
static inline type make() {
type result;
insert<args...>::exec(result);
return result;
}
}
template<typename ...args>
static const fg_deps::type& fg_dep()
{
static fg_deps::type deps = fg_deps::make<args...>();
return deps;
}
Describe alternatives you've considered
Additional context
N.A.
My solution to this was just:
template<class ...Ts>
std::vector<std::reference_wrapper<const std::type_info>> Deps() {
return { (typeid(Ts))...};
}
Yeah that's way cleaner, I didn't know this was a way of calling functions with variadic arguments. Only used sizeof...() before; which is different.