It seems to me, that since in C++ we can pass a template template, then a function accepting a template template should be able to pass a (its) template template into itself. However this appears not to be the case.
template< typename PREVIOUS_TYPE_T, typename TYPE_T >
struct Node
{
typedef TYPE_T TYPE;
typedef PREVIOUS_TYPE_T PREVIOUS_TYPE;
PREVIOUS_TYPE_T* previous;
template< template< typename... > typename FUNCTOR_T, typename... CURRENT_ARGUMENTS_T >
void DoCall() {
previous->DoCall< FUNCTOR_T, TYPE_T, CURRENT_ARGUMENTS_T... >();
}
};
Is there anyway to pass FUNCTOR_T
above, or any work around to doing so?
You cannot use ARGUMENTS_T
. That name has no effect.
When you're passing a template template around, it's still a template with no parameters passed to it. There is no template parameter to extract from std::plus
, as opposed to std::plus<int>
.
Instead, use CURRENT_ARGUMENTS_T
, which is what you intended to forward.
Also, you previous
is a dependent type. You must desambiguate the template:
previous->template DoCall< FUNCTOR_T, TYPE_T, CURRENT_ARGUMENTS_T... >();