I want to do functions with type variant input, like this:
int count(vector<auto> base, auto val)
{
int sum= 0;
for (auto it : base)
{
if (it == val)
{
sum++;
}
}
return sum;
}
or this:
string str(auto a)
{
stringstream x;
x << a;
return x.str();
}
But of course, it did not work. I received the following error:
error: invalid use of 'auto'
How can I do this?