更新时间:2022-04-11 05:58:56
您可以提供一个明确的模板参数:
You can give an explicit template argument:
bar<int(int)>(3, foo);
或将模棱两可的函数名强制转换为可以从中推导出模板参数的类型:
or cast the ambiguous function name to a type from which the template argument can be deduced:
bar(3, static_cast<int(*)(int)>(foo));
或将其包装在另一个函数(或函数对象)中以消除歧义
or wrap it in another function (or function object) to remove the ambiguity
bar(3, [](int x){return foo(x);});