I have a function object with an explicit (i.e. not deduced) template parameter defined as follows:
struct foo
{
template<class T>
T operator()() const
{
return 5;
}
};
foo bar = {};
When I try to call it like this:
int main()
{
int i = bar<int>();
return 0;
}
I get a compilation error. Is it impossible to call a function object with a template parameter, like a regular function? I really need to have it as a function object. Making a free feature is actually not an option for me (or at least it's a very dirty option).
source
share