In my case, i defined a function in two different ways, fun1 is a lambda function, func2 is a regular std function,but the lambda one doesn't work with variadic arguments template funcction(vat_function).
the code below shows the problem:
#include <functional>
using namespace std;
template <typename... ParamTypes>
void vat_function(std::function<void(ParamTypes...)>,ParamTypes... parames)
{//this is a variadic arguments template function
};
void faa_function(std::function<void(bool,int)>,bool b,int i)
{//this is a std::function as parameter function
};
int main()
{
auto func1 = [](bool,int)->void
{
};
std::function<void(bool,int)> func2 = [](bool,int)->void
{
};
bool b=false;
int i=0;
vat_function<bool,int>(func1,b,i);//only this one doesn't work
vat_function<bool,int>(func2,b,i);//OK
faa_function(func1,b,i);//OK
faa_function(func2,b,i);//OK
}
vat_function(func1,b,i) doesn't work, why faa_function(func1,b,i) works?