我想知道是否有任何方法可以获取由一组特定参数生成的函数模板的实例化地址.
#include <iostream>
template <typename T>
class A {};
template <typename T, typename T2>
int hello(A<T> a, A<T2> b, int c)
{
return 69;
}
int main()
{
A<int> a;
A<float> b;
std::cout << (&hello)(a, b, 3) << "\n";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
此代码打印函数调用返回的值.如何打印为a和b参数实例化的"hello"版本的地址?我希望编译器能够推断出这些类型.