saving . . . saved Problems with Template Template Parameters has been deleted. Problems with Template Template Parameters has been Shown .
Problems with Template Template Parameters
Title
Question
1) Can spoken-tutorial arrange some tutorials on template under topic Advanced Cpp?
2) I tried to create one template function which takes another template function as parameter and calls it.
But the problem I am facing is that I can use template class but not template function  as "template template parameters"

Till now I am able to use explicitly deduced template function but not directly the template function name.
Here is my buggy code :
'
#include <iostream>
#include <stdio.h>
#include <functional>
#include <vector>
#include <typeinfo>
#include <thread>


using namespace std;


template <typename T>
void f(T ob)
{
cout<<ob<<",";
}

template <class F, typename... A>
void rec(F func,A... args)
{
func(args...);
}


template <template<class ...A> class F, typename... A>
void rec2(F<A...> func,A... args)
{
func(args...);
}


template <typename... A>
struct J
{
void operator()(A... ob) {\\\\tf(ob...); \\\\t}
};


template <typename... A>
void rec3(A... args)
{
rec2(J<A...>(),args...);
}



int main()
{
rec(f<const char *>,"PD"); //OK
J<int> ob1;
rec2(ob1,5); //OK
rec3(2); //OK
rec(f<float>,3.14f); //OK
// rec2(f,3.14f); //This line leads to an error
return 0;
}

'

Advanced-Cpp General None min None sec 19-11-15, 2:14 p.m. palashkok3@gmail.com

Answers:

Log-in to answer to this question.